Jump to content

llStartTimerEvent triggered by two different commands?


Cindy Kraai
 Share

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

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

Recommended Posts

I basically want to have a timer script that will only start if triggered by two other script, like it won't start until both commands are given. My question is, is it possible, if yes please give me an idea.

//TimerEvent
default { state_entry() { llListen(1, "", NULL_KEY, ""); } listen( integer channel, string name, key id, string message ) { if(/*waits for command one & two to start*/) { llSetTimerEvent(10); } } timer() { //start event } }
//Command 1
default
{
    touch_start(integer total_number)
    {
        llSay(1,"command one");
    }
}
//Command 2
default
{
    touch_start(integer total_number)
    {
        llSay(1,"command two");
    }
}

 

Link to comment
Share on other sites

Try saving the responses to two seperate variables in the timer script and using their data to verify if the timer function should be called.

integer seen_CommandOne = FALSE;integer seen_CommandTwo = FALSE;default{    state_entry()    {        llListen(1, "", "", "");    }    listen( integer channel, string name, key id, string message )    {        if(message == "command one") seen_CommandOne = TRUE;        else if(message == "command two") seen)CommandTwo = TRUE;        if(seen_CommandOne == TRUE && seen_CommandTwo == TRUE)        {            llSetTimerEvent(10);        }    }    timer()    {        //start event    }}

You can always reset the "seen_*" variables to both FALSE again whenever you wish to open the script to be triggered again (possibly at the end of the timer event).

 

Hope this helps.

  • Like 1
Link to comment
Share on other sites

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