Skip to content
lsl.devlsl.devLSL Dev

LlGetAnimation

Looking for the current API? Open the llGetAnimation reference →

Function notes

llGetAgentInfo provides information on some animation states not covered by this function (typing, away, busy). llGetAnimationList provides more detailed information about the running animations, but may not reflect avatar state as accurately as llGetAnimation.

Return value notes

Returns a string that is the name of the currently playing locomotion animation for avatar id. See the table below.

Specification

Complete list of return values as of August 15, 2011.With the successful conclusion of SCR-26, a complete list of values was posted; however no indication was given as to which of the previously undocumented codes are active but just uncommon.
Overridable values
ValueTypeDescriptionDefault
"Crouching"Statecrouch
"CrouchWalking"Statecrouchwalk
"Falling Down"Statefalldown
"Flying"Statefly
"FlyingSlow"StateTransition between hovering and forward flight.flyslow
"Hovering"Statehover
"Hovering Down"Statehover_down
"Hovering Up"Statehover_up
"Jumping"StateWhile still in the air during a jump.jump
"Landing"TransitionWhen landing from a jump.land
"PreJumping"TransitionAt the beginning of a jump.prejump
"Running"Staterun
"Sitting"StateSitting on an object (and linked to it).sit
"Sitting on Ground"StateSitting, but not linked to an object."Sit down" on the avatar context menu allows ground sits anywhere: atop the terrain, objects or even in the air.sit_ground_constrained
"Standing"Statestand
"Standing Up"TransitionAfter falling a great distance. Sometimes referred to as Hard Landing.standup
"Striding"StateWhen the avatar is stuck on the edge of an object or on top of another avatar.stride
"Soft Landing"TransitionAfter falling a small distance.soft_land
"Taking Off"Statehover_up
"Turning Left"Stateturnleft
"Turning Right"Stateturnright
"Walking"Statewalk
Other Common/Active values
ValueDescription
""During logout
"Init"At login and after teleports.
Uncommon/Inactive return values
ValueDescription
"Crouch"
"Epsilon"
"Fall Down Land"
"Finish Animation"
"Fly"
"FlySlow"
"Hard Land"
"Hover Down"
"Hover Up"
"Hover"
"Medium Land"
"PreFlying"
"PreJump"
"Prep For Teleport"
"Run"
"Sit on Ground"
"Sit"
"Soft Land"
"Stand"
"Stride"
"Take Off"
"Turn Done"
"Turn Left"
"Turn Right"
"Uncrouch"
"Walk"

Caveats

  • This function can return an empty string while the avatar is logging out.
  • New return values could conceivably be added at any time and this list may not in-fact be complete. Scripts should be written under the assumption that they may receive a value they won't recognize.

Examples

// A simple animation override example.
// Make the avatar run in mid-air when jumping.

key gOwner; // the wearer's key
string gLastAnimation; // last llGetAnimation value seen

// User functions

Initialize(key id) {
    if (id == NULL_KEY) { // detaching
        llSetTimerEvent(0.0); // stop the timer
    }
    else { // attached, or reset while worn
        llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
        gOwner = id;
    }
}


// Event handlers

default
{
    state_entry() {
        // in case the script was reset while already attached
        if (llGetAttached() != 0) {
            Initialize(llGetOwner());
        }
    }

    attach(key id) {
        Initialize(id);
    }

    run_time_permissions(integer perm) {
        if (perm & PERMISSION_TRIGGER_ANIMATION) {
            llSetTimerEvent(0.25); // start polling
        }
    }

    timer() {
        string newAnimation = llGetAnimation(gOwner);

        if (gLastAnimation != newAnimation) { // any change?
            if (newAnimation == "Jumping") {
                
                // You can stop the built-in animation if you like, if
                // it might interfere with your own. Be aware that an
                // avatar can become stuck, and some llGetAgentInfo results
                // can be inaccurate, if you stop built-ins indiscriminately.
                // Always test.
                //
                // llStopAnimation("jump");
    
                llStartAnimation("run");
            }
            else if (gLastAnimation == "Jumping")  { // just finished jumping
                // "run" is looped, so we have to stop it when we are done.
                llStopAnimation("run");
            }
            
            gLastAnimation = newAnimation; // store away for  next time
        }
    }
}

See also: functions

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:LSL Function/avatar

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<noinclude>{{Multi-lang|category=LSL}}</noinclude>{{#if:

{{#vardefine:p_{{{1|none}}}_desc|avatar {{#if:{{{group|}}}|or group}} {{HoverLink|UUID|Universally Unique Identifier}} {{#if:{{{sim|}}}{{{region|}}}|that is in the same [[region]] {{#ifeq:{{{sim|}}}{{{region|}}}|known|or is otherwise known to the region{{Footnote|handle=known}}}}}}}}

{{#vardefine:p_{{{1|none}}}_hover|avatar {{#if:{{{group|}}}|or group}} UUID {{#if:{{{sim|}}}{{{region|}}}|that is in the same region {{#ifeq:{{{sim|}}}{{{region|}}}|known|or is otherwise known to the region}}}}}}

<includeonly>
{{#if:{{{nc|}}}||{{#vardefine:hidden-text|{{#var:hidden-text}}
{{#if:{{#pos:{{#var:moded}}|r}}{{#pos:{{#var:moded}}|u}}||{{LSLC|Avatar/As A Parameter||{{#var:lang}}}}}}
}}}}
</includeonly>

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none}}}_hover}}
|}
</noinclude>
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.