Jump to content

Stopping a looped animation immediately


Sasun Steinbeck
 Share

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

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

Recommended Posts

I am trying to stop a looped animation immediately. Sample code below. From what I read the trick is this:

"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."

I'm testing with the only full perm looped animation I have, the ever popular "Chicken Dance (looped)" animation. The trick above is just not working, or, the "single frame non-looped" animations I'm trying are not the right kind. I was hoping that llStartAnimation("stand") or one of the built-in anims would immediately stop the dance loop, but nothing will stop it, for me or anyone else.

Drop the script in a prim and click to start, again to (in theory) stop. What am I doing wrong?

I have some other freebie single frame looped animations, and when I start one of those, chicken dance immediately stops and the new one starts. However if I try triggering then stopping that one (in place of "stand") then chicken dance resumes and finishes the current loop, then stops.

Does anyone have this magical single frame non-looped animation I can have? I was really hoping one of the system anims would do the job since there is a big problem including any additional animation in the inventory of the product I'm building. I'd be glad to send you a test prim with this dance installed so you can fiddle with it.

 

string curAnimation;

getPerms(key id)
{
    if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
    {
        llStartAnimation(curAnimation);
    }
    else
        llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
}


default
{
    run_time_permissions(integer perm) 
    {
        if (PERMISSION_TRIGGER_ANIMATION & perm)
        {
            llStartAnimation(curAnimation);
        }
    }

    touch_start(integer total_number)
    {
        if (curAnimation != "")
        {
            llOwnerSay("stopping: " + curAnimation);
            llStopAnimation(curAnimation);
            llStartAnimation("stand");
            curAnimation = "";
            return;
        }
        curAnimation = "Chicken Dance (looped)";
        getPerms(llDetectedKey(0));
    }
}

 

Link to comment
Share on other sites

I've never known the list to be cleared by playing another animation. What you will see is that playing another animation of the same priority will play above the previous one but if you stop it, the previous animation will be shown again.

 

However, if you want to experiment and need some single frame animations of various priorities, pop me an IM. No trouble to make some up.

Link to comment
Share on other sites

FWIW, you can download .bvh files of all the built-in animations, then re-upload them however you want. See this wiki page for the link. As you see there, avatar_stand.bvh is set to loop in the built-in animation "stand", but if you look at the .bvh, it is in fact a single frame, so can be re-uploaded unlooped, for L$10.

Unfortunately, I couldn't get the result to do anything interesting, so.. dunno. YMMV, I guess.

Link to comment
Share on other sites

Thanks much for the tips. I downloaded the bvh files, uploaded "avatar_stand" unlooped (yes it's a single frame) twice, once at pri 0 and once at pri 4. Neither one stopped the currently looping animation. The high priority one overrode it, but as soon as it ended, the dance resumed (which makes sense, since it was merely tempoarily "hidden" by the short high priority stand animation).

So no luck so far at all. Contrary to what the documentation says, there appears to be NO way to really stop a looping animation immediately, period. You can only "hide" it temporarily with a high priority animation. I haven't tried that yet but a high-priority "stand" animation may be more confusing to the dancer than just letting the current loop finish. Plus I have no idea how long to play the "hider" animation since I don't know how long the current loop is going to take to finish.

If anyone has any other ideas I'd love to hear. Or is this truly impossible?

The only thing that actualy seems to work is the system Avatar/Avatar Health/Stop Avatar Animations in Firestorm (not sure if that's in the standard viewer). But this can't be done via script.

Link to comment
Share on other sites

Hm I just tested out a commercial dance ball in my inventory with a long looped dance. As soon as I jump off, the dance stops! The script must be stopping my looped dance. How??? It doesn't appear to be animating me with anything else.. the looped dance just stops immediately. What's the trick?

Link to comment
Share on other sites

Update: I tried a commercial long looped dance animation in my own object/script and it stopped immediately on llStopAnimation! So it must have been something with that other animation?I have no idea. Why would one animation stop and another refuse? Maybe this is not a real problem and most animations don't ignore llStopAnimation like that, I have no idea.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3731 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...