Jump to content

Listen in order


Tighern McDonnell
 Share

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

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

Recommended Posts

Having a hard time wraping my head around how to script this...

I have three separate objects that need to be used in order to talk to one object. each one will use llWhisper on the same channel. the message is different for each one. I need to make the main object listen for each command. once step one is done then it needs to listen for step two and then step three. If a different object is used or the items are used out of order it needs to "error out" (make a different effect)

Link to comment
Share on other sites

You need to keep track of which step you're on. You need to test for the correct message and then advance step if true. You need to reset the step you're on when an incorrect message is received. You need to trigger the ultimate effect when step three is complete.

So you'll need something like this in your listen event:

integer step;

if(step == 3 ) DoTheThing();

if(step == 2 && message == "step3") ++step;

if(step == 1 && message == "step2") ++step;

if(step == 0 && message == "step1") ++step;

else step = 0;

You'll probably want to initialize step to zero outside of the listen event as a global so it doesn't get reset each time there's a received message. 

 

 

Edit: forgot to mention some caveats

Edited by Myrmidon Hasp
Link to comment
Share on other sites

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