LlStartAnimation

From Second Life Wiki

Jump to: navigation, search

Template:Needs Translation/LSL/de Template:Needs Translation/LSL/es Template:Needs Translation/LSL/el Template:Needs Translation/LSL/he Template:Needs Translation/LSL/it Template:Needs Translation/LSL/ko Template:Needs Translation/LSL/nl Template:Needs Translation/LSL/hu Template:Needs Translation/LSL/no Template:Needs Translation/LSL/da Template:Needs Translation/LSL/sv Template:Needs Translation/LSL/tr Template:Needs Translation/LSL/pl Template:Needs Translation/LSL/pt Template:Needs Translation/LSL/ru Template:Needs Translation/LSL/uk Template:Needs Translation/LSL/zh-Hans Template:Needs Translation/LSL/zh-Hant

Contents

Summary

Function: llStartAnimation( string anim );
129 Function ID
0.0 Delay
10.0 Energy

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

• string anim an item in the prim's inventory

Requires the PERMISSION_TRIGGER_ANIMATION permission to run.

Caveats

  • Do not depend upon the auto-grant status of permissions. Always use the run_time_permissions event.
  • If the script lacks the permission PERMISSION_TRIGGER_ANIMATION, the script will shout an error on DEBUG_CHANNEL and the operation fails (but the script continues to run).
  • Once the PERMISSION_TRIGGER_ANIMATION permission is granted there is no way to revoke it except from inside the script (for example, with a new llRequestPermissions call). Otherwise, the script will only lose the permission if it is reset or the object is derezzed (deleted, detached, or taken).
  • If anim is missing from the prim's inventory then an error is shouted on DEBUG_CHANNEL.
  • Prior to 1.25.3 of the server code, an essentially unlimited number of animations could be played at once. In 1.25.3, a limit of 15 simultaneous animations was imposed; in 1.25.4, that limit was (will be) raised to 30.

Search JIRA for related Bugs

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");
    }
}
 

Add an animation or pose inside the same object as this script:

 
string animation; // the first animation in inventory will automatically be used
  // the animation name must be stored globally to be able to stop the animation when standing up
 
default
{
    state_entry()
    {
        // set sit target, otherwise this will not work 
        llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
    }
 
    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            key av = llAvatarOnSitTarget();
            if (av) //evaluated as true if not NULL_KEY or invalid
                llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
            else // avatar is standing up
            {
                if (animation)
                    llStopAnimation(animation); // stop the started animation
                llResetScript(); // release the avatar animation permissions
            }
        }
    }
 
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
            animation = llGetInventoryName(INVENTORY_ANIMATION,0); // get the first animation from inventory
            if (animation)
            {
                llStopAnimation("sit"); // stop the default sit animation
                llStartAnimation(animation);
            }
        }
    }
}
 

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
•  llStopAnimation

Articles

•  Script permissions
•  Internal_Animations lists internal Animations always available

Deep Notes

This article wasn't helpful for you? Maybe the related article at the LSL Wiki is able to bring enlightenment.
Personal tools
In other languages