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

Syntax

key llRequestAgentData( key id, integer data );

Forced delay: 0.1 seconds. Energy: 10.0.

Parameters

key id
avatar UUID
integer data
DATA_* flag

Return value

Returns a handle (a key) for the dataserver event when it is raised.

Constants

data ConstantTypeDescription
DATA_ONLINE1(integer) booleanIf the requested agent is online
DATA_NAME2stringThe requested agent's legacy name
DATA_BORN3stringThe account creation/"born on" date as a string in an ISO 8601 format of YYYY-MM-DD.
DATA_RATING4llCSV2List()Deprecated: Returns [0, 0, 0, 0, 0, 0]
Used to return: [pos_behavior, neg_behavior, pos_appearance, neg_appearance, pos_building, neg_building]
DATA_PAYINFO8(integer) maskFlagDescription
PAYMENT_INFO_ON_FILE0x1If payment info is on file.
PAYMENT_INFO_USED0x2If payment info has been used.

Caveats

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

Events

Functions

Deep notes

If you merely wish to show avatar name information in the viewer window, it may be more straightforward to avoid a DATA_NAME dataserver event and simply output:

llSay(0, "secondlife:///app/agent/" + (string)id + "/about");

Issues