Jump to content

Scripting Errors....PERMISSION_TRIGGER_ANIMATION...help


You are about to reply to a thread that has been inactive for 2998 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

So I got a bunch of actions and poseballs and dances, and what not.  I went through the list testing them and seeing what they are.  But I noticed several script ones that are attached to poseballs dont seem to work.  This is the error message I get:

 

Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set

 

I haven't even begun to wrap my head around scripting so I have no idea how to fix it.  Maybe one day I can dedicate myself to learning script.  But for now...I need help.  So I'm posting the code below.....maybe someone with script experience can help?  I hope it can be edited.  The creator doesnt seem to be around.   :matte-motes-agape:

 

 

key owner;
key sitter;

string curanim;

default
{
    on_rez(integer params){llResetScript();}
    state_entry()
    {
    owner=llGetOwner();
     vector eul = <0,0,0>; //45 degrees around the z-axis, in Euler form
            eul *= DEG_TO_RAD; //convert to radians
            rotation quat = llEuler2Rot(eul); //convert to quaternion
            llSitTarget(<0,0,.75>,ZERO_ROTATION);
            llSetText("",<0,0,0>,0);
        }
            
    touch_start(integer total_number){
     
    }
    
     changed(integer change) { // something changed
     curanim=llGetInventoryName(INVENTORY_ANIMATION,0);
        if (change & CHANGED_LINK) { // and it was a link change
            llSleep(0.5); // llUnSit works better with this delay
            if (llAvatarOnSitTarget() != NULL_KEY) { // somebody is sitting on me
            sitter=llAvatarOnSitTarget();       
            llSleep(0.5);     
           llRequestPermissions(sitter, PERMISSION_TRIGGER_ANIMATION);
           llStopAnimation("sit");
           llStartAnimation(curanim);
            llSetAlpha(0,ALL_SIDES);
            }else{llStopAnimation(curanim);sitter=NULL_KEY;llSetAlpha(1,ALL_SIDES);}
        }
    }
}

 

 

Link to post
Share on other sites

if you see that warning when it first rezzes, ignore it. if you are seeing when you get up from sitting on it then delete this segment from the last line you posted

llStopAnimation(curanim);

as it's probably running afoul of permissions being revoked upon standing.

 

technically, that script is a bit sloppy since it doesn't check whether permissions were received (although they are auto granted for animation when sitting) and doesn't check that there is an animation in the prims contents

Link to post
Share on other sites

Here's a tidied-up and commented version to help you see what's going on

 

string curanim; //define a global variable, a string called "curanim"default{	on_rez(integer start_param)	{		llSetAlpha(1.0,ALL_SIDES); // start off visible	}	state_entry()	{		llSitTarget(<0,0,.75>,ZERO_ROTATION);//sit the avatar 0.75 meters above the center of the poseball, facing the same direction		curanim=llGetInventoryName(INVENTORY_ANIMATION,0);//from now on, when we refer to curanim, //the script knows that means the name of the first animation in the prim's inventory		if(llGetInventoryType(curanim)!=INVENTORY_ANIMATION){//optional sanity check -- make sure there's an animation there to use			curanim = "sit";//oops, there isn't -- use the default sit one, or the script will throw an error if it doesn't know what animation to use			llOwnerSay("Please put an animation in me");//warn the owner		}	}	changed(integer change)	{ // something changed		if (change & CHANGED_LINK) { // and it was a link change			if (llAvatarOnSitTarget() != NULL_KEY) { // somebody is sitting on me				key  sitter=llAvatarOnSitTarget();				llRequestPermissions(sitter, PERMISSION_TRIGGER_ANIMATION);//ask for permission to animate him or her //this will be silently and automatically granted since the avatar is sitting on the prim, but we still have to ask			}			else{//they've got up				if(llGetPermissions()&PERMISSION_TRIGGER_ANIMATION){					llStopAnimation(curanim);//Stop animating them				}				llSetAlpha(1.0,ALL_SIDES);//make the poseball visible again			}		}		else if (change & CHANGED_INVENTORY){// if the contents of my inventory have changed			curanim=llGetInventoryName(INVENTORY_ANIMATION,0);// see what animation I'm using			if(llGetInventoryType(curanim)!=INVENTORY_ANIMATION){// make sure there's an animation there to use				curanim = "sit";//oops, there isn't -- use the default sit one, or the script will throw an error if it doesn't know what animation to use				llOwnerSay("Please put an animation in me");//warn the owner			}		}	}	run_time_permissions(integer permissions)	{		if(permissions & PERMISSION_TRIGGER_ANIMATION){//if the permissions have been granted (they will have been, but its good practice to check anyway)			llStopAnimation("sit");//now we can stop the default sit anim without getting error messages			llStartAnimation(curanim);//and start to play whatever curanim is			llSetAlpha(0.0,ALL_SIDES);//and hide the pose ball		}	}}

 

  • Like 3
Link to post
Share on other sites
  • 11 months later...
  • 5 months later...

It's not a stupid question at all.

Scripts need to ask for your permission to animate you.  You will doubtless have seen this with Dance Balls in clubs and similar devices.

However, if the script is in something you're either sitting on (as in this example) or wearing, like an AO, the permission is automatically and silently granted, so you don't see a menu asking for your permission.   The script still has to ask for permission (which this does, in the changed event) but you don't get bothered by a menu.

So, the short answer is, you don't need to click anything in this example.

The reason, by the way, that you get asked for permission when using beds that use poseballs is that the scripts that animate you (and the animations) are in the bed rather than the poseball on which you're sitting.   

Link to post
Share on other sites

I suspect that you are not getting the error message when the script is trying to start an animation, but rather when it is trying to stop one.  That's a pretty common error.  As Innula explained quite well, a script needs your permission to animate you.  It also needs your permission to stop animating you.  You would think that a script could remember, having asked your permission once, that it still has your permission when you want to stop an animation later, and it does.  The problem is that permission is automatically revoked when you stand up again.  Knowing that, most scripters avoid trying to stop an animation at that point.  Some don't, however, and their scripts complain by telling users that they need PERMISSION_TRIGGER_ANIMATION. There's no way that you can solve that one, as a user, unless you have mod perms on the script and can fix the flaw.

Link to post
Share on other sites

Permission is only automatically revoked when you stand up if you're using some TPVs and if you've set it that way (it's an anti-griefing measure, or so I'm told).  

What  I might do, since I have no way of knowing what viewer people might use, is check, when someone stands up, is something like this

changed(integer change)	{		if(change & CHANGED_LINK){			key k = llAvatarOnSitTarget();			if(k){// if there's sitting on me				llRequestPermissions(k,PERMISSION_TRIGGER_ANIMATION);			}			else{// if there's not, they've just got up				if(llGetPermissions()& PERMISSION_TRIGGER_ANIMATION){// have i got permissions? if so					if(llGetAgentSize(llGetPermissionsKey())!=ZERO_VECTOR){// belt and braces -- make sure the avatar is still on the sim, or it'll throw an error						llStopAnimation(anim);//stop whatever the animation is					}				}			}		}	}

 I say "might" because I would always check I have animation permissions before starting or stopping things, but I don't normally bother to check if the avatar is still around (though I guess I should).

Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 2998 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...