Jump to content

little Trouble with permissions


Casey Conundrum
 Share

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

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

Recommended Posts

About to pull my hair our rofl.

A) I can get the pose to start, but when its time to stop it, it fails to stop and sometimes gives us "Script trying to trigger animations but PERMISSION_TRIGGER_ANIMATION permission not set".

B) under take control how would I take control where the said person can not move till time releases controls? just not sure what to add in the  control event

 

string animation = "Pose";

trigger()
{
    //-- Removed not a problem --
    //little hidden code
    //-- end of Removed not a problem --
    llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);
}

default
{
    state_entry()
    {

    }
    
    run_time_permissions(integer perm)
    {
        if(PERMISSION_TAKE_CONTROLS & perm)
        {
            llTakeControls(CONTROL_FWD |CONTROL_BACK |CONTROL_LEFT |CONTROL_RIGHT |CONTROL_ROT_LEFT |CONTROL_ROT_RIGHT |CONTROL_UP |CONTROL_DOWN |CONTROL_LBUTTON |CONTROL_ML_LBUTTON ,TRUE, TRUE);   
        }
        
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
            list anims = llGetAnimationList(llGetOwner());
            if(llListFindList(anims, [llGetInventoryKey(animation)]) == -1)
            {
                llStartAnimation(animation);
            }
        }
    } 

    timer()
    {
        //-- Removed not a problem --
        //little hidden code
        //-- end of Removed not a problem --
        
        if (amounta == amountb)
        {
            // Stop the timer.
            llSetTimerEvent(0.0);
            llStopAnimation(animation);
            llReleaseControls( );
        }
    }
}

 

Link to comment
Share on other sites

7 minutes ago, Casey Conundrum said:

A) I can get the pose to start, but when its time to stop it, it fails to stop and sometimes gives us "Script trying to trigger animations but PERMISSION_TRIGGER_ANIMATION permission not set".

B) under take control how would I take control where the said person can not move till time releases controls? just not sure what to add in the  control event

For A, try protecting that llStopAnimation() call with some conditionals, at least checking if PERMISSION_TRIGGER_ANIMATION is in the bit vector returned by llGetPermissions(). Might also want to check that the agent key returned by llGetPermissionsKey() is in the region (e.g., their llGetAgentSize() isn't the ZERO_VECTOR, or their llGetMass() isn't 0.0, or something like that).

For B, try changing the last argument ("pass_on") to FALSE—but bearing in mind that there are other ways for an avatar to move that don't involve controls at all.

Link to comment
Share on other sites

10 minutes ago, Qie Niangao said:

there are other ways for an avatar to move that don't involve controls at all

Teleporting and sitting on something are the only ones I know of that wouldn't be affected by 'locked controls'. Camera focusing can also lead to turning without control input.

I'm fairly certain the viewer's autonav functionality (which is bad and hopefully nobody uses seriously) goes through the same control system as regular movement input.

Link to comment
Share on other sites

This pose & script are both in a hud that a user will wear. so sitting to stop movement will not work in the system. the idea is I have fence that sends a message to the hud, you have touched the fence. So the hud will send a zap to the hud user zapping them for a amount of time. during that time frame I don't want them to be able to move while being zapped. IE while the pose is being played.

Link to comment
Share on other sites

For question A:

I often see two approaches being used: global variable or llGetPermissions.

The global variable method sets a global variable (gasp!) to TRUE or FALSE. In your case:
 

integer giAnimPerms;

if (perm & PERMISSION_TRIGGER_ANIMATION)
{
  giAnimPerms = TRUE; //Set to TRUE
  list anims = llGetAnimationList(llGetOwner());
  if(llListFindList(anims, [llGetInventoryKey(animation)]) == -1)
  {
  	llStartAnimation(animation);
  }
}

And in your timer
 

if (amounta == amountb)
{
	// Stop the timer.
	llSetTimerEvent(0.0);
	if (giAnimPerms) //Check perms
	{
		llStopAnimation(animation);
		giAnimPerms = FALSE; //Set to FALSE
	}
	llReleaseControls();
}

 

The same can be done with llGetPermissions. In that case, you can leave the first section untouched, but you need to adjust the timer section:

if (amounta == amountb)
{
    // Stop the timer.
    llSetTimerEvent(0.0);
    integer iGrantedPermissions = llGetPermissions(); //Get the granted permissions
    if (iGrantedPermissions & PERMISSION_TRIGGER_ANIMATION) //Make sure you use a single &
    {
        llStopAnimation(animation);
    }
    llReleaseControls( );
}

I'm not sure what the trade-off is, memory-wise, so I cannot tell you what the most efficient method is.

As for question B: I'm not entirely understand your question, but I would take a look at the examples of https://wiki.secondlife.com/wiki/LlTakeControls. It's a pretty straightforward snippet on how to implement it.

 

Edited by Bugs Larnia
Added question B response
Link to comment
Share on other sites

I understand the question you posed here was not what you wanted, but please don't remove the original questions. I might not be relevant to you (any more), but might be the exact answer someone else is looking for and now the answers no longer have context.

  • Thanks 1
Link to comment
Share on other sites

26 minutes ago, Bugs Larnia said:

As for question B: I'm not entirely understand your question, but I would take a look at the examples of https://wiki.secondlife.com/wiki/LlTakeControls. It's a pretty straightforward snippet on how to implement it.

I agree on this. I was studying it recently and finally saw that there are options to take controls and basically "pass through" - the avatar controls do the normal things but you also intercept the controls.  If you use llTakeControls() with the wrong bit flags, then the "pass through" happens instead of the actual "TAKE" controls (override normal control usage).

  • Like 1
Link to comment
Share on other sites

15 hours ago, Quistess Alpha said:

Teleporting and sitting on something are the only ones I know of that wouldn't be affected by 'locked controls'.

My initial thought was of a physics HUD, analogous a swim HUD but setting buoyancy independent of water level and using HUD buttons in place of control inputs. But…

15 hours ago, Casey Conundrum said:

This pose & script are both in a hud that a user will wear. so sitting to stop movement will not work in the system.

so maybe we're only concerned with avatar movement that's "in the system", not worrying about any sneaky adversarial devices the captured user may deploy. And if the whole thing lasts only a few seconds, it's pretty unlikely they'll have time to find and activate such a device anyway.

(I also realize, on re-reading my response, that I didn't make clear that "the last argument ('pass_on')" I was mentioned was to llTakeControls but that's clear now. Sorry I omitted that the first time.)

  • Like 1
Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...