Difference between revisions of "LlName2Key"

From Second Life Wiki
Jump to navigation Jump to search
Line 8: Line 8:
|spec
|spec
|caveats=* This function does not operate on historical names. For historical name lookup use [[llRequestUserKey]].
|caveats=* This function does not operate on historical names. For historical name lookup use [[llRequestUserKey]].
|examples
|examples=<source lang="lsl2">tellName2Key(string avatarName)
{
    key keyFromName = llName2Key(avatarName);
    if (keyFromName == NULL_KEY)
    {
        llSay(0, "There is no agent with the name '" + avatarName + "' currently signed onto the region.");
        return;
    }
    llSay(0, "Avatar key for name '" + avatarName + "': " + (string)keyFromName);
}
 
default
{
    touch_start(integer total_number)
    {
        tellName2Key("rider.linden");
        tellName2Key("Rider Linden");
        tellName2Key(llDetectedName(0));
    }
}</source>
|helpers
|helpers
|related
|related

Revision as of 08:27, 11 April 2021

Summary

Function: key llName2Key( string name );

Returns a key the Agent ID for the named agent in the region. If there is no agent with the specified name currently signed onto the region, this function returns the value NULL_KEY. Names are always provided in the form "First[ Last]" or "first[.last]" (first name with an optional last name.) If the last name is omitted a last name of "Resident" is assumed. Case is not considered when resolving agent names.

• string name Name of the avatar to retrieve the UUID of.

Caveats

  • This function does not operate on historical names. For historical name lookup use llRequestUserKey.

Examples

tellName2Key(string avatarName)
{
    key keyFromName = llName2Key(avatarName);
    if (keyFromName == NULL_KEY)
    {
        llSay(0, "There is no agent with the name '" + avatarName + "' currently signed onto the region.");
        return;
    }
    llSay(0, "Avatar key for name '" + avatarName + "': " + (string)keyFromName);
}

default
{
    touch_start(integer total_number)
    {
        tellName2Key("rider.linden");
        tellName2Key("Rider Linden");
        tellName2Key(llDetectedName(0));
    }
}

See Also

Functions

•  llRequestUserKey to fetch avatar UUID by current or historical username.

Deep Notes

Signature

function key llName2Key( string name );