Difference between revisions of "LlStopAnimation"

From Second Life Wiki
Jump to: navigation, search
m (Replaced old <LSL> block with <source lang="lsl2">)
 
(15 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{LSL_Function/permission|PERMISSION_TRIGGER_ANIMATION}}{{LSL_Function/inventory|anim|uuid=true|type=animation}}{{LSL_Function
+
{{LSL_Function
 +
|inject-2={{Issues/SVC-3860}}{{LSL_Function/permission|PERMISSION_TRIGGER_ANIMATION}}{{LSL_Function/inventory|anim|uuid=true|type=animation}}
 
|func_id=130|func_sleep=0.0|func_energy=10.0
 
|func_id=130|func_sleep=0.0|func_energy=10.0
 
|func=llStopAnimation|sort=StopAnimation
 
|func=llStopAnimation|sort=StopAnimation
|p1_type=string|p1_name=anim
+
|p1_type=string|p1_name=anim|p1_desc=&#32;or [[Internal_Animations|built in animation]] name
 
|func_footnote
 
|func_footnote
|func_desc=Stop animation '''anim''' for agent that granted [[PERMISSION_TRIGGER_ANIMATION]] if the permission has not been revoked.
+
|func_desc=Stop animation {{LSLP|anim}} for agent that granted [[PERMISSION_TRIGGER_ANIMATION]] if the permission has not been revoked.
 
|return_text
 
|return_text
 
|spec
 
|spec
|caveats
+
|caveats=
 +
* If the animation to be stopped is the only playing animation (as found via [[llGetAnimationList]]), it will continue to play to its end (if looped it will continue indefinitely)
 +
** if you must stop a looped animation, playing a single frame non-looped one immediately after stopping it, at low priority, will clear the list.
 
|constants
 
|constants
|examples
+
|notes=
 +
<source lang="lsl2">
 +
llStopAnimation(llGetAnimationOverride("Sitting"))
 +
</source>
 +
|examples=
 +
<source lang="lsl2">
 +
default
 +
{
 +
    touch_start(integer detected)
 +
    {
 +
        llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
 +
    }
 +
    run_time_permissions(integer perm)
 +
    {
 +
        if (perm & PERMISSION_TRIGGER_ANIMATION)
 +
        {
 +
            llStartAnimation("sit");
 +
            llOwnerSay("animation will end in 5 seconds");
 +
            llSetTimerEvent(5.0);
 +
        }
 +
    }
 +
    timer()
 +
    {
 +
        llSetTimerEvent(0.0);
 +
        llStopAnimation("sit");
 +
    }
 +
}
 +
</source>
 
|helpers
 
|helpers
|also_functions
+
|also_functions={{LSL DefineRow||[[llGetAnimationList]]|Gets a list of playing animations}}
 +
{{LSL DefineRow||[[llStartAnimation]]|Starts playing an animation}}
 
|also_tests
 
|also_tests
 
|also_events
 
|also_events
 
|also_articles
 
|also_articles
|notes
 
|inventory
 
|negative_index
 
 
|cat1=Animation
 
|cat1=Animation
|cat2
+
|cat2=Stop
 
|cat3
 
|cat3
 
|cat4
 
|cat4
 
}}
 
}}

Latest revision as of 11:44, 22 January 2015

Summary

Function: llStopAnimation( string anim );

Stop animation anim for agent that granted PERMISSION_TRIGGER_ANIMATION if the permission has not been revoked.

• string anim an animation in the inventory of the prim this script is in or a UUID of an animation or built in animation name

To run this function the script must request the PERMISSION_TRIGGER_ANIMATION permission with llRequestPermissions.

Caveats

Permissions
  • If anim is missing from the prim's inventory and it is not a UUID or it is not an animation then an error is shouted on DEBUG_CHANNEL.
  • If anim is a UUID then there are no new asset permissions consequences for the object.
    • The resulting object develops no new usage restrictions that might have occurred if the asset had been placed in the prims inventory.
  • If the animation to be stopped is the only playing animation (as found via llGetAnimationList), it will continue to play to its end (if looped it will continue indefinitely)
    • if you must stop a looped animation, playing a single frame non-looped one immediately after stopping it, at low priority, will clear the list.

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   llStopAnimation("prejump") freezes avatar

Examples

default
{
    touch_start(integer detected)
    {
        llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
    }
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
            llStartAnimation("sit");
            llOwnerSay("animation will end in 5 seconds");
            llSetTimerEvent(5.0);
        }
    }
    timer()
    {
        llSetTimerEvent(0.0);
        llStopAnimation("sit");
    }
}

Notes

llStopAnimation(llGetAnimationOverride("Sitting"))

See Also

Events

•  run_time_permissions Permission receiving event

Functions

•  llGetPermissions Get the permissions granted
•  llGetPermissionsKey Get the agent who granted permissions
•  llRequestPermissions Request permissions
•  llGetAnimationList Gets a list of playing animations
•  llStartAnimation Starts playing an animation

Articles

•  Script permissions

Deep Notes

All Issues

~ Search JIRA for related Issues
   llStopAnimation("prejump") freezes avatar

Signature

function void llStopAnimation( string anim );