Jump to content

Lip movement to simulate breathing. Correct but non-functional script


takean123
 Share

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

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

Recommended Posts

Hello everybody,

I just wrote this script which is correct but unfortunately has no effect.

The prim containing the script and animation is touch-activatable and is worn on the avatar's head.
When you touch the prim, a menu appears to start the animation and of course stop it.

 

string animation = "MOAN_STOP-EYES"; // Nom de l'animation à jouer
integer menu_handler;

default
{
    state_entry()
    {
        llSetTouchText("Cliquez ici pour ouvrir le menu"); // Texte lorsqu'on touche le prim
    }

    touch_start(integer total_number)
    {
        llOwnerSay("Ouverture du menu..."); // Message dans le chat du propriétaire

        // Création du menu
        menu_handler = llListen(-1, "", llGetOwner(), "");
        llDialog(llDetectedKey(0), "Choisissez une option :", ["Jouer Animation", "Arrêter Animation"], menu_handler);
    }

    listen(integer channel, string name, key id, string message)
    {
        if (channel == menu_handler)
        {
            if (message == "Jouer Animation")
            {
                llStartAnimation(animation);
            }
            else if (message == "Arrêter Animation")
            {
                llStopAnimation(animation);
            }
        }
    }
}


So the script is correct, the animation is declared well, it's in the prim, but it doesn't work.
Do you have a suggestion for me to try another approach?

Thank you in advance for your help.

Have a good New Year's Eve and take care of yourself in rl.

Ps: I am French-speaking and I use a translator. Sorry if the subject presents any misunderstandings. Do not hesitate to ask questions.

Link to comment
Share on other sites

The script is confusing the channel and the listen handle.

One way of fixing that might be:

string animation = "MOAN_STOP-EYES"; // Nom de l'animation à jouer
integer menu_channel = -17;
integer menu_handler;

default
{
    state_entry()
    {
        llSetTouchText("Cliquez ici pour ouvrir le menu"); // Texte lorsqu'on touche le prim
        // Création du menu
        menu_handler = llListen(menu_channel, "", llGetOwner(), "");
        llListenControl(menu_handler,FALSE); 
    }

    touch_start(integer total_number)
    {
        llOwnerSay("Ouverture du menu..."); // Message dans le chat du propriétaire

        // Création du menu
        llListenControl(menu_handler,TRUE);
        llSetTimerEvent(60.0);
        llDialog(llDetectedKey(0), "Choisissez une option :", ["Jouer Animation", "Arrêter Animation"], menu_handler);
    }

    listen(integer channel, string name, key id, string message)
    {
        //if (channel == menu_handler) // not needed, but was wrong, should be 
        //if(channel == menu_channel) // instead.
        //{
        if (message == "Jouer Animation")
        {
            llStartAnimation(animation);
        }
        else if (message == "Arrêter Animation")
        {
            llStopAnimation(animation);
        }
      
        llListenControl(menu_handler,FALSE);
        //}
    }
    timer()
    {   llListenControl(menu_handler,FALSE);
        llSetTimerEvent(0);
    }
}

 

Edited by Quistess Alpha
Link to comment
Share on other sites


Hello Quistess, thank you for this help.

Well seen; a big mistake on my part.

Unfortunately, even with this modification the script has no effect. The animation works when I use it from my inventory but it seems that the menu does not communicate the action to be performed.

My best wishes for this new year.

 

Link to comment
Share on other sites

2 hours ago, Quistess Alpha said:
llDialog(llDetectedKey(0), "Choisissez une option :", ["Jouer Animation", "Arrêter Animation"], menu_handler);
1 hour ago, takean123 said:

even with this modification the script has no effect.

my mistake in not correcting all instances of the mistake. In the above line, 'menu_handler' should be 'menu_channel'.

Edited by Quistess Alpha
Link to comment
Share on other sites

Thank you Quistess, shame on me for not having checked. Thanks Frionil for this suggestion

Indeed, as Frionil pointed out, I came up against : Script trying to trigger animations but PERMISSION_TRIGGER_ANIMATION permission not set

To fix this I used llRequestPermissions. 

So I modified the script as follows :

 

string animation = "MOAN_STOP-EYES"; // Nom de l'animation à jouer
integer menu_channel = -17;
integer menu_handler;

default
{
    state_entry()
    {
        llSetTouchText("Cliquez ici pour ouvrir le menu"); // Texte lorsqu'on touche le prim
        // Création du menu
        menu_handler = llListen(menu_channel, "", llGetOwner(), "");
        llListenControl(menu_handler,FALSE);

        // Demande de la permission PERMISSION_TRIGGER_ANIMATION
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    }

    touch_start(integer total_number)
    {
        llOwnerSay("Ouverture du menu..."); // Message dans le chat du propriétaire

        // Création du menu
        llListenControl(menu_handler,TRUE);
        llSetTimerEvent(60.0);
        llDialog(llDetectedKey(0), "Choisissez une option :", ["Jouer Animation", "Arrêter Animation"], menu_channel);
    }

    listen(integer channel, string name, key id, string message)
    {
        if (channel == menu_channel)
        {
            if (message == "Jouer Animation")
            {
                llStartAnimation(animation);
            }
            else if (message == "Arrêter Animation")
            {
                llStopAnimation(animation);
            }
          
            llListenControl(menu_handler,FALSE);
        }
    }
    
    timer()
    {
        llListenControl(menu_handler,FALSE);
        llSetTimerEvent(0);
    }

    run_time_permissions(integer permissions)
    {
        if (permissions & PERMISSION_TRIGGER_ANIMATION)
        {
            llOwnerSay("Permission accordée pour déclencher des animations !");
        }
        else
        {
            llOwnerSay("Permission refusée pour déclencher des animations !");
        }
    }
}

 

the script is correct, the permissions are granted automatically but unfortunately, the animation does not start. I have the activation menu but nothing happens.

The prim is worn on the jaw.
 

Link to comment
Share on other sites

Maybe it's a priority problem.


This is what the wiki has to say about it:
8. Priority
8-1: The default built-in animations are always available to your avatar in-world. They may have different priorities on each keyframed part, unlike uploaded animations which always have the same animation on the whole body. Unless you give a higher priority to your animations, your animations will be overriden by them in-world. Priorities range from 0 to 4, with 4 being the highest priority. See the default built-in animations page to make sure what kind of priority each animation has.
8-2: Priority for uploaded animations is only given for the whole avatar, and is set in the uploading window. However, unless you animate each individual part of the avatar in your animation, some parts may be overridden by default animations (breathing, walking, etc.)
8-3: A later playing animation is given priority over the former one when their priorities are the same.

 

To see if the animation is playing, you can select 'Developer - Avatar - Animation info' to get a list of all animations (uuid's) playing on the avatar above its head. I believe the number behind the animation name or uuid is the priority.

Link to comment
Share on other sites

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