integer llGetAgentInfo(key id) 

Returns a bitfield of id agent information:

Constant Represents Value
AGENT_FLYING Returned if agent is flying. 0x0001
AGENT_ATTACHMENTS Returned if agent has attachments. 0x0002
AGENT_SCRIPTED Returned if agent has scripted attachments. 0x0004
AGENT_MOUSELOOK Returned if agent is in mouselook. 0x0008
AGENT_SITTING Returned if agent is sitting. 0x0010
AGENT_ON_OBJECT Returned if agent is sitting on an object. 0x0020
AGENT_AWAY Returned if agent is in “away” mode. 0x0040
AGENT_WALKING Returned if agent is walking. 0x0080
AGENT_IN_AIR Returned if agent is in the air (hovering). 0x0100
AGENT_TYPING Returned if agent is typing. 0x0200
AGENT_CROUCHING Returned if agent is crouching. 0x0400
AGENT_BUSY Returned if agent is in “busy” mode. 0x0800
AGENT_ALWAYS_RUN Returned if agent has running (“Always Run”) enabled, or is using tap-tap-hold 0x1000
AGENT_AUTOPILOT Returned if agent is in “autopilot” mode 0x2000

Notes on the above:

  • Agents are IN_AIR and not FLYING when they are jumping, falling or kept away from the ground by means of a script.
  • Agents can have ATTACHMENTS that are not SCRIPTED
  • Agents can be SITTING on the ground, which means they are not sitting ON_OBJECT. (When sitting on an object, they are both SITTING and ON_OBJECT.)
  • The agent defined by id must be in the same simulator as the script calling this function.

Example:

// when touched, check if the agent is flying and say so.
default
{
    touch_start(integer total_number)
    {
        // we use a FOR loop here because two people can click the object at the same time.
        integer i;
        for (i = 0; i < total_number; i++)
        {
            // llGetAgentInfo returns a bitfield. Use & instead of == for comparisons.
            if (llGetAgentInfo(llDetectedKey(i)) & AGENT_FLYING) 
            {
                llSay(0, llDetectedName(i) + ", you're flying.");
            }
            
            else
            {
                llSay(0, llDetectedName(i) + ", you're not flying.");
            }
        }
    }
}

 

Also compare with llRequestAgentData.

Q: I can’t find ‘Always Run’ in the client, and it seems to be off. Is this deprecated?
A: It’s in the World menu. It also has a hotkey, ctrl + r.

Q: Is there a way to find out additional information about attachments found with AGENT_ATTACHMENTS or AGENT_SCRIPTED?
A: No. There’s no way to determine how many attachments an avatar has, nor where they’re attached, or what they are.

 
Q: Is there a way to find the key of the object the agent is sitting on?
A: No.
 
Q: How long does it take for the agent to enter AFK mode from the last time they did anything?
A: 10 minutes. The agent can still be acted upon by scripts and objects within SL, but if there’s no mouse or keyboard input, they’ll go AFK after 10 minutes.
 
Q: What is crouching? How does an avatar crouch?
A: By pressing the DOWN Button when not flying.