Page 1 of 2

Extracting a map from .are files.

Posted: Mon Sep 07, 2020 4:21 am
by MoonDoggie
Hello friends,
I've got a quick question.

I'm running a vanilla rom2.4 mud for some friends and I figured, I'd give them a map of the game. Since I have all of the .are files I figured I'd parse them and lift them up to json or xml, which is done. I'll release the source code if anyone else is parsing .are file or wants to auto generate a map for their players.

Here's the lifted and parsed .are file preview
SNAG-0704.jpg
But now I'm having tremendous trouble trying to get mudlet to display a custom (tiny) map and I hand make.

Here's my 3 room map with connected exits. Nothing fancy. I save this as custom_map.xml, and load it with mudlet

Code: Select all

<?xml version="1.0"?>
<map>
<areas>
   <area id="1" name="Mud School" x="0" y="0" />
</areas>
<rooms>
   <room id="3700" area="1" title="Entrance to Mud School" environment="1" important="1" color="#ff0000">
      <coord x="0" y="0" z="0" />
      <exit direction="north" target="3757" />
      <exit direction="down" target="3001" />
   </room>
   <room id="3757" area="1" title="A Room in Mud School" environment="1">
      <coord x="0" y="5" z="0" />
      <exit direction="south" target="3700" />
   </room>
   <room id="3001" area="1" title="The Temple of Mota" environment="1">
      <coord x="0" y="0" z="-1" />
      <exit direction="up" target="3700" />
   </room>   
</rooms>
<environments>
   <environment id="1" name="School" color="2" htmlcolor="#00B300" />
</environments>
</map>
I get these ALERTs when loading this map. The map doesn't load.
SNAG-0706.jpg
Also, let's say it does load, how does mudlet know to follow what room I'm in? Do I need a lua script to go with it?

Can anyone give me some direction?

Many thanks,
Moon

Re: Extracting a map from .are files.

Posted: Mon Sep 07, 2020 5:31 am
by breakone9r
Yes. you do need scripts for the mapper to work. Either via triggers, or via gmcp events.

the script will determine the room the player is in.

type this to see if it actually did import the map, just isnt showint it because it doesnt know where you are.

lua centerview(3700)

This will tell mudlet that you are in room 3700.

Note that without coordinates, all rooms will sit at 0,0,0 and be stacked on top of each other.

Re: Extracting a map from .are files.

Posted: Tue Sep 08, 2020 1:07 am
by MoonDoggie
Thanks for your response breakone9r. I'll check that out this evening. Is there any reference for creating the lua script to know how to track what room the user is in? I know there's a generic mapper, but seeing as I have the map I don't think I need it.

Re: Extracting a map from .are files.

Posted: Tue Sep 08, 2020 6:04 am
by MoonDoggie
Here's tonight's update.

Parsed .are files to json
Then converted to xml in the format Imperian uses.

I bring you, Merc mud school.
SNAG-0714.jpg

Re: Extracting a map from .are files.

Posted: Tue Sep 08, 2020 7:37 am
by MoonDoggie
I gotta say this is incredibly difficult to navigate the wiki for lua functions.

I've been staring at the docs for quite a while and can't make much sense of where to start. Dissecting other's scripts has helped a bit.

What I need is simple:

1. Capture the text after a user types a command
2. Regex for the room number
3. Find the room vnum on the map and center it.

I'll be damned if I can figure out how to get the Mud's output buffer.

I've found onNewRoom, which (I believe is because I have the generic mapper installed, it's not a base callback?). I've also found onNewLine, but the line text doesn't come in as an argument to it at all.

What am I missing?

Re: Extracting a map from .are files.

Posted: Tue Sep 08, 2020 8:14 am
by Vadi
Check out how to make triggers in Mudlet, I suspect this is what you're missing: https://wiki.mudlet.org/w/Manual:Introduction#Triggers :)

Re: Extracting a map from .are files.

Posted: Tue Sep 08, 2020 3:46 pm
by MoonDoggie
Vadi wrote:
Tue Sep 08, 2020 8:14 am
Check out how to make triggers in Mudlet, I suspect this is what you're missing: https://wiki.mudlet.org/w/Manual:Introduction#Triggers :)
I've spent all my time in the scripts panel that I didn't check others. I'll check this out when I get back to this tonight. Thanks for the information! :)

Re: Extracting a map from .are files.

Posted: Wed Sep 09, 2020 7:48 pm
by MoonDoggie
Thanks to all who posted here! I got it all working together last night.

Combining a trigger to parse the room vnum and a script, it's easy to follow the generated rom maps parsed from .are files.

Just a couple more little issues (like rooms stacked on top of each other) and I'll release the source code.

Best,
Moon

Re: Extracting a map from .are files.

Posted: Thu Sep 10, 2020 6:49 am
by Vadi
Excellent! Looking forward to it.

Re: Extracting a map from .are files.

Posted: Sat Sep 19, 2020 1:23 pm
by SlySven
For the record Mudlet's XML map file parser will ignore the "important" and "color" attributes of the <room ...> elements and, currently, the "htlmcolor" of the <environment ...> ones!