Jump to content

How To: Activate animation inside an avatar attachment ?


Ryker Silvercloud
 Share

You are about to reply to a thread that has been inactive for 1631 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello

Could anyone explain how an animation inside an avatar attachment is being activated when you attach the object ?

Say, you have a basket and one "apple picking" animation. I attach the basket to my L forearm and while playing the
animation from inside my inventory I adjust the basket so it fits. 
Then I detach and put the animation inside the basket and attach the basket. Obviously, this doesn`t do it alone.

I presume you need a script that will trigger the animation, but what kind of script and what is available ?

Thank you

PS I am familiar with AVsitter and how to add props in furniture, but in the case I want to start the animation without seating.

Link to comment
Share on other sites

Create a new script and replace all of its contents with this, and put the script into the object you want to play an animation.

If you do it while the object is already attached, you will get an error the first time you detach the object, but never again after that.

// Write the name of the animation within the quotes.
string animation = "Animation name is CaSe sEnSiTivE";

default
{
    // This code happens every time the object is attached or detached.
    attach(key id)
    {
        // Check whether the object is currently attached to something
        // ("id" will have a value when attached.)
        if (id)
        {
            // If attached, request permission to animate.
            llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
        }
        else
        {
            // Otherwise, stop the animation. This will work as long as
            // the object was attached after the script started.
            llStopAnimation(animation);
        }
    }

    // This code happens every time an avatar grants or denies permissions.
    // Animation permission is always granted to attachments automatically.
    run_time_permissions(integer granted)
    {
        llStartAnimation(animation);
    }
}

 

Edited by Wulfie Reanimator
Link to comment
Share on other sites

1 hour ago, Wulfie Reanimator said:

Create a new script and replace all of its contents with this, and put the script into the object you want to play an animation.

If you do it while the object is already attached, you will get an error the first time you detach the object, but never again after that.


// Write the name of the animation within the quotes.
string animation = "Animation name is CaSe sEnSiTivE";

default
{
    // This code happens every time the object is attached or detached.
    attach(key id)
    {
        // Check whether the object is currently attached to something
        // ("id" will have a value when attached.)
        if (id)
        {
            // If attached, request permission to animate.
            llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
        }
        else
        {
            // Otherwise, stop the animation. This will work as long as
            // the object was attached after the script started.
            llStopAnimation(animation);
        }
    }

    // This code happens every time an avatar grants or denies permissions.
    // Animation permission is always granted to attachments automatically.
    run_time_permissions(integer granted)
    {
        llStartAnimation(animation);
    }
}

 

Thank you, Wulfie. It is perfect. Well, at first nothing happened and I tried over and again, then I noticed the two boxes at the bottom that says RUNNING and MONO and I figured I should check RUNNING and that`s all ! :)  Thank you again

Link to comment
Share on other sites

1 hour ago, Wulfie Reanimator said:

Create a new script and replace all of its contents with this, and put the script into the object you want to play an animation.

If you do it while the object is already attached, you will get an error the first time you detach the object, but never again after that.


// Write the name of the animation within the quotes.
string animation = "Animation name is CaSe sEnSiTivE";

default
{
    // This code happens every time the object is attached or detached.
    attach(key id)
    {
        // Check whether the object is currently attached to something
        // ("id" will have a value when attached.)
        if (id)
        {
            // If attached, request permission to animate.
            llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
        }
        else
        {
            // Otherwise, stop the animation. This will work as long as
            // the object was attached after the script started.
            llStopAnimation(animation);
        }
    }

    // This code happens every time an avatar grants or denies permissions.
    // Animation permission is always granted to attachments automatically.
    run_time_permissions(integer granted)
    {
        llStartAnimation(animation);
    }
}

 

 

1 hour ago, Love Zhaoying said:

A script which calls the LSL animation functions. 

Thank you, Love, for your quick replay :)

 

Link to comment
Share on other sites

37 minutes ago, Ryker Silvercloud said:

Thank you, Wulfie. It is perfect. Well, at first nothing happened and I tried over and again, then I noticed the two boxes at the bottom that says RUNNING and MONO and I figured I should check RUNNING and that`s all ! :)  Thank you again

It's a good idea to always check "MONO", too.

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1631 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...