Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Reapplying Animations via Script (Pose Lock)

Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
08-07-2009 07:45
heyas;

okay, i am trying to create a tiny lock pose script, and having a problem getting a script to apply (reapply) an animation that it perceives as already running. (how it 'perceives' this is a mystery to me.) and apparently, i am the only person having this problem, because i have a tiny eagle that applies the same pose 3 times in a stack. (as seen on the debugging animation list).

http://jira.secondlife.com/browse/VWR-9410


so my problem is twofold.

1: if i call llstartanimation for an animation that is already playing, it will not reapply that animation to the top of the animation stack.

this happens whether or not the animation has the same uuid or not (ie: i uploaded it again to get a new uuid for it). i'm at a loss to explain that. it happens whether i am applying the pose from one script or two (in the same object. i didnt try with 2 objects.).

it happens if i play the animation from inventory, then try to apply it via script. it happens if i apply it via script, then play it from inventory.

whatever i do, i just can NOT get the animation to move to the top of the stack.


2: if i call llstopanimation the line above llstartatnimation, the animation is not removed in time to apply it again, and it's still stuck in the bottom of the list.
and
2a: if i put a delay between stop and start, i get the avatar blipping out of the lock, which is quite ugly.


sample testing script. use any 2 distinct priority 4 animations. (or im me for the anims listed below.)


default
{
state_entry()
{ llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); llOwnerSay("Turn on Advanced: Character: Animation Info. Note where custom animations are in the list. Click this object to start the test.";); }

on_rez(integer start_param)
{ llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); llOwnerSay("Turn on Advanced: Character: Animation Info. Note where custom animations are in the list. Click this object to start the test.";); }

run_time_permissions(integer permissions)
{
if (permissions & PERMISSION_TRIGGER_ANIMATION)
{ llOwnerSay("Applying Animation 1: 68bb48c3-0f80-7efe-4e04-50a283109be0";); llStartAnimation("TAO2-Lock";); llOwnerSay("This should fold you up like a Tiny.";); }

}

touch_start(integer tsn)
{ llOwnerSay("Starting Animation Test.";); llOwnerSay("Starting Animation 2: b42b7810-c184-3a7e-e1fd-e66f0440d0b0";); llStartAnimation("Dance 14";); llOwnerSay("This should half unfold you and make you dance.";); llSleep(2.0); llOwnerSay("Starting Animation 1: 68bb48c3-0f80-7efe-4e04-50a283109be0";); llStartAnimation("TAO2-Lock";); llOwnerSay("This should refold you again, but notice it does not. It is already in your Animation List, and does not get moved to the top, nor reapplied.";); }

}



is there a trick to this that i am missing? a secret method? something?
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
08-07-2009 08:30
For your sample, it works if I use

llStopAnimation("zig-stand";);
llStartAnimation("Dance 14";);
llStartAnimation("zig-stand";);

... with the "trick" being that a different animation begins playing between the stop and the start.

You might try playing with a "null" animation, something that doesn't get around to moving any joints, if you really need to fool triggering orders.
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
08-07-2009 08:42
Since I closed up shop, I'll give out one of my old tricks for re-applying animations.

Upload your animation twice, so you get two copies of the same animation, but with different asset keys. Play them alternately, this fools the viewer into thinking it's 'different' and moving it to the top of the stack. :)


so something like this:

Play Copy1,

Play Copy2,

Play Copy1,

Play Copy2,

rinse, repeat.


If you make your animations non-looping, you don't even have to stop the old animation before playing the new one. It can be very efficient.
_____________________
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
08-10-2009 07:59
heyas;

i tried that one, darian. didnt work. meh. but i suppose i can play a library animation between applies....

thanks guys, this was really bringing me down!



::sigh::



okay, i am getting all kinds of crap results. there's a big delay in any animations applying, and so they are applying in the wrong order.

for example, the script goes:
apply dance 14
sleep 2
apply tao2 lock
sleep 5
stop tao2 lock
apply hover
apply tao2 lock

so when i click this... it says it is aplpying dance 14, but doesnt get around to actually DOING that until after the hover is applied. the tao2 lock is NOT being stopped, and, naturally, its not being re-applied at the top of the stack.


why me???

okay, its working about one in every.... 25-50 tries. which is about the success rate i had with adding a tiny lock pose after the en garde animations.


okay, as far as i can tell... something is making the animation applications delayed, so that either the stop animation call isnt stopping the animation (and hence the start animation call isn't applying it, because it is still on), or... or its just ignoring all these commands, because i dont see them appearing in the animation list at all.

llOwnerSay("Now trying StopStartStart with null anim in between";);
llStopAnimation("TAO2-Lock";);
llStartAnimation("turnleft";);
llStartAnimation("TAO2-Lock";);
llStopAnimation("turnleft";);


i tried hover, which is priority 0 (and a great null animation for anything). i tried express_emote_sad, which is priority 2 (which worked 2 times in a row, then stopped), and this turnleft, which says priority one, but im pretty sure the hips are actually priority 4. okay, JUST to be sure, i also tried surf, which is priority 4.


AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGH

okay, i take it back.

the two different uuid anim flipping is working. thanks, darien. thanks for your nice works, as well. hope you're in a better place now. especially thanks for hanging out at this old forum!


llOwnerSay("Now trying alternate UUIDs 5 sec delay.";);
llStopAnimation("TinyLockBase";);
llStartAnimation("TinyLockBasenewUUID";);


llSleep(5.0);
llStopAnimation("TinyLockBasenewUUID";);
llStartAnimation("TinyLockBase";);


this is working smoothly. maybe switching locks before reapply will trick my scripts into working.
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
08-10-2009 08:41
You're welcome. :)
_____________________