Difference between revisions of "LlKey2Name"

From Second Life Wiki
Jump to: navigation, search
(Expanded info a bit, consolidated redundancy, added Name2Key info.)
Line 3: Line 3:
 
|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=If '''id''' is not in the sim and has not been in it recently, an empty string is returned.
+
|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 />
 +
Keys of inventory items will not work; in the case of these, use [[llGetInventoryName]] instead.
 
|func_desc
 
|func_desc
|return_text=that is the name of the prim / avatar '''id'''.
+
|return_text=that is the name of the prim or avatar specified by '''id'''.
 
|spec
 
|spec
|caveats=*It is difficult to tell the difference between an object that has a name that is an empty string and an object that is not in the sim.
+
|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.
* If the avatar is not in online and in the sim the script is running you must use dataserver and [[llRequestAgentData]] to get the avatars 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.
 
|constants
 
|constants
 
|examples=<lsl>// Best viewed in Chat History (ctrl-h)
 
|examples=<lsl>// Best viewed in Chat History (ctrl-h)
Line 21: Line 23:
 
|helpers
 
|helpers
 
|also_functions=
 
|also_functions=
{{LSL DefineRow||[[llGetObjectDetails]]}}
+
{{LSL DefineRow||[[llGetObjectDetails]] [[llRequestAgentData]]}}
 
|also_events
 
|also_events
 
|also_articles=
 
|also_articles=
 
{{LSL DefineRow||[[Prim Attribute Overloading]]}}
 
{{LSL DefineRow||[[Prim Attribute Overloading]]}}
 
|also_tests
 
|also_tests
|notes
+
|notes=Current known Name2Key databases:<br />
 +
http://w-hat.com/name2key<br />
 +
http://www.libsecondlife.org/protocol/index.php/Name2key<br />
 +
http://www.ulrikasheim.org/tools/name2key.html
 
|permission
 
|permission
 
|negative_index
 
|negative_index

Revision as of 00:04, 28 March 2008

Deletion Requested
The deletion of this article was requested for the following reason:

Template is no longer used and it's creator thinks it does not function properly.

If there is a need to discuss the deletion of this article, please add your comment(s) here.

Summary

Function: string llKey2Name( key id );

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

• key id

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.
  • 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.
All Issues ~ Search JIRA for related Bugs

Examples

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

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

See Also

Deep Notes

Search JIRA for related Issues

Signature

function string llKey2Name( key id );