Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

attach() and llStopAnimation

Deneb Rosewood
Registered User
Join date: 2 Feb 2006
Posts: 15
05-21-2006 06:11
Making a script to animate when you put it on, and then stop animating you when you take it off. This should be something simple you'd think, except two of these run on two seperate attachments that control different parts of the body, and when I take one of them off, both animations stop. I had theories as to why this happens but managed to disproove them all. I dunno where to attack this problem from anymore so I turn to you, the ever smarter-then-me forumgoers... help x_x

CODE

string anim;
default
{
state_entry()
{
}
attach(key id)
{
if (id != NULL_KEY)
{
anim = llGetInventoryName(20,0); // 20 = animations only, 0 = first one
llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
}
else
{
llStopAnimation(anim);
llResetScript();
}
}
run_time_permissions(integer perm)
{
if(perm & (PERMISSION_TRIGGER_ANIMATION))
{
llStartAnimation(anim);
}
}
}
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
05-21-2006 08:54
Taking out the llResetScript() on detach will correct the problem.

I'm only guessing, but what looks to be happening is that resetting the script is clearing the animation permissions for all animating scripts, which is odd and could probably be considered a bug.
_____________________
- Making everyone's day just a little more surreal -

Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"