Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Animation inside attachment

Nih Grun
Registered User
Join date: 30 Apr 2008
Posts: 58
05-22-2008 12:05
Hiya everyone

I'm trying to make an attachment play an animation when it is worn. I found and changed the following script:

default
{
attach(key id)
{
if(id == NULL_KEY)//IF detached and an animation is running
llStopAnimation("equip";); //stop the anim
else
llResetScript();
}
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); //we ask for permissions
}
run_time_permissions(integer perms)
{
llStartAnimation("equip";);
}
}

Unfortunately the animation will not play. It does play when triggered manually and there seem to be no priority issues. What am I doing wrong?
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
05-22-2008 12:12
Unless somebody else actually knows the answer (I don't) a good debugging idea is to put some llOwnerSay's in there..

Maybe:
CODE

default
{
attach(key id)
{
llOwnerSay ("attach: got id " + (string)id);
if(id == NULL_KEY)//IF detached and an animation is running
llStopAnimation("equip"); //stop the anim
else
llResetScript();
}

state_entry()
{
llOwnerSay ("state_entry: requesting permissions");
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}

run_time_permissions(integer perms)
{
llOwnerSay ("r_t_p: got permissions " + (string)perms);
llStartAnimation("equip");
}
}
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
05-22-2008 13:43
Maybe it has something to do with the odd behavior I've seen with scripts in attachments, where after editing and recompiling the attachment must be detached and reattached for the updates to "take"; my thinking is that just like recompiling/resetting a script is flaky in a worn attachment, perhaps calling llResetScript in a worn attachment is broken too.

You might try something like this (beware, not in-world and there's likely to be a dumb mistake in here somewhere):

CODE

default
{
state_entry()
{
}

attach(key id)
{
if(id == NULL_KEY)//IF detached and an animation is running
llStopAnimation("equip"); //stop the anim
else
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}

run_time_permissions(integer perms)
{
llStartAnimation("equip");
}
}
_____________________
Designer of sensual, tasteful couple's animations - for residents who take their leisure time seriously. ;)

http://slurl.com/secondlife/Brownlee/203/110/109/

Nih Grun
Registered User
Join date: 30 Apr 2008
Posts: 58
05-22-2008 14:13
Anti: Close! I was removing and reattaching it to see if that helped, then I noticed the script wasn't flagged as "running". Works like a charm now. Thanks guys!