Generic mapper tutorial

From Mudlet
Jump to navigation Jump to search

What is generic_mapper?

generic_mapper is a package that comes preinstalled on all Mudlet profiles. It tries to draw a map by guessing most of the information from your game. Even if generic_mapper does not 100% grasp your specific game details, you can likely tweak a few triggers and have a fully functioning mapper.

generic_mapper does not keep information about objects in room, monsters or room descriptions. Although this information can be stored later once you become more familiar with the basics.

Related topics:

Getting Started

Ensure you have the latest version of generic_mapper package. generic_mapper will prompt whenever it finds a new version though.

 map update

To see a list of generic_mapper commands:

 map help

There are a lot; the mapper is very customisable but we only need to be concerned with a few commands highlighted later to get started.

Importantly, generic_mapper needs three key pieces of information to map your game correctly.

  • room name,
  • room exits,
  • mud prompt.

Find out below how to get generic_mapper looking for those lines.

map basics

map basics is the first command you should run to get generic_mapper working. It will show you which pieces of key information the script is missing to work correctly. These are marked with a red X.

example map basics output

In this case above, generic_mapper could not find the room name nor the room exits. It probably didn't find the prompt either. generic_mapper uses your prompt to know when to segment room information into separate blocks, thus allowing it to search for the key information within that block of room data. Knowing this, let's continue on and get these parts working.

Find Prompt

Check to see if your prompt is being captured. generic_mapper can find some standard prompts automatically.

 find prompt
prompt not found

Unfortunately the first prompt wasn't found automatically, but the one below was.

prompt found successfully!

Fixing Prompt Not Found Errors

map prompt can be used to supply a Lua pattern to generic_mapper that it uses to see if an incoming line from the game is actually your prompt. Lua patterns are similar to Regex patterns (used extensively elsewhere in Mudlet) but with a few minor differences.

To match the failing prompt above, you would issue the following command.

The prompt is

  20hp 100mn 100mv>

so the command to match is

  map prompt %d+hp %d+mn %d+mv>

Further examples;

 20/20hp 100/100mn night>
 %d+/%d+hp %w+>

And the prompt will be set.

Generic mapper tutorial map prompt.png

Note Note: A ^ character gets prepended to your pattern automatically. This character means match the start of a line.

If you are still unsure how to match your prompt, get help on our Discord or forums channels. Even an AI assistant might be able to create one for you.

Map Debug

Using find prompt only does exactly that; it just tries to match the prompt. To see if your new map prompt setting is working turn on map debug. This will show you some useful informational messages on what generic_mapper is doing. Here we can see after entering the correct map prompt command, generic_mapper notifies us that the game prompt was found.

Generic mapper tutorial map debug.png

Now after issuing another look command to the game, we can see from map debug information that generic_mapper found the room name and the exits as well.

Generic mapper tutorial map debug more information.png

Exits not found

generic_mapper searches for exits just like it searches for game prompts. It uses a list of commonly used formats that exits are displayed in games and tries to come up with a match. In the above example the game matched with what generic_mapper was looking for, but had it not found them we would need to supply generic_mapper with the format in which our exits are displayed. This list is held in the trigger section of Mudlet. There are two types of exit triggers; one where all exits are on the same line, and another where a single exit is on another (consecutive) line.

Single line exits might look like this;

  [Exits: north east south west]

Multi-line exits might look like this;

  Obvious exits;
  North - The Baker
  South - The Butcher
  East - Main Street

You need to edit the correct trigger section for the exit detection to work properly.

Here you can see the single line exits displayed in the trigger editor.

Generic mapper tutorial single line trigger exits.png

Note Note: It is best practice to copy this trigger and paste it into another one outside of the generic_package script area. Otherwise when generic_mapper performs an update, it will override any custom changes you have made.

Write your new regex pattern into the trigger lines so that it matches the format in which your game displays the room exits. There are some game examples found here with both single and multi-line exits for further guidance.

Turn on map debug and perform a movement command or look, the game should find your exits. Perform a map basics once again to check.

Generic mapper tutorial map basics working.png

Start Mapping

Once the three key pieces of information are found you are ready to start drawing your map. Display the mapper window from the toolbox (or Alt+M, it will likely be blank to start. Find the name of the area your player is in, or make something up if you're not sure, you can always rename it later. Now issue the start mapping command along with that area name.

 start mapping Mud School
Generic mapper tutorial start mapping.png

Slowly start walking around the area, generic_mapper will attempt to create new rooms and follow you as you move. stop mapping to turn off new room creation.

Generic mapper tutorial mapper working .png

At this point you can turn off map debug and enjoy exploring and mapping your MUD!

Further Tweaks

You may notice generic_mapper gets confused sometimes. Like when you get hungry right after performing a move command and the new room name becomes You are hungry. This is because generic_mapper gets the first incoming line after performing a move command and sets it as the room name. See map help ignore for details on how to prevent this and make your mapper more resilient.