Mudlet Mapper - wait for pathing complete

Post Reply
Metho
Posts: 14
Joined: Wed Sep 16, 2009 10:20 pm

Mudlet Mapper - wait for pathing complete

Post 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!

User avatar
Belgarath
Posts: 232
Joined: Fri Jul 26, 2013 7:19 am
Discord: macjabeth#7149

Re: Mudlet Mapper - wait for pathing complete

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

Metho
Posts: 14
Joined: Wed Sep 16, 2009 10:20 pm

Re: Mudlet Mapper - wait for pathing complete

Post 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?

Metho
Posts: 14
Joined: Wed Sep 16, 2009 10:20 pm

Re: Mudlet Mapper - wait for pathing complete

Post by Metho »

Figured this out. Thanks again for your help.

Post Reply