AGENT WALKING

From Second Life Wiki

Jump to: navigation, search

Contents

Description

Constant: integer AGENT_WALKING = 0x0080;

The integer constant AGENT_WALKING has the value 0x0080

Used with llGetAgentInfo to determine if the queried avatar is walking.

Related Articles

Constants

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

Functions

•  llGetAgentInfo

Examples

Cause a sound to be played while the wearer of the hud or attachment is walking. Place this script in a Hud for the owner only to hear the sound, or in an attachment for others to hear your footsteps too. You'll need a sound file in the object too, with your choice of footstep sounds.

// Play a sound whenever the owner is walking
integer   gWasWalking;             // TRUE when wearer is already walking
string    gSound = "footsteps";    // name of soundfile in inventory
default
{
    state_entry()
    {
        // Start a timer to continuously check if the owner is walking
        llSetTimerEvent(0.25);
    }
    timer()
    {
        integer NowWalking = llGetAgentInfo(llGetOwner()) & AGENT_WALKING;
        if  (NowWalking != gWasWalking)        // walking has stopped or started
        {
            llStopSound();
            if (NowWalking)      llLoopSound(gSound, 1.0);
        }
        gWasWalking = NowWalking;
    }
}

Deep Notes

Search JIRA for related Issues

Footnotes

  1. ^ "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.
Personal tools
In other languages