Difference between revisions of "LlRequestUsername"

From Second Life Wiki
Jump to navigation Jump to search
m
m
 
(14 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{#vardefine:p_data_desc|DATA_* flag}}{{LSL_Function
{{LSL_Function
|inject-1
|inject-2={{LSL Function/avatar|id}}
|inject-2={{LSL Function/avatar|id}}
|func_id=NNN|func_sleep=0.0|func_energy=10.0
{{Issues/SCR-388}}
|func_id=359|func_sleep=0.0|func_energy=10.0
|func=llRequestUsername
|func=llRequestUsername
|return_type=key
|return_type=key
|return_subtype=handle
|return_text=that is used to identify the [[dataserver]] event when it is raised.
If {{LSLPT|id}} is not the UUID of an avatar, the [[dataserver]] event is not raised.
|p1_type=key|p1_name=id
|p1_type=key|p1_name=id
|func_footnote
|func_desc=Requests the '''[[Usernames|Username]]''' of the agent identified by {{LSLPT|id}}. When the '''[[Usernames|Username]]''' is available the [[dataserver]] event will be raised. The agent identified by {{LSLPT|id}} does not need to be in the same region or online at the time of the request.  
|func_desc=Requests the '''[[Usernames|Username]]''' of the agent identified by '''id'''. When '''[[Usernames|Username]]''' is available the [[dataserver]] event will be raised. The agent identified by '''id''' does not need to be in the same region or online at the time of the request.
|func_footnote=If the name has been changed some time in the past, this provides only the current name.
|return_text=that is used to identify the [[dataserver]] event when it is raised.
|spec
|spec
|caveats=*If you merely wish to show avatar name information in the viewer window, it may be more straightforward to avoid a dataserver event and simply output: <lsl>llSay(0, "secondlife:///app/agent/" + (string)id + "/about");</lsl>
|caveats=
*If you merely wish to show the agent username in the viewer window, it may be more straightforward to use [[Viewer URI Name Space]] and avoid a dataserver event, e.g.:<source lang="lsl2">llSay(0, "secondlife:///app/agent/" + (string)id + "/username");</source>
* This function is throttled. The throttle is undocumented, but as of October 2018 the function appears to support bursts of up to 20 requests and sustained use at an average rate of 1.9 requests per second per owner, per region. (Meaning the throttle applies to all objects in the region with the same owner.) Once tripped, the function fails and says "Too many llRequestUsername requests.  Throttled until average falls." on [[DEBUG_CHANNEL]].
|constants
|constants
|examples=<lsl>key owner_key;
|examples=<source lang="lsl2">key owner_name_query;
key owner_name_query;
string owner_username;
 
default
default
{
{
     state_entry()
     state_entry()
     {
     {
         owner_key = llGetOwner();
         owner_name_query = llRequestUsername(llGetOwner());
        owner_name_query = llRequestUsername(owner_key);
     }
     }
     dataserver(key queryid, string data)
     dataserver(key queryid, string data)
     {
     {
         if ( owner_name_query == queryid )
         if ( owner_name_query == queryid )
         {
         {
            owner_display_name = data;
             llSay(0, "The username of the owner of this script : " + data);
             llSay(0, "The username of the owner of this script : " + owner_username );
         }
         }
     }
     }
}</lsl>
}</source>
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llGetUsername]]|}}
|also_functions=
{{LSL DefineRow||[[llGetUsername]]|works only for avatars that are present}}
{{LSL DefineRow||[[llRequestUserKey]]|general way to translate a name to a key}}
|also_tests
|also_tests
|also_events={{LSL DefineRow||[[dataserver]]|}}
|also_events={{LSL DefineRow||[[dataserver]]|}}

Latest revision as of 14:00, 27 February 2020

Summary

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

Requests the Username of the agent identified by id. When the Username is available the dataserver event will be raised. The agent identified by id does not need to be in the same region or online at the time of the request.
Returns a handle (a key) that is used to identify the dataserver event when it is raised. If id is not the UUID of an avatar, the dataserver event is not raised.

• key id avatar UUID

If the name has been changed some time in the past, this provides only the current name.

Caveats

  • If you merely wish to show the agent username in the viewer window, it may be more straightforward to use Viewer URI Name Space and avoid a dataserver event, e.g.:
    llSay(0, "secondlife:///app/agent/" + (string)id + "/username");
    
  • This function is throttled. The throttle is undocumented, but as of October 2018 the function appears to support bursts of up to 20 requests and sustained use at an average rate of 1.9 requests per second per owner, per region. (Meaning the throttle applies to all objects in the region with the same owner.) Once tripped, the function fails and says "Too many llRequestUsername requests. Throttled until average falls." on DEBUG_CHANNEL.

Examples

key owner_name_query;
 
default
{
    state_entry()
    {
        owner_name_query = llRequestUsername(llGetOwner());
    }

    dataserver(key queryid, string data)
    {
        if ( owner_name_query == queryid )
        {
            llSay(0, "The username of the owner of this script : " + data);
        }
    }
}

See Also

Events

•  dataserver

Functions

•  llGetUsername works only for avatars that are present
•  llRequestUserKey general way to translate a name to a key

Deep Notes

Signature

function key llRequestUsername( key id );