Skip to content
lsl.devlsl.devLSL Dev

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...
40960x1000has running ("Always Run") enabled, or is using tap-tap-hold
20x0002has attachments
163840x4000is marked as a scripted agent/bot
81920x2000is in "autopilot" mode
640x0040is in "away" mode
20480x0800is in "busy" mode
10240x0400is crouching
327680x8000is floating or hovering because of a scripted attachment
10x0001is flying or hovering
2560x0100is in the air (jumping, flying or falling)
80x0008is in mouselook
320x0020is sitting on an object (and linked to it)
40x0004has scripted attachments
160x0010is 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.
5120x0200is typing
1280x0080is walking, running or crouch walking

Caveats

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

Added in SL 0.4.0 along with these flags AGENT_FLYING, AGENT_ATTACHMENTS, & AGENT_SCRIPTED.

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.

Template:Issues/SVC-91

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-91|'''agent_info'''() event|type=nf}}

Template:Issues/SVC-3177

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-3177|[[llGetAgentInfo]]() returns unreliable info after a sim border crossing|type=bug}}

Template:LSL Function/avatar

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.