string llGetAnimation(key id)

Returns the current basic animation state for avatar id.  The basic animation states are the simplest description of the avatar’s posture.

Here’s a list of basic animations states returned by this function:

  • Crouching
  • Hovering
  • Hovering Down
  • Hovering Up
  • Jumping
  • PreJumping
  • Running
  • Sitting – This is returned even when the avatar is sitting on something that stopped the generic sit animation and plays its own instead.
  • Sitting on Ground
  • Standing
  • Striding
  • Flying
  • FlyingSlow
  • Falling Down
  • Standing Up – After falling a long distance, the Landing animation state is skipped and the Standing Up state is used. -EyanaYohkoh
  • Landing
  • Soft Landing
  • CrouchWalking
  • Turning Left
  • Turning Right
  • Walking

Note: This function does not return the specific animations currently played with llStartAnimation. See llGetAnimationList.

Example:

// make a list of all animations states
list l;

default {
    state_entry() {
        llSetTimerEvent(0.25); // poll current state (there is no event for these)
    }

    timer() {
        string s;
        
        s = llGetAnimation(llGetOwner()); // get the current animation state
        llSetText(s, <1, 1, 1>, 1.0); // display it as floating text
        if (llListFindList(l, [s]) == -1) l += [s]; // if it's not already in the list, add it
    }
    
    touch_start(integer num) {
        if (llDetectedKey(0) != llGetOwner()) return; // ignore everyone but the owner
        
        llInstantMessage(llGetOwner(), llList2CSV(l)); // IM the list to the owner
    }
}

This function may seem slow in updating animation states. For example, in things like animation overrides, waiting until llGetAnimation returns “Standing” can cause the walk animation to continue for a moment after the avatar has stopped. If this affects you, try checking llGetVel instead, to see if you have stopped moving. –DirtyMcLean