AGENT WALKING
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Description
Constant: integer AGENT_WALKING = 0x0080;The integer constant AGENT_WALKING has the value 0x0080
Caveats
Related Articles
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. <lsl> // 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;
}
} </lsl>