Jump to content
  • 0
Sign in to follow this  
Mejamz

How do I play a gesture from script? /sneeze, /cough, /bow?

Question

  • 0

I'm not a scripter, but if you ask this question in the Scripting forum, you're more likely to find someone who is!

EDIT:  Woohoo, good one, Rolig!  I will add that you can also drop a script into an object to play a sound, as well as the animation that Rolig shows.  That would add the all-important "AH-CHOO!" to the result.

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

I'm not a scripter, but if you ask this question in the Scripting forum, you're more likely to find someone who is!

EDIT:  Woohoo, good one, Rolig!  I will add that you can also drop a script into an object to play a sound, as well as the animation that Rolig shows.  That would add the all-important "AH-CHOO!" to the result.

Share this post


Link to post
Share on other sites
  • 0

Gestures and scripts are different beasts.  If you have an animation that you want to activate at random intervals, you'll probably do best to write a small AO script, pop it into a HUD, and wear it.  It doesn't need to be anything fancy.   Just enough to run a timer and trigger the animation automatically.

This is just off the top of my head and not tested in world, but something like this ought to work ...

integer gStart;default{    on_rez(integer startup)    {        llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION);    }        run_time_permissions(integer perm)    {        if (perm & PERMISSION_TRIGGER_ANIMATION)        {            llSetTimerEvent(30.0);  // Start off with a timer that triggers every 30 seconds....        }    }    timer()        {        if (!gStart) //This starts the animation and lets it run for a couple of seconds....        {            llSetTimerEvent(2.0);            gStart = TRUE;            llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));        }        else    // ... and this stops it and resets the timer for a random time later.        {            llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION,0));            float time = 3600.0 + llFrand(3600.0);  // Change to a random trigger... between 1 and two hours            llSetTimerEvent(time);                        gStart = FALSE;        }    }}

 

  • Like 2

Share this post


Link to post
Share on other sites
  • 0

Well, I disagree with that, at least in part. He asked, "How do I script...?" which says to me "I have a scripting problem". Thanks for your response though, it's great.

Share this post


Link to post
Share on other sites
  • 0

Yeah, you're right, and this one is right on the line. It's hard to answer one like this in the Scripting Forum without presuming a moderate level of scripting ability from the OP, so just saying "write an AO script" wouldn't be much help to a novice. I tend to avoid sending people over there when the best answer is likely to be "Here, have a free script."

Share this post


Link to post
Share on other sites
  • 0

Just to add to Rolig's answer, there's no direct way to play gestures by script in LSL, and the only indirect method I can think of that might work -- present the user with a dialog menu that says the trigger on a channel the gesture is listening on -- wouldn't be appropriate here (I'm not even sure it would work).

Share this post


Link to post
Share on other sites
  • 0

Yes there is no direct way to play gestures with script. However, you can trigger script with gestures by triggering the script from text in the [Replace with:] box in the gesture. An example is the commonly used hug script. This script is triggered when a user wearing the scripted object types '/hug username'. There is a gesture called huggie which is triggered when the user types '/huggie?' . Take this gesture and put '/hug' in the [Replace with:] box. Now if you type '/huggie? username' the /huggie? will trigger the gesture and the gesture will change this to /hug which will then trigger the script. username will then be read and the script will run as if you typed /hug username.

Note: changing the gesture trigger to /hug same as the script trigger will not work because the gesture will take the /hug out of chat before the script can see it. So you must use the gesture [Replace with:] box

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...