Useful Mapper Things

Share your scripts and packages with other Mudlet users.
Post Reply
User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Useful Mapper Things

Post by chris »

Here are some ways I've dealt with unique scenarios with automovement:

Delayed movements (such as waiting for a ship to arrive):

alias:
^tmap pauseUntil "(.+)" (.+)$

code:
Code: [show] | [select all] lua
setRoomUserData(tmap.lastId, "exitScript"..matches[2], "tmap.moveStop=1;tempTrigger("..matches[3]..", [[tmap.moveStop=nil;speedWalkPath = tmap.roomsToWalk;doSpeedWalk()]],true)")
In my speedwalking script, each direction checks an exitScript, which is this code:
Code: [show] | [select all] lua
function tmap:checkExitScript(room, dir)
	local exitScript = getRoomUserData(room, "exitScript"..dir)
	if exitScript ~= "" then
			assert(loadstring(exitScript)) ()
	end
end
The moveStop=1 causes my speedwalker to stall, the tempTrigger part triggers the action to continue walking such as "A large ship sails in" on which the direction "board ship" will be launched. Similarly the exit "disembark ship" will pause the mapper until the message indicating we've landed has been seen.

Non-standard room entrances
For instances where the room description isn't shown normally (like teleporters sometimes) your mapper can go out of sync. Here's how I've dealt with this:

alias:
^tmap automove "(.+)" .+$

use it like:
tmap automove "enter chamber" You try to enter the chamber, but a trap door opens, sending you spiraling into darkness!

This once again makes use of the exitScript function
script:
Code: [show] | [select all] lua
setRoomUserData(tmap.lastId, "exitScript"..matches[2], "tempTrigger("..matches[3]..", [[tmap:onFollow(nil)]],true)")
tmap:onFollow(nil) is my way of saying go to the next room in the speedwalker queue

Mapping temporary areas

This is simple, for my map toggle I set an extra flag, "tempRoom" to the userdata. An alias, tmap delTemp then searches for all rooms with this flag, and deletes them.

Mapper "Favorites"

This post shows you how to setup a right click menu on your mapper to assist in speedwalking/marking rooms of significance

http://forums.mudlet.org/viewtopic.php?f=6&t=2739

Daagar
Posts: 89
Joined: Fri Feb 19, 2010 2:42 am

Re: Useful Mapper Things

Post by Daagar »

Very useful, both as code examples and as general documentation to your scripts. I would consider adding this information to your github page as well as I don't think I even realized some of this functionality had shown up!

User avatar
Vadi
Posts: 5050
Joined: Sat Mar 14, 2009 3:13 pm

Re: Useful Mapper Things

Post by Vadi »

I think this would do very well in the new http://wiki.mudlet.org/w/Manual:Mapper page as well, which is part of the manual.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Useful Mapper Things

Post by chris »

I can toss it up there, I'm interested in what other approaches people have taken for this problem and other scenarios.

Post Reply