Difference between revisions of "LlName2Key"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with "{{Issues/SVC-215}} {{LSL_Function |func_id |mode=request |func_sleep=0.1 |func_energy=10.0 |func=llNameToKey |sort=NameToKey |return_type=key |p1_type=string|p1_name=name|p1_desc…")
 
m (Replaced <source> with <syntaxhighlight>, added sleep/energy as well as a short comment on what the example should return, and added the obligatory haiku (thanks to Poem Generator!))
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Issues/SVC-215}}
[[Category:LSL_Functions]]
{{LSL_Function
{{LSL_Function
|func_id
|func=llName2Key|func_sleep=0.0|func_energy=0.0
|mode=request
|func_sleep=0.1
|func_energy=10.0
|func=llNameToKey
|sort=NameToKey
|sort=NameToKey
|return_type=key
|return_type=key
|p1_type=string|p1_name=name|p1_desc=the Legacy Name of the avatar to retrieve the UUID of.
|p1_type=string|p1_name=name|p1_desc=Name of the avatar to retrieve the UUID of.
|return_text=that is the UUID of the avatars with '''display_name''', if they are in the same sim that the script is in.
|return_text=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 <nowiki>"First[ Last]" or "first[.last]"</nowiki> (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.
|spec
|spec
|caveats=* Works only for agents recently located in the same sim the script is running in. To request a UUID for a non-local avatar then use [[llRequestAgentKeyByName|llRequestAgentKeyByName()]] instead.
|caveats=* This function does not operate on historical names. For historical name lookup use [[llRequestUserKey]].
|examples
|examples=<syntaxhighlight 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));
    }
}
// If Rider Linden touches the object, the three lines should contain the answer c5a07167-9bbe-4944-a7b0-a9677afa134d
</syntaxhighlight>
|helpers
|helpers
|haiku={{Haiku|Glorious high noon|A last, tiny name converts|in spite of the key}}
|related
|related
|also
|also
|also_functions=
|also_functions=
{{LSL DefineRow||[[llUsernameToKey]]}} to fetch avatar UUID by username.
{{LSL DefineRow||[[llRequestUserKey]]}} to fetch avatar UUID by current or historical username.
{{LSL DefineRow||[[llRequestAgentKeyByUsername]]}} to fetch avatar UUID by username grid-wide.
{{LSL DefineRow||[[llDisplayNameToKeys]]}} to fetch avatar UUIDs by display-name.
{{LSL DefineRow||[[llRequestAgentKeysByDisplayName]]}} to fetch avatar UUIDs by display-name grid-wide.
{{LSL DefineRow||[[llRequestAgentKeyByName]]}} to fetch avatar UUID by legacy-name grid-wide.
|notes=Please vote on {{jira|SVC-215}} if you would like to see this function implemented.
}}
}}

Latest revision as of 14:49, 7 April 2022

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));
    }
}
// If Rider Linden touches the object, the three lines should contain the answer c5a07167-9bbe-4944-a7b0-a9677afa134d

See Also

Functions

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

Deep Notes

Signature

function key llName2Key( string name );

Haiku

Glorious high noon
A last, tiny name converts
in spite of the key