llGetAgentInfo
integer llGetAgentInfo(key id// UUID of the avatar in the same region.
);- Returns
integer- Energy
- 10
Returns an integer bitfield containing status information about the agent specified by id (such as AGENT_FLYING, AGENT_ATTACHMENTS, AGENT_SITTING, etc.).
Returns an integer containing the agent information about id.
integer result = llGetAgentInfo(NULL_KEY);Specification
Section titled “Specification”| Constant | Val | Returned if agent… |
|---|---|---|
| 4096 | 0x1000 | has running ("Always Run") enabled, or is using tap-tap-hold |
| 2 | 0x0002 | has attachments |
| 16384 | 0x4000 | is marked as a scripted agent/bot |
| 8192 | 0x2000 | is in "autopilot" mode |
| 64 | 0x0040 | is in "away" mode |
| 2048 | 0x0800 | is in "busy" mode |
| 1024 | 0x0400 | is crouching |
| 32768 | 0x8000 | is floating or hovering because of a scripted attachment |
| 1 | 0x0001 | is flying or hovering |
| 256 | 0x0100 | is in the air (jumping, flying or falling) |
| 8 | 0x0008 | is in mouselook |
| 32 | 0x0020 | is sitting on an object (and linked to it) |
| 4 | 0x0004 | has scripted attachments |
| 16 | 0x0010 | is sitting1 |
| 512 | 0x0200 | is typing |
| 128 | 0x0080 | is walking, running or crouch walking |
Caveats
Section titled “Caveats”AGENT_BUSYindicates that the “busy” internal animation is playing, even if the user is not truly in busy mode.- On server 1.40 and below,
AGENT_TYPINGindicated that the “type” internal animation is playing, it would not be set if the user disabled PlayTypingAnim. On server 1.42 and up, it reflects typing start/stop messages from the client and does not depend on the animation. If the old behavior is desired, usellGetAnimationListand look for"c541c47f-e0c0-058b-ad1a-d6ae3a4584d9"— SVC-787 AGENT_ALWAYS_RUN | AGENT_WALKINGindicates that the user requested to run using standard viewer controls. UsellGetAnimationto also detect running caused by physics.- This function does not return reliable information immediately after a border crossing. Use
llGetAnimationinstead, if you can. — SVC-3177 AGENT_AUTOMATEDmay unexpectedly be enabled, see its caveats for more detail.
Examples
Section titled “Examples”Example 1
default{ touch_start(integer buf) { buf = llGetAgentInfo(llDetectedKey(0)); string out; if(buf & AGENT_FLYING)21 collapsed lines
out += "The agent is flying.\n"; else out += "The agent is not flying.\n";
if(buf & AGENT_ATTACHMENTS) { if(buf & AGENT_SCRIPTED) out += "The agent has scripted attachments.\n"; else out += "The agent's attachments are unscripted.\n"; } else out += "The agent does not have attachments.\n";
if(buf & AGENT_MOUSELOOK) out += "the agent is in mouselook."; else out += "the agent is in normal camera mode."; llWhisper(0, out); }}This is not a good way of testing if an avatar is in the region, use llGetAgentSize instead.
History
Section titled “History”Added in SL 0.4.0 along with these flags AGENT_FLYING, AGENT_ATTACHMENTS, & AGENT_SCRIPTED.
AGENT_AUTOPILOTwas added in SVN:2900 r136439 Trunk
Known issues
Section titled “Known issues”From the issue templates included by the wiki article:
- SVC-91 (nf): agent_info() event
- SVC-3177 (bug): llGetAgentInfo() returns unreliable info after a sim border crossing
See also
Section titled “See also”Functions
Section titled “Functions”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.
Footnotes
Section titled “Footnotes”-
“Sit down” on the avatar context menu allows ground sits anywhere: atop the terrain, on objects or even in the air, so it is possible to sit “on” an object without linking. ↩