Difference between revisions of "LlKey2Name"

From Second Life Wiki
Jump to: navigation, search
(ssl?)
(Clarified llKey2Name returns am empty string for group keys.)
 
(49 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}{{LSL_Function
+
{{LSL_Function
 +
|inject-2={{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}
 
|func_id=210|func_sleep=0.0|func_energy=10.0
 
|func_id=210|func_sleep=0.0|func_energy=10.0
 
|sort=Key2Name|func=llKey2Name
 
|sort=Key2Name|func=llKey2Name
 
|return_type=string|p1_type=key|p1_name=id
 
|return_type=string|p1_type=key|p1_name=id
|func_footnote='''id''' must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).<br /><br />
+
|func_footnote={{LSLP|id}} must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).<br /><br />
 
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.
 
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.
 +
 +
Although the function description claims {{LSLP|id}} can be a group key, in practice using a group key with this function always returns an empty string.
 
|func_desc
 
|func_desc
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by '''id'''.
+
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by {{LSLP|id}}.
 
|spec
 
|spec
 
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.
 
|caveats=* It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use [[llGetObjectDetails]] to avoid this problem.
 
* To get around the "avatar must be present" limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar's name from a key.
 
* To get around the "avatar must be present" limitation, you can use the [[llRequestAgentData]] function and the [[dataserver]] event to obtain the avatar's name from a key.
* There is no opposite function ([[llName2Key]]) available. However, there are third-party websites which can be queried using the [[llHTTPRequest]] function and the [[http_response]] event.
+
* The opposite function ([[llName2Key]]) can be used to find the user key associated with an avatar in the same region. To find the user key of an avatar anywhere on the grid, use [[llRequestUserKey]], which triggers a [[dataserver]] event.
 
* If an avatar is "ghosted" (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.
 
* If an avatar is "ghosted" (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in [[llSensor]] and the [[Mini-Map]].  This fact can be used as the basis of a [[Ghost Detector]] script.
 
|constants
 
|constants
|examples=<lsl>// Best viewed in Chat History (ctrl-h)
+
|examples=
 +
<source lang="lsl2">
 +
// Best viewed in Chat History (ctrl-h)
 +
 
 
default
 
default
 
{
 
{
     collision_start(integer a)//Announce who collided
+
     collision_start(integer num_detected)
 
     {
 
     {
         llSay(0, "llKey2Name: " + llKey2Name(llDetectedKey(0)) +
+
        key id = llDetectedKey(0);
              "\nllDetectedName: " + llDetectedName(0));
+
        string name = llKey2Name(id);
 +
 
 +
        string detectedName = llDetectedName(0);
 +
 
 +
         llSay(0, "llKey2Name: " + name
 +
            + "\nllDetectedName: " + detectedName);
 
     }
 
     }
     touch_start(integer a)
+
 
 +
     touch_start(integer num_detected)
 
     {
 
     {
         llSay(0,"llKey2Name: " + llKey2Name(llDetectedKey(0)) +
+
        key id = llDetectedKey(0);
              "\nllDetectedName: " + llDetectedName(0));
+
        string name = llKey2Name(id);
 +
 
 +
        string detectedName = llDetectedName(0);
 +
 
 +
         llSay(0, "llKey2Name: " + name
 +
            + "\nllDetectedName: " + detectedName);
 
     }
 
     }
}</lsl>
+
}
 +
</source>
 
|helpers
 
|helpers
 
|also_functions=
 
|also_functions=
Line 37: Line 55:
 
{{LSL DefineRow||[[Prim Attribute Overloading]]}}
 
{{LSL DefineRow||[[Prim Attribute Overloading]]}}
 
|also_tests
 
|also_tests
|notes='''Active Name2Key Databases:'''
+
|notes='''World Wide Web Consortium'''
*http://n2k.danardlabs.com ( {{LSLGC|Legacy Name|Legacy Names}} & {{LSLGC|Username|Usernames}} supported)
+
*[[N2K]] - Independent of databases or bots, this uses the [http://cgi.w3.org/cgi-bin/html2txt W3C html2text] to convert the viewer search to text and extract the key from Second Life's own services.
*http://w-hat.com/name2key
+
'''Active Name2Key Databases:'''
*http://kdc.ethernia.net/sys/name2key.php
+
*[http://w-hat.com/name2key W-Hat name2key] (last names replaced with the ''Resident'' word for the {{LSLGC|Username|Usernames}})
*http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)
+
*[http://kdc.ethernia.net/sys/name2key.php KDC name2key]
*http://insl.kubwa.de/name2key.php?name=name (Bot based name2key Database. Supports: {{LSLGC|Legacy Name|Legacy}} and {{LSLGC|Username}} formats)
+
  
 
'''Dead Name2Key Databases:'''
 
'''Dead Name2Key Databases:'''
 +
*[http://kubwa.net/index.php?cmd=name2key Kubwa name2key] (Bot based name2key Database; Supports: {{LSLGC|Legacy Name|Legacy}} and {{LSLGC|Username}} formats; Shows related names; SSL support.) <font color=red>(Appears to be gone as of Apr 2013 [Reports Error 404])</font>
 +
*<s>http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)</s> <font color=red>(Apez seems to be gone ? - May 2011)</font>
 
*<s>http://www.libsecondlife.org/protocol/index.php/Name2key</s><font color=red>(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)</font>
 
*<s>http://www.libsecondlife.org/protocol/index.php/Name2key</s><font color=red>(Appears to be gone as of Apr 2008, but search for name2key on that site for more information)</font>
 
*<s>http://www.ulrikasheim.org/tools/name2key.html</s><font color=red>(Appears to be gone as of Apr 2008)</font>
 
*<s>http://www.ulrikasheim.org/tools/name2key.html</s><font color=red>(Appears to be gone as of Apr 2008)</font>
 +
*<s>[http://www.db4mv.info DB4MV name2key] (Name2Key Database for Avatars ({{LSLGC|Legacy Name|Legacy Names}},{{LSLGC|Username|Usernames}}, and {{LSLGC|Display Name|Display Names}}, GroupNames and Keys, LSL API)</s><font color=red>(Currently listed as non-existant by host)</font>
  
 
'''Name2Key Libraries:'''
 
'''Name2Key Libraries:'''
 
*[[Name2Key_in_LSL]]
 
*[[Name2Key_in_LSL]]
 
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik's Name2Key PHP script]]
 
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik's Name2Key PHP script]]
 +
*[[Failsafename2key|Failsafe name2key script]]
 
|cat1=Avatar
 
|cat1=Avatar
 
|cat2=Prim
 
|cat2=Prim
Line 56: Line 77:
 
|cat4=Avatar/Name
 
|cat4=Avatar/Name
 
|cat5=Legacy Name
 
|cat5=Legacy Name
 +
|haiku={{Haiku|Numbers in machines,|Faceless, inhuman, sterile.|Bleak identities.}}
 +
|history={{LSL Added|0.4.0|remote=http://secondlife.wikia.com/wiki/Version_0.4.0#Scripting}}
 
}}
 
}}

Latest revision as of 10:37, 16 September 2018

Summary

Function: string llKey2Name( key id );

Returns a string that is the legacy name of the prim or avatar specified by id.

• key id group, avatar or prim UUID that is in the same region

id must specify a valid rezzed prim or avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. In the case of an avatar, this function will still return a valid name if the avatar is a child agent of the sim (i.e., in an adjacent sim, but presently able to see into the one the script is in), or for a short period after the avatar leaves the sim (specifically, when the client completely disconnects from the sim, either as a main or child agent).

Keys of inventory items will not work; in the case of these, use llGetInventoryName instead.

Although the function description claims id can be a group key, in practice using a group key with this function always returns an empty string.

Caveats

  • It is difficult to tell the difference between a prim that has a name that is an empty string and a prim that is not in the sim, or because an invalid key was specified. Use llGetObjectDetails to avoid this problem.
  • To get around the "avatar must be present" limitation, you can use the llRequestAgentData function and the dataserver event to obtain the avatar's name from a key.
  • The opposite function (llName2Key) can be used to find the user key associated with an avatar in the same region. To find the user key of an avatar anywhere on the grid, use llRequestUserKey, which triggers a dataserver event.
  • If an avatar is "ghosted" (which occasionally happens due to a longstanding server bug), an empty string is returned even though the avatar is seemingly present and shows up in llSensor and the Mini-Map. This fact can be used as the basis of a Ghost Detector script.

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   llKey2Name returns text "(Loading...)" instead of empty string or avatar name

Examples

// Best viewed in Chat History (ctrl-h)
 
default
{
    collision_start(integer num_detected)
    {
        key id = llDetectedKey(0);
        string name = llKey2Name(id);
 
        string detectedName = llDetectedName(0);
 
        llSay(0, "llKey2Name: " + name
            + "\nllDetectedName: " + detectedName);
    }
 
    touch_start(integer num_detected)
    {
        key id = llDetectedKey(0);
        string name = llKey2Name(id);
 
        string detectedName = llDetectedName(0);
 
        llSay(0, "llKey2Name: " + name
            + "\nllDetectedName: " + detectedName);
    }
}

Notes

World Wide Web Consortium

  • N2K - Independent of databases or bots, this uses the W3C html2text to convert the viewer search to text and extract the key from Second Life's own services.

Active Name2Key Databases:

Dead Name2Key Databases:

Name2Key Libraries:

See Also

Functions

•  llGetUsername
•  llGetDisplayName
•  llGetObjectDetails
•  llRequestAgentData Uses the dataserver to request avatar information

Articles

•  Prim Attribute Overloading

Deep Notes

History

All Issues

~ Search JIRA for related Issues
   llRequestAgentKey() (llName2Key())
   llKey2Name returns avatar names with double space between first and last (sometimes)
   llKey2Name returns text "(Loading...)" instead of empty string or avatar name

Footnotes

  1. ^ Early release notes were not very accurate or thorough, they sometimes included information about features added in previous releases or failed to include information about features added in that release.

Signature

function string llKey2Name( key id );

Haiku

Numbers in machines,
Faceless, inhuman, sterile.
Bleak identities.