Skip to content
lsl.devlsl.devLSL Dev

LlRequestAgentData

Looking for the current API? Open the llRequestAgentData reference →

Wiki description

Requests data about agent id. When data is available the dataserver event will be raised

Specification

Template:LSL Constants/llRequestAgentData: {{Template:LSL_Constants/llRequestAgentData}}
data Constant Type Description

Caveats

  • DATA_BORN is not UTC. It is Pacific Time based.
  • It's worth restating: if the requested data does not exist - or if the key given is not for an agent - then dataserver will not be raised.

Examples

DATA_NAME
key owner_key;
key owner_name_query;
string owner_name;

default
{
    state_entry()
    {
        owner_key = llGetOwner();
        owner_name_query = llRequestAgentData(owner_key, DATA_NAME);
    }
    dataserver(key queryid, string data)
    {
        if ( owner_name_query == queryid )
        {
            owner_name = data;
            llSay(0, "The owner of this script is called : " + owner_name );
        }
    }
}//Anylyn Hax 06:19, 23 July 2007 (PDT)
DATA_ONLINE
/*
    Server friendly online status example by Daemonika Nightfire.
    
    It is not a big load for the server to check every 2 minutes if there is an avatar in the region.
    But it is nonsense to trigger a dataserver event for online status when nobody is in the region.
    For this purpose, the script checks the number of avatars in the region on each pass.
*/


key owner;
float repeat = 120.0; // 60 - 120 sec. Recommended, faster than 60 seconds and LL will kick your XXX.

key status_request;
Status()
{
    integer agent_count = llGetRegionAgentCount();
    if(agent_count > 0) // skip the request if nobody is in the region
    {
        status_request = llRequestAgentData(owner, DATA_ONLINE);
    }
}

default
{
    state_entry()
    {
        owner = llGetOwner();
        llSetTimerEvent(repeat);
        Status();
    }

    timer()
    {
        Status();
    }
    
    dataserver(key queryid, string data)
    {
        if(queryid == status_request) 
        {
            // requested data contains the string "0" or "1" for DATA_ONLINE
            // i convert it to an integer and use the boolean as index
            
            //list index = [   0,       1,     2(0+2), 3(1+2)  ]
            list status = ["OFFLINE","ONLINE",<1,0,0>,<0,1,0>];
            
            string text = llList2String(status,(integer)data);    // boolean/index = 0   or 1
            vector color = llList2Vector(status,(integer)data+2); // boolean/index = 0+2 or 1+2
            
            llSetText(text, color, 1.0);
        }
    }
    
    on_rez(integer Dae)
    {
        llResetScript();
    }
}

See also: functions

See also: events

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:LSL Function/avatar

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<noinclude>{{Multi-lang|category=LSL}}</noinclude>{{#if:

{{#vardefine:p_{{{1|none}}}_desc|avatar {{#if:{{{group|}}}|or group}} {{HoverLink|UUID|Universally Unique Identifier}} {{#if:{{{sim|}}}{{{region|}}}|that is in the same [[region]] {{#ifeq:{{{sim|}}}{{{region|}}}|known|or is otherwise known to the region{{Footnote|handle=known}}}}}}}}

{{#vardefine:p_{{{1|none}}}_hover|avatar {{#if:{{{group|}}}|or group}} UUID {{#if:{{{sim|}}}{{{region|}}}|that is in the same region {{#ifeq:{{{sim|}}}{{{region|}}}|known|or is otherwise known to the region}}}}}}

<includeonly>
{{#if:{{{nc|}}}||{{#vardefine:hidden-text|{{#var:hidden-text}}
{{#if:{{#pos:{{#var:moded}}|r}}{{#pos:{{#var:moded}}|u}}||{{LSLC|Avatar/As A Parameter||{{#var:lang}}}}}}
}}}}
</includeonly>

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none}}}_hover}}
|}
</noinclude>

Template:Issues/SVC-215

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-215|'''llRequestAgentKey'''() ('''llName2Key'''())|type=nf}}

Template:Issues/SVC-6831

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-6831|[[llRequestAgentData]] with [[DATA_ONLINE]] parameter has a delay of up to 10 minutes in reporting offline status|type=bug}}
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.