Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script error question: 2 poses in one linked object

Min Fairweather
Registered User
Join date: 21 Feb 2007
Posts: 202
01-26-2008 14:13
Hi All,

I'm very new to scripting and mostly just use poseball scripts in the furniture I make. I have a neat little script which works great for chairs with a single pose in them. The problem is that when I have two poses in one object (e.g. in a sofa) then when you sit on one poseball (or stand up) the other gives the following error:

Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set

This doesn't stop the sofa working at all but looks odd and i'm sure will put people off buying it as they might think it's broken.

I'll post the script I use below. Can anyone tell me how I can stop the script error happening?

Many thanks in advance,
Min


//script for sitting cross legged on an object
//by Ananda Sandgrain - free to distribute but please don't sell!

key avatar;
vector pos = <-0.4,-0,0.73>; //adjust the position to fit object -must be
//nonzero in at least one direction or script will not work!
rotation rot = <0.05,0,1,0.05>; //adjust rotation (1 in any vector gives 90 deg)

default
{
state_entry()
{
llSitTarget(pos, rot);
}
changed(integer change)
{
avatar = llAvatarOnSitTarget();
if(change & CHANGED_LINK)
{
if(avatar == NULL_KEY)
{
// You have gotten off
llStopAnimation("sit ground 1";);
llReleaseControls();
llResetScript();
}
else if(avatar == llAvatarOnSitTarget())
{
// You have gotten on
llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION );
}
}
}
run_time_permissions(integer perms)
{
if(perms)
{
llStopAnimation("sit";);
llStartAnimation("sit ground 1";);
}
else
{
llUnSit(avatar);
}
}
}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-26-2008 14:25
When an avatar sits on one prim, all scripts in the whole object will receive 'changed' events with CHANGED_LINK, because the avatar essentially becomes another (sort of) prim in the object. This script is assuming that if there is no avatar on its prim's sit target, then someone has gotten up (it tries to stop the animation it plays). Instead it will have to remember if anyone WAS sitting on the prim before the 'changed' event, and even better would be if it ALSO tests whether it has animation permissions (for that avatar that used to be sitting on it).

So you'll probably want a global variable. Maybe 'key sitter;' or something. And see:

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetPermissions
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetPermissionsKey

Site note: the 'else if(avatar == llAvatarOnSitTarget())' test is always going to be true, since avatar was just set to the result of llAvatarOnSitTarget() in the same event handler above. This might as well just be changed to an unconditional 'else'.
Blaze Nielsen
Registered User
Join date: 24 May 2005
Posts: 276
I'd like to find the answer to this one too
05-05-2008 10:22
some furniture with multiple poses can be a problem with this error display. Seems like the scripts needed for some of the older poses are the culprit. The new poses that can use Lex Neva's pose setter seem to work fine, without getting error messages. But, the older ones can be a problem.
Kahiro Watanabe
Registered User
Join date: 28 Sep 2007
Posts: 572
05-05-2008 10:26
When someone sits up animation is stopped automatically...so actually you don't kneed to change llStopAnimation in those cases.