Page 1 of 1

Mudlet Mapper - wait for pathing complete

Posted: Wed Jun 17, 2015 1:31 am
by Metho
Hello,

I'm having trouble with what is probably simple. I have an array with three room ids. I want to path to the room, perform an action, then path to the next. My problem is that my for loop doesn't wait for pathing completion. I thought if I used the mapper goto alias that it would complete that function before going onto the next command in my for loop, but it doesn't. How can I have it path, wait for path completion, then continue in the loop?
Code: [show] | [select all] lua
rms = {15400, 5710, 5713}

for i, rmid in ipairs(rms) do
	expandAlias("goto " .. rmid)
   send("turn knob")
end
Thanks for any help or insight!

Re: Mudlet Mapper - wait for pathing complete

Posted: Wed Jun 17, 2015 10:26 am
by Belgarath
It would require a bit more scripting on your part, but I think the easiest method would be to use the mmapper arrived event. You could change your table to:
Code: [show] | [select all] lua
{
  { id = 15400, action = "turn knob" },
  -- etc.
}
This way you can check whether the table is empty, or move on to the next location.

Re: Mudlet Mapper - wait for pathing complete

Posted: Wed Jun 17, 2015 6:39 pm
by Metho
I'm not really familiar with events. So I have to create a script, let's say doThisPath and attach the mmapper arrived event to it. Then in the script I would check the table, if not empty execute the next goto, remove from the table, and repeat? Where would I set the table initially? Won't this fire everything mmapper arrived is broadcast? So if I was doing a regular speed walk, it would activate this script unintentionally?

Re: Mudlet Mapper - wait for pathing complete

Posted: Thu Jun 18, 2015 2:12 pm
by Metho
Figured this out. Thanks again for your help.