LlGetAgentInfo
Looking for the current API? Open the llGetAgentInfo reference →
Return value notes
Returns an integer containing the agent information about
id.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 sitting"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. |
| 512 | 0x0200 | is typing |
| 128 | 0x0080 | is walking, running or crouch walking |
Caveats
- AGENT_BUSY indicates that the "busy" internal animation is playing, even if the user is not truly in busy mode.
- On server 1.40 and below, AGENT_TYPING indicated 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, use llGetAnimationList and look for
"c541c47f-e0c0-058b-ad1a-d6ae3a4584d9"— SVC-787 AGENT_ALWAYS_RUN | AGENT_WALKINGindicates that the user requested to run using standard viewer controls. Use llGetAnimation to also detect running caused by physics.- This function does not return reliable information immediately after a border crossing. Use llGetAnimation instead, if you can. — SVC-3177
- AGENT_AUTOMATED may unexpectedly be enabled, see its caveats for more detail.
Examples
default
{
touch_start(integer buf)
{
buf = llGetAgentInfo(llDetectedKey(0));
string out;
if(buf & AGENT_FLYING)
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);
}
}Notes
This is not a good way of testing if an avatar is in the region, use llGetAgentSize instead.
See also: functions
Tests
History
- AGENT_AUTOPILOT was added in SVN:2900 r136439 Trunk
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.
Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-91|'''agent_info'''() event|type=nf}}Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-3177|[[llGetAgentInfo]]() returns unreliable info after a sim border crossing|type=bug}}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>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.