key llRequestAgentData(key id, integer data)
This function requests information of type data (see constants below) about agent id. The information is returned via the dataserver event. The key returned by this function is the query id for the dataserver event.
id must be a valid agent key. Passing the key of an object or group will not trigger the dataserver event. To determine if a given key points to an agent, one could use a timer to function as a timeout after several seconds had passed, though this would hardly be 100% reliable.
Valid values of data and what each will return in the dataserver event:
Constant | Value | Returns |
DATA_ONLINE | 1 | (cast returned data to integer); determines if agent is online (TRUE/FALSE) |
DATA_NAME | 2 | gets full agent name (excluding any group titles); compare with llKey2Name |
DATA_BORN | 3 | gets account creation/”born on” date as a string in ISO 8601 format of YYYY-MM-DD. |
DATA_RATING | 4 | returns the agent’s ratings as a comma-separated string of six integers:
as of 1.15.0(2) the rating system was removed and this will now return 0,0,0,0,0,0 |
DATA_PAYINFO | 8 | returns the account type bitfield (an integer, cast as a string);
|
Attempting to give llRequestAgentData a combined data integer (as in llSensor) in an attempt to get the dataserver event to return two or more values simultaneously won’t work. (1 + 2 = 3, and 1 + 3 = 4, which are clearly marked as DATA_BORN and DATA_RATING respectively.) Even if it did work, there’s no way for the dataserver event to return two things, anyway.
Unfortunately, there isn’t a way to return either the active or inactive groups a given agent is in. Passing llRequestAgentData the key of a group or object will not trigger the dataserver event, or return an error message. The best option is to try llSameGroup. Depending on what is trying to be accomplished, it may work.
Note: This function delays the script for 0.1 seconds.
Example:
default { touch_start(integer num_detected) { llRequestAgentData(llDetectedKey(0), DATA_BORN); // request creation date } dataserver(key queryid, string data) { llSay(0, "You were born on: " + data); } }
There is a gap in the constant values because the DATA_* namespace is shared with llRequestSimulatorData.