Talk:LlGetOwner

From Second Life Wiki
Revision as of 20:29, 29 September 2007 by Ppaatt Lynagh (talk | contribs) (let's demo combining llGetOwner with llMD5String to choose by owner)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Perhaps we should explain how to choose by owner ... either in this article or linked nearby ...

For example, to choose between 0 and 99 inclusive, making the same choice for the same owner every time while yet likely making a different choice for any few owners, is:

integer byOwner(integer beyond)
{
    string nybbles = llMD5String(llGetOwner(), 0);    
    string literal = "0x" + llGetSubString(nybbles, -8, -1);
    integer choice = (integer) literal;
    return (choice % beyond);
}

default
{
    state_entry()
    {
        llOwnerSay((string) byOwner(100));
    }
}

See also: 32bit_Hash