Difference between revisions of "LlGetAnimationList"

From Second Life Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{LSL Function/avatar|id|sim=*}}{{LSL_Function
{{LSL_Function
|inject-2={{LSL Function/avatar|avatar|sim=*}}{{Issues/BUG-1731}}
|func_id=266|func_sleep=0.0|func_energy=10.0
|func_id=266|func_sleep=0.0|func_energy=10.0
|func=llGetAnimationList|return_type=list|p1_type=key|p1_name=id
|func=llGetAnimationList|return_type=list|p1_type=key|p1_name=avatar
|func_footnote
|func_footnote
|func_desc
|func_desc
|return_text=of all playing animations for avatar '''id''' by key.
|return_text=of keys of playing animations for {{LSLP|avatar}}.
|spec
|spec
|caveats=*There is no internal mechanism to get the name of the animations playing.
|caveats=*There is no internal mechanism to get the name of the animations playing.
*Standard animations can be started and stopped by scripts, so the list returned may not accurately reflect the avatar's state. Use [[llGetAgentInfo]] and [[llGetAnimation]] when this matters.
*[[Internal_Animations#Viewer-generated_motions|Some motions are local to the viewer]] and cannot be detected by scripts.
*[[Internal_Animations#User-playable_animations|Animations that are triggered by other animations are local to the viewer]] and cannot be detected by scripts.
|constants
|constants
|examples=
|examples=
<lsl>// Zand's Keybord Script
This example is a bit involved but there aren't many applications for this function.
// by Zand Gundersen
<source lang="lsl2">//Simple Animation Override for Walk
// Makes Object only appear while typing.
key old_anim = "6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0";
//
string new_anim="yoga_float";
// THIS SCRIPT IS PUBLIC DOMAIN! Do not delete the credits at the top of this script!
integer status;
// Feel free to copy, modify, and use this script.
list check;
 
key owner;
list anims;
key ANIM_TYPE="c541c47f-e0c0-058b-ad1a-d6ae3a4584d9";


default
default
Line 23: Line 25:
     state_entry()
     state_entry()
     {
     {
         llSetTimerEvent(.2);
         owner = llGetOwner();
        llRequestPermissions(owner, PERMISSION_TRIGGER_ANIMATION);
        check = [old_anim];
     }
     }
      
      
    run_time_permissions(integer p)
    {
        if(p & PERMISSION_TRIGGER_ANIMATION)
        {
            llSetTimerEvent(0.2);
        }
    }
     timer()
     timer()
     {
     {
        anims = llGetAnimationList(llGetOwner());
         if(llGetAgentInfo(owner) & AGENT_WALKING)
         if(~llListFindList(anims,[ANIM_TYPE]))
         {
         {
             llSetLinkAlpha(LINK_SET,1.0,ALL_SIDES);          
             list anims = llGetAnimationList(owner);
            if(~llListFindList(anims, check))
            {
                status = 1;
                llStartAnimation(new_anim);
                llStopAnimation(old_anim);
            }
         }
         }
         else
         else if(status)
         {
         {
             llSetLinkAlpha(LINK_SET,0.0,ALL_SIDES);
             llStopAnimation(new_anim);
            status = 0;
         }
         }
     }
     }
}</lsl>
 
    on_rez(integer p)
    {
        llResetScript();
    }
}</source>
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llGetAgentInfo]]|Gets the avatar info}}
|also_functions={{LSL DefineRow||[[llGetAgentInfo]]|Gets the avatar info}}
{{LSL DefineRow||[[llGetAnimation]]|Get an over simplified avatar info string}}
{{LSL DefineRow||[[llGetAnimation]]|Get the avatar's base animation state}}
{{LSL DefineRow||[[llStartAnimation]]|Start an animation on an avatar}}
{{LSL DefineRow||[[llStartAnimation]]|Start an animation on an avatar}}
{{LSL DefineRow||[[llStopAnimation]]|Stop an animation playing on an avatar}}
{{LSL DefineRow||[[llStopAnimation]]|Stop an animation playing on an avatar}}

Latest revision as of 05:21, 11 November 2016

Summary

Function: list llGetAnimationList( key avatar );

Returns a list of keys of playing animations for avatar.

• key avatar avatar UUID that is in the same region

Caveats

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   llGetAnimationList sometimes returns a NULL_KEY

Examples

This example is a bit involved but there aren't many applications for this function.

//Simple Animation Override for Walk
key old_anim = "6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0";
string new_anim="yoga_float";
integer status;
list check;
key owner;

default
{
    state_entry()
    {
        owner = llGetOwner();
        llRequestPermissions(owner, PERMISSION_TRIGGER_ANIMATION);
        check = [old_anim];
    }
    
    run_time_permissions(integer p)
    {
        if(p & PERMISSION_TRIGGER_ANIMATION)
        {
            llSetTimerEvent(0.2);
        }
    }

    timer()
    {
        if(llGetAgentInfo(owner) & AGENT_WALKING)
        {
            list anims = llGetAnimationList(owner);
            if(~llListFindList(anims, check))
            {
                status = 1;
                llStartAnimation(new_anim);
                llStopAnimation(old_anim);
            }
        }
        else if(status)
        {
            llStopAnimation(new_anim);
            status = 0;
        }
    }

    on_rez(integer p)
    {
        llResetScript();
    }
}

See Also

Functions

•  llGetAgentInfo Gets the avatar info
•  llGetAnimation Get the avatar's base animation state
•  llStartAnimation Start an animation on an avatar
•  llStopAnimation Stop an animation playing on an avatar

Deep Notes

All Issues

~ Search JIRA for related Issues
   llGetAnimationList sometimes returns a NULL_KEY

Signature

function list llGetAnimationList( key avatar );