Jump to content

llStartTimerEvent triggered by two different commands?


You are about to reply to a thread that has been inactive for 1498 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 post
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 post
Share on other sites
You are about to reply to a thread that has been inactive for 1498 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...