Don't click here unless you want to be banned.

LSL Wiki : llGetAgentInfo

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
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:

// when touched, check if the agent is flying and say so.
    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.");
                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.

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Agent/Avatar
Comments [Hide comments/form]
Sorted flags alphabetically.
-- CrossLament (2006-05-06 12:40:31)
How would you say not flying? llGetAgentInfo(llGetOwner()) & !AGENT_FLYING) ??
-- (2007-04-06 18:24:50)
couldn't you find the object they aresitting on by sending a object totheir bounding box position and scanning for the nearest ACTIVE | PASSIVE
-- Jcool410 Wildcat
-- (2007-04-20 15:58:13)
"How would you say not flying? llGetAgentInfo(llGetOwner()) & !AGENT_FLYING) ??"

Actually its

llGetAgentInfo(llGetOwner()) ^ AGENT_FLYING)
-- KokiriSaarinen (2007-05-05 04:54:07)
From what I've found, this function only returns meaningful values (or anything, really) if your own object calls it while it's on your own land. Basically, if you own the object and own the land, it will work. Otherwise, I haven't seen it work properly (or at all). - HawksterWestmoreland

Evidently you've found wrong O_o
-- (2007-08-23 10:22:01)
how would i make it so the script runs a function as soon as the owner enters a state e.g mouselook?
-- (2007-10-27 12:15:19)
"Actually its

(llGetAgentInfo(llGetOwner()) ^ AGENT_FLYING)"

[corrected parens]

Is ^ XOR? If so, doesn't work if llGetAgentInfo() returns something along with AGENT_FLYING, such as AGENT_SCRIPTED. If AGENT_SCRIPED and not AGENT_FLYING is true, than that line will return true. What you want is:
(~llGetAgentInfo(llGetOwner()) & AGENT_FLYING)
-- (2007-12-12 10:09:37)
Attach a comment to this page: