Difference between revisions of "User:Strife Onizuka/Sandbox/Nest"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{User:Strife Onizuka/Sandbox}}
{{LSL_Function
<div>
|inject-2={{Issues/SVC-215}}{{Issues/SVC-4170}}{{Issues/SVC-3935}}{{LSL_Function/uuid|id|sim=*}}
{{LSL Generic/Caveats|title=*}}
|func_id=210|func_sleep=0.0|func_energy=10.0
</div>
|sort=Key2Name|func=llKey2Name
<div>
|return_type=string|p1_type=key|p1_name=id
{{LSL Generic/Issues}}
|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 />
</div>
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.
{{#var:BugCounter}}
|func_desc
{{Issue/Bug Check}}
|return_text=that is the {{LSLGC|Avatar/Name|legacy name}} of the prim or avatar specified by '''id'''.
|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.
* 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.
* 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
|examples=<lsl>// Best viewed in Chat History (ctrl-h)
default
{
    collision_start(integer a)//Announce who collided
    {
        llSay(0, "llKey2Name: " + llKey2Name(llDetectedKey(0)) +
              "\nllDetectedName: " + llDetectedName(0));
    }
    touch_start(integer a)
    {
        llSay(0,"llKey2Name: " + llKey2Name(llDetectedKey(0)) +
              "\nllDetectedName: " + llDetectedName(0));
    }
}</lsl>
|helpers
|also_functions=
{{LSL DefineRow||[[llGetUsername]]}}
{{LSL DefineRow||[[llGetDisplayName]]}}
{{LSL DefineRow||[[llGetObjectDetails]]}}
{{LSL DefineRow||[[llRequestAgentData]]|Uses the [[dataserver]] to request avatar information}}
|also_events
|also_articles=
{{LSL DefineRow||[[Prim Attribute Overloading]]}}
|also_tests
|notes='''Active Name2Key Databases:'''
*http://n2k.danardlabs.com (SSL, {{LSLGC|Legacy Name|Legacy Names}} & {{LSLGC|Username|Usernames}} supported)
*http://w-hat.com/name2key
*http://kdc.ethernia.net/sys/name2key.php
*http://wiki.apez.biz/Development (web-service API functions getAvatarKey and getAvatarName)
*http://insl.kubwa.de/name2key.php?name=name (Bot based name2key Database. Supports: {{LSLGC|Legacy Name|Legacy}} and {{LSLGC|Username}} formats)
 
'''Dead Name2Key Databases:'''
*<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>
 
'''Name2Key Libraries:'''
*[[Name2Key_in_LSL]]
*[[User:Ugleh_Ulrik/Name2Key|Ugleh Ulrik's Name2Key PHP script]]
|cat1=Avatar
|cat2=Prim
|cat3=Key
|cat4=Avatar/Name
|cat5=Legacy Name
}}

Revision as of 15:01, 17 December 2010

Summary

Function: string llKey2Name( key id );
0.0 Forced Delay
10.0 Energy

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.

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.
  • 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.
  • 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.

Examples

<lsl>// Best viewed in Chat History (ctrl-h) default {

   collision_start(integer a)//Announce who collided
   {
       llSay(0, "llKey2Name: " + llKey2Name(llDetectedKey(0)) +
              "\nllDetectedName: " + llDetectedName(0));
   }
   touch_start(integer a)
   {
       llSay(0,"llKey2Name: " + llKey2Name(llDetectedKey(0)) +
              "\nllDetectedName: " + llDetectedName(0));
   }
}</lsl>

Notes

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

Signature

function string llKey2Name( key id );