Jump to content

Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set


Thaiika
 Share

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

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

Recommended Posts

Hello everyone. IM a very new... well I'm very stupid with all that scripting stuff, i even cant change part of code. So maybe someone can explain me what is wrong with this script, that i found on wiki.

When I worn it first time, or if I gave object with this script to someone, first time when people wear it, they got a lot of errors "  Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set" if people took it off and add again, this error didn't appear again. What permission it wants?

 

 

default
{
    touch_start(integer detected)
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    }
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
            llStartAnimation("its");  
            llPlaySound("How",1.0);
            llSetTimerEvent(9.7); 
        }
    }
    timer()
    {
        llSetTimerEvent(0.2);
        llStopAnimation("its");  
        llStopSound();
    }
}

Edited by Thaiika
Link to comment
Share on other sites

It seems the script does not reset. So in its last state, the `llSetTimerEvent()` was still stuck at 0.2, resulting in the timer() event firing continually ... while the script itself hasn't requested a permission (which gets done in the touch_start event).

Might need to add an on_rez event that will perform a script reset, thus disabling all timers & animation, and thus will wait for someone to touch it before it starts.

I'm a bit concerned, though, that the script never releases the very short timer event of 0.2 seconds.

The timer event will keep triggering every 0.2 seconds. This can cause big lag.

 

Link to comment
Share on other sites

19 minutes ago, primerib1 said:

It seems the script does not reset. So in its last state, the `llSetTimerEvent()` was still stuck at 0.2, resulting in the timer() event firing continually ... while the script itself hasn't requested a permission (which gets done in the touch_start event).

Might need to add an on_rez event that will perform a script reset, thus disabling all timers & animation, and thus will wait for someone to touch it before it starts.

I'm a bit concerned, though, that the script never releases the very short timer event of 0.2 seconds.

The timer event will keep triggering every 0.2 seconds. This can cause big lag.

 

Right, good catch! Nothing is disabling the timer at all! ("llSetTimerEvent(0.0);").

Maybe they wanted to actually stop the timer in the timer() event?

Link to comment
Share on other sites

13 minutes ago, Love Zhaoying said:

Right, good catch! Nothing is disabling the timer at all! ("llSetTimerEvent(0.0);").

Maybe they wanted to actually stop the timer in the timer() event?

Unless it's a thing designed to brute-force stopping other animations.

"Wear this to stop ALL animations" things.

So one is supposed to wear it, wait awhile, then detach it.

But therein lies the problem, when reattaching it still has its timer active and goes straight to the timer() event.

Link to comment
Share on other sites

8 minutes ago, primerib1 said:

Unless it's a thing designed to brute-force stopping other animations.

"Wear this to stop ALL animations" things.

So one is supposed to wear it, wait awhile, then detach it.

But therein lies the problem, when reattaching it still has its timer active and goes straight to the timer() event.

My personal thought is, change this line:

        llSetTimerEvent(0.2);

to:

        llSetTimerEvent(0.0);

What say you?

  • Like 2
Link to comment
Share on other sites

What @Love Zhaoyingsaid about llSetTImerEvent(0.0);

Also, for almost everything you give to someone else, it's a good idea to add

changed(integer c)
{   if(c&CHANGED_OWNER)
    {  llResetScript();
    }
}

which would probably fix the issue, even if for the wrong reason.

for more complex things, I try and defensively always call Start or stop animations in the run_time_permissions event:

string gAnimStart;
string gAnimStop;

default
{
    touch_start(integer detected)
    {	gAnimStart = "its";
        gAnimStop  = "";
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    }
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {   if(gAnimStart)
            {
               llStartAnimation(gAnimStart);  
               llPlaySound("How",1.0);
               llSetTimerEvent(9.7);
            }
            if(gAnimStop)
            {  llStopAnimation(gAnimStop);
            }
        }
    }
    timer()
    {
        llSetTimerEvent(0.0);
        gAnimStop = "its";
        gAnimStart = "";
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
        llStopSound();
    }
} 

a bit overkill for this example, but it makes more sense when you have more than one animation, and perhaps more than one person to animate.

Edited by Quistess Alpha
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

3 hours ago, Quistess Alpha said:

What @Love Zhaoyingsaid about llSetTImerEvent(0.0);

Also, for almost everything you give to someone else, it's a good idea to add

changed(integer c)
{   if(c&CHANGED_OWNER)
    {  llResetScript();
    }
}

which would probably fix the issue, even if for the wrong reason.

for more complex things, I try and defensively always call Start or stop animations in the run_time_permissions event:

string gAnimStart;
string gAnimStop;

default
{
    touch_start(integer detected)
    {	gAnimStart = "its";
        gAnimStop  = "";
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    }
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {   if(gAnimStart)
            {
               llStartAnimation(gAnimStart);  
               llPlaySound("How",1.0);
               llSetTimerEvent(9.7);
            }
            if(gAnimStop)
            {  llStopAnimation(gAnimStop);
            }
        }
    }
    timer()
    {
        llSetTimerEvent(0.0);
        gAnimStop = "its";
        gAnimStart = "";
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
        llStopSound();
    }
} 

a bit overkill for this example, but it makes more sense when you have more than one animation, and perhaps more than one person to animate.

Thats works without errors, thank you so much!!!! now i need to understand how to do it by myself. You are all so smart here, damn.

  • Thanks 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 498 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...