Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Not Getting Permission for Animation

Ethen Drechsler
Reanimated
Join date: 19 May 2008
Posts: 33
01-05-2009 14:09
The following script plays a priority 4 animation for the arm holding the object in which it is loaded and puts a stupid perma-grin on the avatar's face. To my complete and utter consternation, however, the 'Hold' animation continues to override other lower priority animations after the object is has been detached. Unsurprisingly the object throws a script error warning "Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set" when it is rezzed in-world:

CODE

default
{
attach(key avatar)
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
}

run_time_permissions(integer value)
{
if (value & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation("express_toothsmile");
llSetTimerEvent(1);
}
}

timer()
{
llStopAnimation("express_toothsmile");
llStartAnimation("express_toothsmile");
llStartAnimation("Hold");
}
}


Perhaps I should be wearing the stupid perma-grin myself?
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
01-05-2009 14:56
The timer will still be running after first attach. try adding an on rez event:
CODE

on_rez(integer start_param) {
if (llGetAttached() == 0) {
llSetTimerEvent(0.0);
}
}
_____________________
http://slurl.com/secondlife/Together
Ethen Drechsler
Reanimated
Join date: 19 May 2008
Posts: 33
01-06-2009 01:12
From: Escort DeFarge
The timer will still be running after first attach. try adding an on rez event ...

Thank you, Escort. This appears to have done the trick. I'm reproducing it here for inspection. Even though I'm quite experienced at torturing other people's scripts into doing my bidding I don't fully understand the syntax of scripting:

CODE

default
{
on_rez(integer start_param)
{
if (llGetAttached() == 0)
{
llSetTimerEvent(0.0);
}
}
attach(key avatar)
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
}
run_time_permissions(integer value)
{
if (value & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation("express_toothsmile");
llSetTimerEvent(1);
}
}
timer()
{
llStopAnimation("express_toothsmile");
llStartAnimation("express_toothsmile");
llStartAnimation("Hold");
}
}
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-06-2009 06:47
what about having it turn off the timer when it detaches, that way if it's rezzed on the ground it never needs to perform the check

default
{

attach(key avatar)
{
if(avatar)//if there's an actual key and not NULL_KEY
{
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
}
else{llSetTimerEvent(0.0);}
}
run_time_permissions(integer value)
{
if (value & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation("express_toothsmile";);
llSetTimerEvent(1);
}
}
timer()
{
llStopAnimation("express_toothsmile";);
llStartAnimation("express_toothsmile";);
llStartAnimation("Hold";);
}
}
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
01-06-2009 06:54
From: Ruthven Willenov
what about having it turn off the timer when it detaches, that way if it's rezzed on the ground it never needs to perform the check

Although that seems a cleaner approach, it is more fragile. The reason for that is that attach isn't guaranteed to run when you detach an object and so the timer may not be stopped.

regs,
/esc
_____________________
http://slurl.com/secondlife/Together
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-06-2009 17:30
From: Escort DeFarge
Although that seems a cleaner approach, it is more fragile. The reason for that is that attach isn't guaranteed to run when you detach an object and so the timer may not be stopped.


Huh. Don't think I've ever seen it NOT run. Where's that info from? I know the amount of time your attach handler can take during detach is somewhat limited, so you don't want to run stuff that causes script delay and such, but I wasn't aware of it not running at all.