Jump to content

Touch start/end Animation Error Message?


Lunacy Bloodrose
 Share

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

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

Recommended Posts

So I'm trying to put a script together that will start and stop an animation for an avatar on touch. Similar to how the dancers that doesn't use poseballs work for example.

So far I've got this to work, but it's still giving me an error message every time it's clicked and I can't figure out how to fix it and everything I've tried breaks the part that does work (and i don't know much about scripting in the first place). Anyone out there know what the problem might be/ how to fix it?

Quote

default
{
    touch_start(integer detected)
    {
        llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
    }
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
            llStartAnimation("animation");
            llSetTimerEvent(0);
        }
    }
    touch_end(integer detected)
    {
        llStopAnimation("animation");
    }
}

And the error message I keep getting.

Quote

Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set

 

Link to comment
Share on other sites

You've just misunderstood what the touch_end event means.  That event is triggered the instant that you release the mouse button.  (The touch_start event is triggered the instant that you click it down.)  So, what you have written starts the animation as you click the mouse button down, and then immediately tries to stop it as you release the mouse button.  But, of course, you haven't given the user time to give permissions yet, so you get an error.  I suspect that you really want to stop the animation the next time the user clicks, or at some time in the future (suggested by the fact that you apparently plan to have a timer event in your script, but haven't written one yet).

Edited by Rolig Loon
Link to comment
Share on other sites

touch_end gets triggered when you release the mouse button, like when moving to click the request to animate. I would use a toggle, or a check for perms. like this:

default
{
    touch_start(integer detected)
    {
        if(llGetPermissionsKey())
        {
            llStopAnimation("sit");
	llResetScript();
        }
        else
        {
            llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
        }
    }
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
            llStartAnimation("sit");
        }
    }
}

 

Edited by Ruthven Willenov
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

Hello there, i have a question. If i need this script working little bit different way. I need a prim with that cript and when someone touch this prim on me, my avatar start dancing, sit or o any inamitions wich i chose. Without any permission questions. Just aweryone who click on that prim on me, make my avis turn on and off animation. How can i do that? my english not so good to understand that lsl stuff but i trying to do that. Or maybe i need some another script for this?

default
{
    touch_start(integer detected)
    {
        if(llGetPermissionsKey())
        {
            llStopAnimation("sit");
	llResetScript();
        }
        else
        {
            llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
        }
    }
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
            llStartAnimation("sit");
        }
    }
}
Edited by Thaiika
Link to comment
Share on other sites

You will always get the permission questions when you're trying to trigger an animation unless you trigger the permission request by sitting on the object or attaching it.  You are triggering it by touching the object, so you will always be asked for permission.

Link to comment
Share on other sites

8 hours ago, Thaiika said:

Hello there, i have a question. If i need this script working little bit different way. I need a prim with that cript and when someone touch this prim on me, my avatar start dancing, sit or o any inamitions wich i chose. Without any permission questions. Just aweryone who click on that prim on me, make my avis turn on and off animation. How can i do that? my english not so good to understand that lsl stuff but i trying to do that. Or maybe i need some another script for this?


default
{
    touch_start(integer detected)
    {
        if(llGetPermissionsKey())
        {
            llStopAnimation("sit");
	llResetScript();
        }
        else
        {
            llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
        }
    }
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
            llStartAnimation("sit");
        }
    }
}

In the script there is a function call llDetectedKey(0) in the touch_start event. It's role is to get the unique key (UUID) of the avatar which touches the prim. As a result the script will ask the person who touches the prim for permission. In order to animate the avatar who WEARS the prim and not the avatar that TOUCHES the prim, you need to substitute this function call with another call that will get instead the unique key of the person who wears the prim. Now how to do that? In order to be able to wear a prim, you need to be the the owner.  Therefore llGetOwner() is your friend...   😉

EDIT: You might need to do more changes to the script as the permission is automatically granted when attaching or sitting on a prim. So I would have to test myself if it works like that (don't have time to do now).

Edited by Estelle Pienaar
  • Like 1
Link to comment
Share on other sites

i typically try not to just give a complete script in the forums unless it's a modification of the OP script, but this seemed like a simple enough one. Just drop this into an object you wear that you want others to click. Drop in the animation you want to use, and type in the name at the top of the script. Pick it up and attach it.

integer toggle;
string animation = "";//add animation name
default
{
    attach(key id)
    {
        if(id)
        {
            llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION);
        }
        else
        {
            if(llGetPermissionsKey())
            {
                toggle = 0;
                llStopAnimation(animation);//stops the animation if you detach the object
            }
        }
    }
    
    run_time_permissions(integer perms)
    {
        if(perms & PERMISSION_TRIGGER_ANIMATION)
        {
            llSetText("Touch me to make me animate",<0.0,0.0,1.0>,1.0);
        }
    }

    touch_start(integer total_number)
    {
        toggle = !toggle;
        if(toggle)
        {
            llStartAnimation(animation);
            llSetText("Touch me to stop animation",<0.0,0.0,1.0>,1.0);
        }
        else
        {
            llStopAnimation(animation);
            llSetText("Touch me to make me animate",<0.0,0.0,1.0>,1.0);
        }
    }
}

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

OH thank you. Yeah its seems easy if you good understand english and all that terminology of lsl. But not for me, i not good understand all of that on english. Anyway its works. Thank you so much !!

 

Edited by Thaiika
Link to comment
Share on other sites

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