Jump to content
Sign in to follow this  
Cindy Kraai

llStartTimerEvent triggered by two different commands?

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");
    }
}

 

Share this post


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

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
Reply to this topic...

×   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...