LSL Wiki Mirror 10-5-2006: llGetAgentInfo

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
integer llGetAgentInfo(key id)

Returns a bitfield of id agent information:

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

Notes on the above:

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.


Functions | Agent/Avatar
There is one comment on this page. [Display comments/form]