Generic Mapper Additions

From Mudlet
Jump to navigation Jump to search

This is a collection of triggers for the generic mapper script that are too dangerous to be enabled for all games and should only be added on a per-game basis. Eventually we'd like to add the to the generic mapper script when it's able to enable patterns on a per-game basis.

3 Kingdoms / 3 Scapes 3000 / 3200

You can create a color trigger to capture room name and exits.

First choose the color ingame with setcolor room_short <color>, it can be any color as long as it's used only for this and doesn't match any other color *exactly*. To see the list of colors ingame type ansi colors.

Next disable English Exits Trigger under generic_mapper > English Trigger Group

Next create a new trigger group and add two items to it, room name and room exits.

  • room name
    • choose color trigger and set foreground color to the one you set ingame
    • paste = matches[1]

in the Lua code field.

You will have to create one for exits as well since sometimes they span over multiple lines and fail to get captured.

  • room exits
    • choose color trigger and set foreground color to the same color as room name
    • paste
mystring = matches[1]
map.prompt.exits = mystring:gsub([[.+%((.+)%).+]], "%1")

in the Lua code field.

You will have to add a bunch of triggers to English Failed Move Trigger under generic_mapper > English Trigger Group as well.

.+ only .+ may go in there.$
^You must be .+ to (?:pass|enter).*$
.+ won't let you go .*.$
^You can't head .*.$
^Sorry, but you must be .*.$
^You bump into the .+ (?:door|gate).$
^You are too .+ to (?:enter|pass).*.$
^A locked .* blocks your passage .*.$
^You jump back .*.$
.+ you .+ come back.$

There's probably a lot more...


This section is for MUDs that share a resemblance with the below.

Balcony outside the Council Hall
You can see by the light of a torch you carry.
You stand on a wooden balcony, high in the tree tops, overlooking a small village of markets. You
cannot help but notice that there are no houses, helping to emphasise that this is somewhere that
people gather only, not somewhere that they live. The balcony itself forms the front of the Council
Hall, a wooden platform extending out from the south wall, a wide doorway leading inside the
hall. A low fence of wood and rope surrounds the platform on the three open sides, limiting any chance
of you falling off. A gap in the fence to your south provides access to a rope bridge linking
the balcony to a large wooden platform suspended in the branches of several trees. From this vantage
point you could no doubt be heard by anyone standing on that platform, almost as if you were
standing amongst them.
A brown leather tome lies here, grey writing across its cover reading "The Ways of the Clans of
Ysallyra". There are two clan warriors of Ysallyra here.
You can progress north (a closed door), east (an open door), south (a closed door) and down.
3120/3120h 390/390m 34xp >


The first thing that you will need to do is capture your prompt, this can be done with the following command:

map prompt %d+/%d+h %d+/%d+m %d+xp >

Additionally, there is an Ingame command that ensures that room exits will always start on a new line, I highly recommend enabling this as it assists the mapper significantly:

display room line


The English Exits Trigger in English Trigger group contains a lot of lines that we don't really need, the following capture line is all that we need to capture basic exits:

You can progress (.*)\.

Slightly More complicated is when there are a lot of exits and they spill over to another line. The existing Multiline Exits Trigger is not relevant to us, I simply have it disabled. So, we have to make our own that looks like the following:

You can progress(.*\s.*[^.])                                  (perl regex line)
1                                                             (line spacer)
(.*)\.                                                        (perl regex line)

With the code:

local roomExits = string.trim(multimatches[1][2]) .. " " .. string.trim(multimatches[3][1])
raiseEvent("onNewRoom",roomExits or "")

With those two triggers, you should be set to start mapping.


Make a new trigger with this perl regex pattern:

^\s*\[\s*Видимые выходы:\s*(.*)\]

that does this:

raiseEvent("onNewRoom",matches[2] or "")

Then enter the following in the input line:

map translate north север с
map translate south юг ю
map translate east восток в
map translate west запад з
map translate up вверх вв
map translate down вниз вн

That's it! Now you can do start mapping my_first_area.

Ashes to Ashes/Alternate Illusions

This is for muds with multiline exits similar below:

Temple of Midgaard
   You are in the southern end of the temple hall in the Temple of Midgaard.
The temple has been constructed from giant marble blocks, eternal in
appearance, and most of the walls are covered by ancient wall paintings
picturing Gods, Giants and peasants.
   Large steps lead down through the grand temple gate, descending the huge
mound upon which the temple is built and ends on the temple square below.
To the west, you see the Reading Room.  The donation room is in a small
alcove to your east.
An automatic teller machine has been installed in the wall here.
An announcement board is mounted on the wall here.
Obvious exits:
North - By the Temple Altar
East  - Midgaard Donation Room
South - The Temple Square
West  - The Reading Room
Down  - The ABC's of Ashes to Ashes

Astana 498/498hp 1105/1105m 139/139v 0xp 0%>

Here are the steps:

  • On the generic_mapper -> English Trigger Group, disable the English Exits Trigger
  • There's a disabled English Multi-Line Exits Trigger under the same folder. Copy and paste it outside the generic_mapper folder.
  • Change the trigger filter regex of English Multi-Line Exits Trigger to ^Obvious exits:
  • On the next item Exit Line Trigger, change the regex to ^([\w\s]+)\s*\-\s[\w ']+
  • We want to raise an event of onNewRoom when we're done capturing all the room exits:
    • add a new item after Exit Line Trigger and add a regex filter ^$
    • put the call raiseEvent("onNewRoom",matches[2] or "") on the new item

Avatar Mud

Create a new script called SetGMCPRoomName

Add User Event Handler: gmcp.Room.Info

function setGMCPRoomName() -- MUST match the 'name' above
  -- if map.getRoomAreaName ~= then
    -- map.set_area(
  -- end =
  map.prompt.exits = table.concat(table.keys(gmcp.Room.Info.exits), " ")

That's it :) map away! Will update if any more things need to be tweaked - Added by Whiteheat - 9 April 2021

Brutália 4444

Make a new trigger, with this perl regex pattern:

^.+kijáratot látsz: (.*)\.$

That does this:

raiseEvent("onNewRoom",matches[2] or "")

Then add another trigger perl regex pattern:

Nem mehetsz abba az iranyba.

That does this:


Then, enter the following to the input line:

map translate north észak e
map translate south dél d
map translate east kelet k
map translate west nyugat n
map translate northwest északnyugat en
map translate northeast északkelet ek
map translate southwest délnyugat dn
map translate southeast délkelet dk
map translate up fel fe
map translate down le le
map translate out ki ki 
map translate in be be

Now you can do start mapping my first area.


Find the "English Trigger Group" in the generic_mapper package. Disable it.

Create a new trigger called "Room Name Trigger". Use the pattern ^\[(.*)\] \(.*\).*? and set it to perl regex.

In the large script box, enter = matches[2].

Create a new trigger called "Room Exits Trigger". This trigger has two patterns.

Pattern 1: ^Obvious (?:paths|exits):\s+(.*?), (?:an?|the|\.) . Perl regex.

Pattern 2: ^Obvious (?:paths|exits):\s+(.*(?:north|south|east|west|out))\. . Perl regex.

Into the script box: map.prompt.exits = string.gsub(matches[2], "'", "") .

Remember to make sure the "English Trigger Group" is disabled again if the package needs updating.

Federation2 30003

Create a new script called gotRoomInfo

function gotRoomInfo(event, ...) =
  map.prompt.exits = table.concat(table.keys(, " ")
  map.prompt.hash = string.format("%s %s %d",,,
  if map.mapping then

registerAnonymousEventHandler("", "gotRoomInfo")

In game type echo ... It is the closest thing to a prompt you will find

Next type find prompt

English Failed Move Trigger ---> You will need to add lines for failed moves "there is a lot of them".

English Forced Move Trigger ---> Will need lines added as well. "Very important" or it will trash your map.

Now you can do start mapping

Kingdoms of the Lost 2222

exit lines:

[inside: south->closed]

[field: north->closed *east *south->open west]

[field: *east west]

[city(very bright): north east south west up northwest]

regex for the above: \[.+: (.+)\] (regex101)


Add this pattern to Triggers->generic_Mapper->English Trigger Group->English Exit Triggers


and add to the LUA code ABOVE the existing line: if (matches[2]) then matches[2] = matches[2]:gsub("."," %0"):sub(2) end

Now you can do start mapping my first area.

Realm of Magic

This is for muds that look like below:

RealmofMagic Room display.png
A Peaceful Inn [ D ]
  The inn seems to be strong and finely built with many plaques and tapestries
adorning the walls. On either side of the inn there are very large delicately
crafted glass windows that look out onto the rest of Entrancity. You see a
dark, cherry wood desk sitting near the back of the northern wall. The desk is
cluttered with paperwork and many different types of writing tools.
There is a sign on top of the desk written in gold that should be 'read'.
There is a book with QUESTS on the cover, you should read the quests book.
An automatic teller machine has been installed in the wall here.
Anthony the wise is sitting at a table.
His eyes shine in a soft blue!
Janet the Innkeep is leaning on the front desk.
|572H 625M 582V >

It also adds the ability to save doornames for doors, and changes the speedwalk mapper function to use doornames and modifies the door open/unlock string to match the command syntax expected for this server. (ie open <doorname> <direction>)


In the generic_mapper trigger group, disable all language groups

Create a new trigger group for your mapping triggers (so they don't get deleted on generic_mapper package updates), and create the following (numbered) triggers:

  1. Trigger has two patterns. The first is a color pattern with the foreground color being ANSI 6 (Cyan). The second pattern is Regex: ^(.*?) (?:\(#\d+\) )?(?:\[ .*? ?\] )?\[ ?((?:\(?[NESWUD]\)?\s?)*)\] ?(?:Home: \d+)?$ This should match for both mortals and immortals. The script for this trigger:
    if not map.prompt.name_found then
      map.prompt.name_found = true = multimatches[2][2]
      map.prompt.exits = string.gsub(multimatches[2][3], "%(%a%)%s?", "") --remove doors so unmapped playerhomes or unmapped doors don't mess up the map/following when immortal
  2. Trigger is just a regex match: ^\|(-?)(\d+)H (\d+)M (\d+)V (.*)>$ with the script:
    if map.prompt.name_found then
      map.prompt.name_found = false
      --The onPrompt event called above raises "onNewRoom" when exits are found. 
      --The following block will catch the infrequent rooms found with no listed exits.
      if map.prompt.exits == "" then
      --Whem onRandomMove event wasn't following reliably, the below block was created to force 
      --the map to reorient its position after certain actions (entering portals, fleeing from combat, etc).
      if map.prompt.user_portaled then
        map.prompt.user_portaled = nil
  3. Trigger that matches the following lines and throws the onMoveFail event:
    1. Start of Line: As you step on something very slippery, you lose your
    2. Regex: ^(.*) seems to be closed.$
    3. Exact Match: Maybe you should get on your feet first?
    4. Exact Match: Alas, you cannot go that way...
    5. Exact Match: You would have to fly to go there!
    6. Exact Match: You need a boat or be able to swim to go there.
    7. Exact Match: That place is already full!
    8. Exact Match: No way! You're fighting for your life!
    9. Regex: ^There is no (.*) here.$
  4. Trigger that exact matches: It is pitch black... and throws the onVisionFail event:
  5. Trigger that exact matches the following lines and scripted to set the map.prompt.user_portaled variable. (tried to use the onRandomMove event, but it wasn't as reliable)
    1. You enter the portal.
    2. You flee head over heels.
    3. You skillfully retreat from battle.
      map.prompt.user_portaled = true


Next, create an alias. Pattern is: ^add doorname (\w+) (north|south|east|west|up|down|n|s|e|w|u|d)$ and the script is:

map.add_doorName(matches[2], matches[3])


Create a new script to add new mapping functions with the following code:

function map.add_doorName(name, dir)
  if map.mapping then
    name = name or ""
    dir = dir or ""
    if (name == "") or (dir == "") then return end
    local exits = {
      north = "north", south = "south", east = "east", 
      west = "west", up = "up", down = "down",
      n = "north", s = "south", e = "east",
      w = "west", u = "up", d = "down" }
    dir = string.lower(dir)
    if not exits[dir] then return end
    local dataKey = "doorname_"..exits[dir]
    name = string.lower(name)
    if name == "door" then
      clearRoomUserDataItem(map.currentRoom, dataKey)
      setRoomUserData(map.currentRoom, dataKey, name)
    map.echo("Added "" as a doorname for "..dataKey.." in roomID: "
    map.echo("Not mapping",false,true)

function map.get_doorName(roomID, dir)
  local doorkey = "doorname_"..dir
  local doorname = getRoomUserData(roomID, doorkey)
  if doorname == "" then doorname = "door" end
  return doorname           

In generic_mapper>Map Script, edit the following if code block at the listed lines to make use of the door names/change the unlock/open syntax to match the mud's command syntax.

2223            if status and status > 1 then
2224                 local doorname = map.get_doorName(id, (exitmap[dir] or dir))
2225                 -- if locked, unlock door
2226                 if status == 3 then
2227                     table.insert(walkPath,k,id)
2228                     table.insert(walkDirs,k,"unlock " .. doorname .. " " .. (exitmap[dir] or dir))
2229                     k = k + 1
2230                 end
2231                 -- if closed, open door
2232                 table.insert(walkPath,k,id)
2233                 table.insert(walkDirs,k,"open " .. doorname .. " " .. (exitmap[dir] or dir))
2234                 k = k + 1
2235             end


As you're mapping, if you come across a door that's not named "door" (ie "gate" or "trapdoor" or even "doors"), use the command add doorname <name> <direction> to add that data to the map's roomUserData. When speedwalking with the map, the script will use this name to unlock locked doors, and open doors. You don't need to add doors named "door" because the mapper will default to using that name if no name was added with the command. This command must be used on both "sides" of the door, as each side can contain different doornames.

Reinos de Leyenda

map translate north norte n
map translate south sur s
map translate east este e
map translate west oeste w
map translate northwest noroeste no
map translate northeast noreste ne
map translate southwest suroeste so
map translate southeast sureste se
map translate up arriba ar
map translate down abajo ab
map translate out fuera fu
map translate in dentro de

-- ensure normal prompt is setup in the game that matches this exactly, include the space in the end of the pattern:
map prompt ^PV: %d+/%d+ GP: %d+/%d+;


Disable the in-game line wrapping and let Mudlet do it for you instead - this'll help the mapper recognize exits that span over the course of two lines. You can do it with the in-game command: set WIDTH 150

This breaks formatting on some menus like show skills, set it back when needed.

You should also setup some patterns to ignore to make sure the mapper doesn't get confused when you're not actually moving:

map ignore .+ follows .+
map ignore .+ starts using .+
map ignore .+ arrives from .+
map ignore .+ images of .+

If the game fails to capture room names because you get enviroment/flavor/etc lines after move command and before room name you can create a color trigger to capture them.

Start by setting the color ingame with color roomshort <color>, it can be any color as long as it's used only for this and doesn't match any other color *exactly*. To see the list of colors ingame type color display.

Next create a new trigger, room name.

  • Set it to color trigger and match foreground color with the one you chose ingame.
  • Paste = matches[1] in the Lua code field.

The Two Towers


Regex pattern for English Exits Trigger: ^(\X+)\(([\w\s,]+)\)\s*\[?([\w\s,]*)\]?

Lua code for trigger - FYI, the RGB colors are to help with room name detection. For the ones shown, I have the color for my room_shorts set to bright yellow. In the code below, you'll notice I excluded the room "Near a guard flet." That's because this room is inserted randomly at intervals into the Lothlorien area. I set the room names for all rooms that were shown as either Lothlorien or Near a guard flet to "Lothlorien" and then adjusted these triggers to account for them changing names.

Also, add ^Near a guard flet -- regex -- to the English Vision Fail Trigger.

local dirs = {n = 'north', s = 'south', w = 'west', e = 'east', d = 'down', u = 'up', ne = 'northeast', nw = 'northwest', se = 'southeast', sw = 'southwest', enter = 'enter', out = 'out'}
local exits, found_exits
local combined = matches[3]

local r,g,b = getFgColor() 
if r == 255 and g == 255 and b == 0 then
    for w in combined:gmatch("%a+") do
        if dirs[w] then
            found_exits = true
            if not exits then
              exits = dirs[w]
              exits = exits .. " " .. dirs[w]
            if not exits then
                exits = w
                exits = exits .. " " .. w

  if found_exits and matches[2] ~= "Near a guard flet" then
          map.prompt.exits = exits
 = matches[2]

You can create a trigger using the same regex pattern as above to show you the rgb values for whatever color you have your room_short set to.

local r,g,b = getFgColor()
cecho("\nred " ..r.. " green " ..g.. " blue "..b)