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

LSL Wiki : llGetAnimationList

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawling22.us.archive.org
list llGetAnimationList(key id)

Returns a list of keys of all playing animations for avatar id.

llStopAnimation or llStartAnimation may be useful here.

Example:
// stops all currently running animations when clicked
default {
    touch_start(integer num_detected) {
        llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
    }

    run_time_permissions(integer perm) {
        if(perm & PERMISSION_TRIGGER_ANIMATION)
        {
            list anims = llGetAnimationList(llGetPermissionsKey());        // get list of animations
            integer len = llGetListLength(anims);
            integer i;
            
            llSay(0, "Stopping " + (string)len + llGetSubString(" animations",0,-1 - (len == 1)));//strip the "s" when there is only 1 to stop.
            for (i = 0; i < len; ++i) llStopAnimation(llList2Key(anims, i));
            llSay(0, "Done");
        }
    }
}

Another Example:
// gets the key of an animation as it starts it
// -sendao
key startAnim_FindKey( key who, string animname )
{
    if( llGetPermissions() & PERMISSION_TRIGGER_ANIMATION ) {

        list prelist = llGetAnimationList( who );
        llStartAnimation(animname);
        list postlist = llGetAnimationList( who );
        
        integer i;
        integer len = llGetListLength(prelist);
        
        prelist = llListSort( prelist, 1, 1 );
        postlist = llListSort( postlist, 1, 1 );
        
        for( i = 0; i < len; i++ ) {
            if( llList2Key( prelist, i ) != llList2Key( postlist, i ) )         return llList2Key(postlist, i);
        }
        if( i <= llGetListLength(postlist) )          return llList2Key( postlist, i );
    }
    return NULL_KEY;
}


Functions | Agent/Avatar | Animation
Comments [Hide comments/form]
Those keys don't seem to resolve to names with llGetAnimation(). How do I print each animation name?
-- PetreLamar (2006-07-31 14:11:25)
You could keep a list of animation names & keys.
Generaly speaking, the names aren't useful; names don't have to be descriptive of what the animation is and animations can share the same names.
-- BlindWanderer (2006-10-02 02:34:34)
Attach a comment to this page: