Difference between revisions of "Generic Mapper Additions"

From Mudlet
Jump to navigation Jump to search
(syntaxhighlight needs a lang parameter)
(Added info for t2t mud)
Line 194: Line 194:
 
  map ignore .+ arrives from .+
 
  map ignore .+ arrives from .+
 
  map ignore .+ images of .+
 
  map ignore .+ images of .+
 +
 +
== The Two Towers ==
 +
Host: t2tmud.org:9999
 +
 +
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. <syntaxhighlight lang="lua">
 +
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]
 +
 +
selectCurrentLine()
 +
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]
 +
            else
 +
              exits = exits .. " " .. dirs[w]
 +
            end
 +
         
 +
        else
 +
            found_exits=true
 +
            if not exits then
 +
                exits = w
 +
            else
 +
                exits = exits .. " " .. w
 +
            end
 +
        end
 +
  end
 +
 +
  if found_exits and matches[2] ~= "Near a guard flet" then
 +
          map.prompt.exits = exits
 +
          map.prompt.room = matches[2]
 +
          cecho(matches[2])
 +
          raiseEvent("onNewRoom")
 +
          print(map.prompt.exits)
 +
  end
 +
end
 +
</syntaxhighlight>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.<syntaxhighlight lang="lua">
 +
selectCurrentLine()
 +
local r,g,b = getFgColor()
 +
cecho("\nred " ..r.. " green " ..g.. " blue "..b)
 +
deselect()
 +
</syntaxhighlight>

Revision as of 17:39, 9 October 2021

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.

Ashes to Ashes/Alternate Illusions

timetoplaythegame.com:3333

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

avatar.outland.org:3000

Create a new script called SetGMCPRoomName

Add User Event Handler: gmcp.Room.Info

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

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

Kingdoms of the Lost

kotl.org: 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)

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+;

Aladon

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.

Federation2

play.federation2.com: 30003

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

[Ee]xits:\s(.*)

Define the prompt byː

map prompt You can see %.+ exits:


Now you can do start mapping my first area.


Brutália

telnetbrutalia2.avantek.hu 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:

raiseEvent("onMoveFail")

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.

MysticalMud

mysticalmud.org:5000

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

^\[Exits:\s*(.*)\]

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.

RetroMUD

retromud.org:3000

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

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 .+

The Two Towers

Host: t2tmud.org:9999

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]

selectCurrentLine()
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]
            else
              exits = exits .. " " .. dirs[w]
            end
           
        else 
            found_exits=true
            if not exits then
                exits = w
            else
                exits = exits .. " " .. w
            end
        end
  end

  if found_exits and matches[2] ~= "Near a guard flet" then
          map.prompt.exits = exits
          map.prompt.room = matches[2]
          cecho(matches[2])
          raiseEvent("onNewRoom")
          print(map.prompt.exits)
  end
end

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.

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