Don't click here unless you want to be banned.

LSL Wiki : llRequestAgentData

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
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:
  • 1. Zero (formerly positive-rated behavior)
  • 2. Zero (formerly negative-rated behavior)
  • 3. Zero (formerly positive-rated appearance)
  • 4. Zero (formerly negative-rated appearance)
  • 5. Zero (formerly positive-rated building)
  • 6. Zero (formerly negative-rated building)
  • (Note: negative ratings no longer exist.)
    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);
  • Bit 0: PAYMENT_INFO_ON_FILE Payment info on file
  • Bit 1: PAYMENT_INFO_USED Payment info used.

  • No Payment Info on File: 0
  • Payment Info on File: 1
  • No Payment Info on File AND Payment Info Used: 2 (Only Beta/Lifetime users fall under this status)
  • Payment Info on File AND Payment Info Used: 3

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 simulaneously 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.
Note: The length of the event queue is limited to 64 events. This sets an upper limit of 64 requests. If the queue overflows, the new events are silently discarded.

    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.

See also llKey2Name for a fast way to get an avatar's name.

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | dataserver
Comments [Hide comments/form]
key is the return type because you actually get the result from calling this function from within the dataserver() event. The dataserver() has two variables passed to it, a key and a string, the string is the data returned from the function, and the key is the key you use to differentiate between dataserver events, kind of like the integer returned from llListen() and using that integer in the llListenRemove().
-- ChristopherOmega (2004-02-18 02:27:20)
If there was a way to go from the full name of an agent to that agent's key (reversing the DATA_NAME functionality of llRequestAgentData), it would be nice to have a reference to it here.

Obviously, using llSensor would do this, but only if you're within range.
-- AlexanderDaguerre (2004-08-29 09:09:56)
There is no easy way. You could collect data of key/name pairs in a database, but it'd never be complete. Unless you only need a subset of the population on which you can reliably acquire data, such as people that bought an item from a vendor of yours (and you record their key/name upon using it).
-- EzharFairlight (2004-08-29 09:43:27)
There used to be a bug where a query for DATA_RATING did not return a dataserver event if all ratings where zero. This has since been fixed and this function now always returns a dataserver event.
-- EzharFairlight (2004-09-13 11:05:57)
Requests for data from cancelled accounts works as if the account were still active (accounts can be cancelled by the user through the accounts page of the website or by LL at any time) even when the account no longer appears in the Find->People window.
-- UshuaiaTokugawa (2005-07-10 13:50:14)
DATA_PAYINFO doesn't seem to be working. It's not recognized by the editor, and specifying the numeric value doesn't seem to work either.
-- DaleGlass (2006-08-02 02:15:21)
It looks like that is something they're about to add today in 1.11.2. (See Preview Release Notes)
-- StevenKramer (2006-08-02 07:02:41)
If you have multiple scripts in the same prim that use the dataserver, make sure you check the dataserver key! I got burned by this because I'd never actually read the dataserver event handler wiki page, and so didn't realize that the dataserver triggers *all* dataserver event handlers in the prim, not just the one in the script that caused it. (which should have been apparent if I'd thought about it a little bit, but I didn't).
-- NeoRebus (2006-08-20 20:16:35)
How often are the different Infos updated? DATA_ONLINE at least shows 1 at least a few minutes after logoff
-- StanislausNing (2007-01-07 08:05:47)
Something does not seem right. DATA_PAYINFO returns 2 for me, but I am not Beta/Lifetime user, just regular Payment info used. Was something removed/changed?
-- MerothJunge (2007-05-12 06:30:10)
How to get the name of the Simulator in which the Agent currently is located? Is there an easy way to do this?
I want an enhanced status info device that displays the current status of the Agent, including the region name of the agent.

(Only possibility I can think of is scripting this in an attached object the agent wears that sends a message to the object that needs to display the status of the agent every time the agent changes region. Is there any better way to do this?)
-- HeusDens (2007-08-14 12:40:05)
The Name2Key functionality exists, it is the database service, and there is an LSL script that does a query on that database using the llHttpRequest function. I believe it is in this wiki somewhere.
-- HeusDens (2007-08-14 12:42:41)
Attach a comment to this page: