Page 1 of 1

Wait for something within a for loop

Posted: Fri Apr 26, 2013 10:00 am
by Scardon
I currently have a situation where I am running through a for loop which iterates through a list of rooms in an area.
I have set various temp triggers which would run functions to confirm if the room is the correct room after going into it.

With the triggers created and waiting while the character is moving to the first room, the for loop is still running, thus causing it to run to the 2nd room. Is there a solution to this? Is there a way to pause after the first iteration and let the triggers do their thing and continue the iteration afterwards?

Re: Wait for something within a for loop

Posted: Fri Apr 26, 2013 1:49 pm
by Jor'Mox
You can't use a for loop for that, you need to set up an iterating function instead. Your for loop will run from start to finish before any of your triggers ever gets anything, so you need to set up a trigger, then wait. When it triggers, call your iterating function to set things up for the next thing you are waiting for.

Re: Wait for something within a for loop

Posted: Fri Apr 26, 2013 6:04 pm
by Scardon
If that is the case, I will still need to setup a busy wait for the case you have mention?

Currently, with a busy wait, mudlet just hang and I would have to force quit it.

Re: Wait for something within a for loop

Posted: Fri Apr 26, 2013 6:06 pm
by Jor'Mox
No, there is no waiting.

You call the iterator function the first time, and it sets up things for your triggers and then ends.
The triggers get triggered and call the iterator function, which makes it set things up for the next thing you are waiting for.

The triggers act in the place of any sort of waiting function.

Re: Wait for something within a for loop

Posted: Fri May 03, 2013 7:14 am
by Delrayne
if you are using vadi's mapper try if (not mmp.autowalking) then do "this stuff" end