Capturing the in-game map with mudlet

by Unknown

Back to Mechanic's Corner.

Unknown2010-01-02 01:09:40
So there are lots of map capture scripts for various muds and mudlet out there, but Lusternia's in-game maps were particularly hard to capture because the start and end of the maps can vary so much. After quite a bit of work though, I seem to have gotten the regex patterns that will correctly capture every possible combination without doing things like re-routing the main window text into the map window after you get a pattern that doesn't fit.

For those who don't know the most common way to capture a map with mudlet yet, it goes like this:
1. Make a regex trigger to capture all text on a new line and name it something like "Map Cap".
2. Make a second trigger that turns the trigger "Map Cap" on. This will start capturing your map. This trigger should also paste the line that it fires off of to the map window, otherwise you won't see the top most line in there.
3. Make a third trigger that turrns the trigger "Map Cap" off. This will end the map capture.

The above isn't too hard, but getting the regex patterns correct was a cruel pilgrimage. Here are the patterns you'll want, however:

Capture start:
^+(\\s) (perl regex)

--- Area: (begin of line substring)

Capture end:
^+(\\d) (perl regex, this will capture lines that start with -'s and have a number, but not if the number is preceeded by a v, like v2435).

^---(\\s)(?:(?!Area (\\d)).) (perl regex, this will capture lines that have three -'s and then a word, but won't do so if the word is "Area").

^+(-\\d) (perl regex, this will capture line's that start with -'s and have a number preceeded by another -).

And for those who don't have it, the code to capture text to the map console:
selectCurrentLine();
copy()
appendBuffer("Map")
deleteLine();

And code to activate/deactivate triggers is:
enableTrigger("your trigger name here")
disableTrigger("your trigger name here")

Both of the above are case sensitive.

Regex symbol to capture a new line:
^

Possible pitfalls:
If there were a room where the room name starts with the word "Area", there may still be a problem. I kind of wish that Estarra would consider the in-game mapper's messages and make the start and ends uniform like other mappers have done, because it would make this easier, hint hint :)
Unknown2010-01-02 01:45:59
Treant comes with a plugin to capture the in-game map to a miniwindow in MUSHclient. You could farm code and regex from that. It's proven to work already.
Vadi2010-01-02 03:23:45
I'd recommending adapting my mko map window: http://forums.midkemiaonline.com/index.php?showtopic=569

It handles window resizes, allows custom font sizes and such. Xml is easier to import once too wink.gif
Unknown2010-01-12 07:29:55
QUOTE (Vadi @ Jan 1 2010, 10:23 PM) <{POST_SNAPBACK}>
I'd recommending adapting my mko map window: http://forums.midkemiaonline.com/index.php?showtopic=569

It handles window resizes, allows custom font sizes and such. Xml is easier to import once too wink.gif



the mko map window slots right into lusternia, no problem. I didn't have to change a thing (well, besides positioning for my own tastes)
Unknown2010-01-12 07:51:02
I use this regex pattern which, as far as I've tested, captures every map in Lusternia and doesn't fire on anything else:

CODE
^\\-{3,}.* v\\d+ \\-{3,}$


I could probley make it more specific but I've not seen a need to yet really.

It fires this:

CODE
selectCurrentLine();
copy()
appendBuffer("Map")
deleteLine();


and sends it to a miniconsole named Map.

I love having as few triggers as possible thus I use that trigger and the "Fire Length" option set to 24(since my map height is 5). This means I am capturing my whole map very quickly with only one trigger.
Unknown2010-01-12 08:38:23
QUOTE (SheiaSilverwing @ Jan 12 2010, 02:51 AM) <{POST_SNAPBACK}>
I use this regex pattern which, as far as I've tested, captures every map in Lusternia and doesn't fire on anything else:

CODE
^\\-{3,}.* v\\d+ \\-{3,}$


I could probley make it more specific but I've not seen a need to yet really.

It fires this:

CODE
selectCurrentLine();
copy()
appendBuffer("Map")
deleteLine();


and sends it to a miniconsole named Map.

I love having as few triggers as possible thus I use that trigger and the "Fire Length" option set to 24(since my map height is 5). This means I am capturing my whole map very quickly with only one trigger.



IIRC this is in essence what the mko map module vadi put out does also, though it colors the + that represents where you are on the map to make it easier to see.
Unknown2010-01-12 09:54:36
Ohh! Coloring the + is a good idea, I think I'll do that! Thanks demonnic and Vadi too! laugh.gif
Simimi2010-03-01 16:39:07
Why does vadi's minimap do this?

Or better, how does one correct it such that it does not chop the title off of a room, or gag the room from going through my display upon moving?


EDIT: Oh no! I deleted the script and my screen is stuck this way!
Zallafar2010-03-11 13:44:05
QUOTE (Jello @ Jan 1 2010, 05:09 PM) <{POST_SNAPBACK}>
Capture start:
^+(\\s) (perl regex)

--- Area: (begin of line substring)

Capture end:
^+(\\d) (perl regex, this will capture lines that start with -'s and have a number, but not if the number is preceeded by a v, like v2435).

^---(\\s)(?sad.gif?!Area (\\d)).) (perl regex, this will capture lines that have three -'s and then a word, but won't do so if the word is "Area").

^+(-\\d) (perl regex, this will capture line's that start with -'s and have a number preceeded by another -).

What's this about the word "Area"? When do map I see:

CODE
---------- v19181 -----------
                            
                            
                            
                        
                          |
     --        
\\   /   \\ |   |         /   \\
     --
    \\   / |
-
    /

/
                            
                            
---------- 4:4:-2 -----------

Unknown2010-03-11 13:47:06
Some maps show the name, some don't. Your map is probably just set to a smaller setting, with no room for room/area names.
Zallafar2010-03-11 14:21:41
QUOTE (Zarquan @ Mar 11 2010, 05:47 AM) <{POST_SNAPBACK}>
Some maps show the name, some don't. Your map is probably just set to a smaller setting, with no room for room/area names.

I didn't even know the map had different settings! I see them now, thanks.
Unknown2010-03-13 02:51:46
So I just started adapting Mudlet for my own use, and the map feature is one of the neatest aspects for me. But I don't know how to go about doing this manually, so I tried downloading the .xml file from the MKO link you posted - however the link doesn't appear to be working? I guess I can also just try to follow Jello's instructions in the post. But this way seemed very convenient!
Zallafar2010-03-13 04:44:19
QUOTE (Shou @ Mar 12 2010, 06:51 PM) <{POST_SNAPBACK}>
So I just started adapting Mudlet for my own use, and the map feature is one of the neatest aspects for me. But I don't know how to go about doing this manually, so I tried downloading the .xml file from the MKO link you posted - however the link doesn't appear to be working? I guess I can also just try to follow Jello's instructions in the post. But this way seemed very convenient!

The link works for me. Here's the link within the link to the actual XML file.
Unknown2010-03-13 05:35:28
Ah okay, I was expecting the link to lead to a download, but I need to actual download that link. Got it now - works great!