Difference between revisions of "LlGetUsername"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
{{LSL_Function/avatar|id|sim=*}}{{LSL_Function
{{LSL_Function/avatar|id|sim=known}}{{LSL_Function
|inject-1
|inject-1
|func_id=NNN|func_sleep=0.0|func_energy=10.0
|func_id=NNN|func_sleep=0.0|func_energy=10.0

Revision as of 21:47, 27 November 2010

Summary

Function: string llGetUsername( key id );

Returns a string that is the unique username of the avatar specified by id.

• key id avatar UUID that is in the same region or is otherwise known to the region

id must specify a valid avatar key, present in or otherwise known to the sim in which the script is running, otherwise an empty string is returned. This function will still return a valid username 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).

Caveats

  • To get around the "avatar must be present" limitation, you can use the llRequestUsername function and the dataserver event to obtain the avatar's username from a key.
  • There is no opposite function (llUsername2Key) available.
All Issues ~ Search JIRA for related Bugs

Examples

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

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

See Also

Functions

•  llGetDisplayName
•  llRequestUsername Uses the dataserver to request avatar information

Deep Notes

Search JIRA for related Issues

Signature

function string llGetUsername( key id );