Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Permission_trigger_animation

Strollerweb Market
Registered User
Join date: 20 Nov 2006
Posts: 21
02-05-2007 13:52
I have an issue with this script (see below) I have this in a prim that is worn by the Avatar. It works great for me and does what i want, but when i give the prim to someone else they either get a perrmision script error or they dont get the Animation playing.

I dont see why it should not work for them, can someone point me in the right direction!
(the Dance animation is in the Prim)

string ANIMATION="Dance";
integer Handle;
default
{
state_entry()
{

llSetTimerEvent(.1);
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);

}

timer()
{

Handle = llListen( 0, "", llGetOwner(), "" );
llListenControl(Handle, TRUE);

llStartAnimation(ANIMATION);
}

}
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-05-2007 14:02
You need to reset the script when a different owner gets it, or on rez since its so simple


Not sure why you have a timer in there or a listen ?
Strollerweb Market
Registered User
Join date: 20 Nov 2006
Posts: 21
02-07-2007 23:17
Once again thank you Newgate, using you bit of code from this thread
/54/15/163396/1.html
everything is working great:

string ANIMATION="Dance";
integer Handle;
default
changed(integer change)
{
if(change & CHANGED_OWNER)
{
llResetScript();
}

}

state_entry()
{

llSetTimerEvent(.1);
llRequestPermissions(llGetOwner(),PERMISSION_TRIGG ER_ANIMATION);

}
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
02-08-2007 01:31
Instead of a timer, You would likely be better off using run_time_permissions to make sure the thing runs as expected:

CODE
string ANIMATION="Dance";
integer Handle;
default
{
attach(key attached_to) // triggered on attaching or detaching from avatar
{
if(attached_to == NULL_KEY ) // a NULL_KEY value means it's detached
{
if(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) // if we have animation perms
{
llStopAnimation(ANIMATION);
}
}
else
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); // Never assume we have perms
}
}

run_time_permissions(integer perm) // After an agent responds to a permissions dialog, this is triggered (also if the perms are automatically granted)
{
if( perm & PERMISSION_TRIGGER_ANIMATION )
{
Handle = llListen( 0, "", llGetOwner(), "" );
llListenControl(Handle, TRUE); // not nessesary, listens start active.

llStartAnimation(ANIMATION);
}
}

}
_____________________