Two Towers Mapper modified for SWmud

Posted by Clafoutis on Thu 07 Nov 2019 06:38 PM — 52 posts, 166,604 views.

#0
I'm working on getting a mapper set up for SWmud.

I decided to start with the example for Two Towers from this thread, based on similarities, such as not having easily accessible rooms names, etc:

http://gammon.com.au/forum/?id=10536

The first thing I did was edit the main trigger to match SWmud.

Twin Towers code:

match="^\s{4}(?P<roomdesc>.*\n(\S.*\n)*)\s{4}The only obvious exit(s are| is) (?P<exits>.*)\.\Z"


SWmud code:

match="^(?P<roomdesc>\S.*\n(.*\n)*)(The only|There are .*) obvious exit(s:| is) (?P<exits>.*)\.\Z"


Here's an example SWmud room:

This is the transport facility, where the shuttles land. Since there are so many new destinations added to the shuttle network,
all privately owned vessels have been directed to the Main Dock to the east.  The local ship merchant, Barloke, has a dock to the west.
 
The noise here is almost unbearable.  Large passenger shuttles are constantly landing and taking off from this area.

There are three obvious exits: north, east, and west.

Dabear's Cabbie


So, right off, there's a couple of differences I tried to account for. Unlike Two Towers, room descriptions don't have 4 spaces to uniquely identify a chunk
of text from non-room descriptions. Also, sometimes you wind up with blank lines in the middle of the room description.

After playing around with modifying the match code a bit, I managed to get the mapper working... sort of. While it would map rooms, SWmud's lack of
unique room desc identifiers means I'd pick up all kinds of other stuff, which would in turn confuse the mapper into thinking a given room was multiple
rooms based on which direction I entered from.

Hmm. Perhaps there's a better way, but I experimented with putting the mapper trigger in a group along with a new trigger that would turn off the group
after it received the "exits" output. I then created a set of aliases that would tell the script engine to turn on the triggers and then execute the movement.

For example, I'd input a direction and would get something like:


Mapper_Triggers enabled
n
You climb the stairs back to the lobby.
The lobby of the Hall of Fame is a huge circular room which dwarfs even the tallest of Wookiees. An intricate pattern of stained glass fills
the ceiling above you and a polished marble floor lies underfoot. The Great Hall lies to the south, while a bar is located to the east for
those wishing to relax a bit during their visit to the Hall of Fame.
 
The smell of freshly-mixed drinks drifts in from the east.

Music from across the Star Wars galaxy is being piped in over the intercom.

There are three obvious exits: south, north, and east.
Mapper_Triggers disabled
Mapper adding room D2F16F90, name: You climb the stairs back to the lobby

An important-looking sign is here.

587/587 3 802144 8485 off undrugged > 
Mapper_Triggers enabled
n
You are standing on the eastern end of Senate Blvd.  To the east, you are amazed just how tall the Medical Facility of Imperial City is.
To the north is the Recruitment Center to enlist in the army or navy, and to the south is the glorious Hall of Fame, which houses likenesses
of all of the respected heroes and villains of the Empire.
 
There are four obvious exits: south, north, east, and west.
Mapper_Triggers disabled
Mapper adding room DC6DC520, name: There are three obvious exits: south, north, and east


As you can see, somewhere I've muffed up and in the 2nd room, it's grabbing the exits from the prior room and using it as the name for the 2nd room.
(I think)

post with full code to follow (when I can post again in 22 minutes)
Amended on Thu 07 Nov 2019 07:09 PM by Clafoutis
#1
note, I only set up a set of aliases for n, s, e, and w; I figured I'd set the others up once I had the basics working.

Part 1


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Two_Towers_Mapper_modified"
   author="original: Nick Gammon, modifications: Merritt"
   id="565a2ddd934aca9913894ad4"
   language="Lua"
   purpose="Mapper for SWmud"
   save_state="y"
   date_written="2010-08-30"
   requires="4.51"
   version="1.1"
   >

</plugin>


<!--  Triggers  -->

<triggers>
  <trigger
   enabled="n"
   lines_to_match="10"
   group="Mapper_Triggers"
   keep_evaluating="y"
   match="^(?P&lt;roomdesc&gt;\S.*\n(.*\n)*)(The only|There are .*) obvious exit(s:| is) (?P&lt;exits&gt;.*)\.\Z"
   multi_line="y"
   regexp="y"
   script="process_room_description"
   sequence="100"
  >
    </trigger>
  <trigger
   enabled="n"
   group="Mapper_Triggers"
   keep_evaluating="y"
   match="(The only|There are .*) obvious exit(s:| is)"
   regexp="y"
   send_to="12"
   sequence="200"
  >
  <send>
  EnableTriggerGroup ("Mapper_Triggers", false)
  Note ("Mapper_Triggers disabled")
    </send>
    </trigger>
</triggers>

<aliases>
  <alias
   match="^mapper find ([\w* %d/&quot;]+)$"
   enabled="y"
   sequence="100"
   script="map_find"
   regexp="y"
  >
    </alias>
  <alias
  match="^n$"
  enabled="y"
  send_to="12"
  sequence="100"
  regexp="y"
  >
  <send>
  EnableTriggerGroup ("Mapper_Triggers", true)
  Note ("Mapper_Triggers enabled")
  Send("n")
    </send>
    </alias>	
  <alias
  match="^s$"
  enabled="y"
  send_to="12"
  sequence="100"
  regexp="y"
  >
  <send>
  EnableTriggerGroup ("Mapper_Triggers", true)
  Note ("Mapper_Triggers enabled")
  Send("s")
    </send>
    </alias>	
  <alias
  match="^e$"
  enabled="y"
  send_to="12"
  sequence="100"
  regexp="y"
  >
  <send>
  EnableTriggerGroup ("Mapper_Triggers", true)
  Note ("Mapper_Triggers enabled")
  Send("e")
    </send>
    </alias>	
  <alias
  match="^w$"
  enabled="y"
  send_to="12"
  sequence="100"
  regexp="y"
  >
  <send>
  EnableTriggerGroup ("Mapper_Triggers", true)
  Note ("Mapper_Triggers enabled")
  Send("w")
    </send>	
    </alias>  
</aliases>
  

<!--  Script  -->


<script>
<![CDATA[

local MAX_NAME_LENGTH = 60
local MUD_NAME = "SWmud"

require "mapper"
require "serialize"
require "copytable"
require "commas"
  
default_config = {
  -- assorted colours
  BACKGROUND_COLOUR       = { name = "Background",        colour =  ColourNameToRGB "lightseagreen", },
  ROOM_COLOUR             = { name = "Room",              colour =  ColourNameToRGB "cyan", },
  EXIT_COLOUR             = { name = "Exit",              colour =  ColourNameToRGB "darkgreen", },
  EXIT_COLOUR_UP_DOWN     = { name = "Exit up/down",      colour =  ColourNameToRGB "darkmagenta", },
  EXIT_COLOUR_IN_OUT      = { name = "Exit in/out",       colour =  ColourNameToRGB "#3775E8", },
  OUR_ROOM_COLOUR         = { name = "Our room",          colour =  ColourNameToRGB "black", },
  UNKNOWN_ROOM_COLOUR     = { name = "Unknown room",      colour =  ColourNameToRGB "#00CACA", },
  DIFFERENT_AREA_COLOUR   = { name = "Another area",      colour =  ColourNameToRGB "#009393", },
  MAPPER_NOTE_COLOUR      = { name = "Messages",          colour =  ColourNameToRGB "lightgreen" },
  
  ROOM_NAME_TEXT          = { name = "Room name text",    colour = ColourNameToRGB "#BEF3F1", },
  ROOM_NAME_FILL          = { name = "Room name fill",    colour = ColourNameToRGB "#105653", },
  ROOM_NAME_BORDER        = { name = "Room name box",     colour = ColourNameToRGB "black", },
  
  AREA_NAME_TEXT          = { name = "Area name text",    colour = ColourNameToRGB "#BEF3F1",},
  AREA_NAME_FILL          = { name = "Area name fill",    colour = ColourNameToRGB "#105653", },   
  AREA_NAME_BORDER        = { name = "Area name box",     colour = ColourNameToRGB "black", },
               
  FONT = { name =  get_preferred_font {"Dina",  "Lucida Console",  "Fixedsys", "Courier", "Sylfaen",} ,
           size = 8
         } ,
         
  -- size of map window
  WINDOW = { width = 400, height = 400 },
  
  -- how far from where we are standing to draw (rooms)
  SCAN = { depth = 30 },
  
  -- speedwalk delay
  DELAY = { time = 0.3 },
  
  -- how many seconds to show "recent visit" lines (default 3 minutes)
  LAST_VISIT_TIME = { time = 60 * 3 },  
  
  }
  
rooms = {}

valid_direction = {
  n = "n",
  s = "s",
  e = "e",
  w = "w",
  u = "u",
  d = "d",
  ne = "ne",
  sw = "sw",
  nw = "nw",
  se = "se",
  north = "n",
  south = "s",
  east = "e",
  west = "w",
  up = "u",
  down = "d",
  northeast = "ne",
  northwest = "nw",
  southeast = "se",
  southwest = "sw",
  ['in'] = "in",
  out = "out",
  }  -- end of valid_direction
#2
Part 2


-- -----------------------------------------------------------------
-- We have a room name and room exits
-- -----------------------------------------------------------------

function process_room_description (name, line, wildcards)

  local exits_str = trim (wildcards.exits)
  local roomdesc = trim (wildcards.roomdesc)
  
  -- ColourNote ("white", "blue", "exits: " .. exits_str)  -- debug
  
  -- generate a "room ID" by hashing the room description and exits
  uid = utils.tohex (utils.md5 (roomdesc .. exits_str))
  uid = uid:sub (1, 25)  

  -- break up exits into individual directions
  exits = {}
  
  for exit in string.gmatch (exits_str, "%w+") do
    local ex = valid_direction [exit]
    if ex then
      exits [ex] = "0"  -- don't know where it goes yet
    end -- if
  end -- for
  
  local name = string.match (roomdesc, "^(.-)[.\n]")
  
  if #name > MAX_NAME_LENGTH then
    name = name:sub (1, MAX_NAME_LENGTH - 3) .. "..."
  end -- if too long
  
  -- add to table if not known
  if not rooms [uid] then
    ColourNote ("cyan", "", "Mapper adding room " .. uid:sub (1, 8) .. ", name: " .. name)
    rooms [uid] = { name = name, desc = roomdesc, exits = exits, area = MUD_NAME }
  end -- if

  -- save so we know current room later on  
  current_room = uid
  
  -- call mapper to draw this rom
  mapper.draw (uid)

  -- try to work out where previous room's exit led  
  if expected_exit == "0" and from_room then
    fix_up_exit ()
  end -- exit was wrong
    
end -- Name_Or_Exits


-- -----------------------------------------------------------------
-- mapper 'get_room' callback - it wants to know about room uid
-- -----------------------------------------------------------------

function get_room (uid)
  
  if not rooms [uid] then 
   return nil
  end -- if
 
  local room = copytable.deep (rooms [uid])
 
  local texits = {}
  for dir in pairs (room.exits) do
    table.insert (texits, dir)
  end -- for
  table.sort (texits)
  
  room.hovermessage = string.format (
       "%s\tExits: %s\nRoom: %s",
        room.name or "unknown", 
        table.concat (texits, ", "),
      uid
      )
      
  if uid == current_room then
    room.bordercolour = config.OUR_ROOM_COLOUR.colour
    room.borderpenwidth = 2
  end -- not in this area
      
  return room
  
end -- get_room

-- -----------------------------------------------------------------
-- We have changed rooms - work out where the previous room led to 
-- -----------------------------------------------------------------

function fix_up_exit ()

  -- where we were before
  local room = rooms [from_room]
  
  -- leads to here
  room.exits [last_direction_moved] = current_room
    
  -- clear for next time
  last_direction_moved = nil
  from_room = nil
  
end -- fix_up_exit

-- -----------------------------------------------------------------
-- try to detect when we send a movement command
-- -----------------------------------------------------------------

function OnPluginSent (sText)
  if valid_direction [sText] then
    last_direction_moved = valid_direction [sText]
    -- print ("Just moved", last_direction_moved)
    if current_room and rooms [current_room] then
      expected_exit = rooms [current_room].exits [last_direction_moved]
      if expected_exit then
        from_room = current_room
      end -- if
    -- print ("expected exit for this direction is to room", expected_exit)
    end -- if
  end -- if 
end -- function

-- -----------------------------------------------------------------
-- Plugin Install
-- -----------------------------------------------------------------

function OnPluginInstall ()
  
  config = {}  -- in case not found

  -- get saved configuration
  assert (loadstring (GetVariable ("config") or "")) ()

  -- allow for additions to config
  for k, v in pairs (default_config) do
    config [k] = config [k] or v
  end -- for
    
  -- and rooms
  assert (loadstring (GetVariable ("rooms") or "")) ()
  
  -- initialize mapper
  
  mapper.init { config = config, get_room = get_room  } 
  mapper.mapprint (string.format ("MUSHclient mapper installed, version %0.1f", mapper.VERSION))

end -- OnPluginInstall

-- -----------------------------------------------------------------
-- Plugin Save State
-- -----------------------------------------------------------------

function OnPluginSaveState ()
  mapper.save_state ()
  SetVariable ("config", "config = " .. serialize.save_simple (config))
  SetVariable ("rooms", "rooms = " .. serialize.save_simple (rooms))
end -- OnPluginSaveState

-- -----------------------------------------------------------------
-- Plugin just connected to world
-- -----------------------------------------------------------------

function OnPluginConnect ()
  from_room = nil
  last_direction_moved = nil
end -- OnPluginConnect
  
-- -----------------------------------------------------------------
-- Find a room
-- -----------------------------------------------------------------

function map_find (name, line, wildcards)
 
  local room_ids = {}
  local count = 0
  local wanted = (wildcards [1]):lower ()

  -- scan all rooms looking for a simple match  
  for k, v in pairs (rooms) do
     local desc = v.desc:lower ()
     if string.find (desc, wanted, 1, true) then
       room_ids [k] = true
       count = count + 1
     end -- if
  end   -- finding room
  
  -- see if nearby
  mapper.find (
    function (uid) 
      local room = room_ids [uid] 
      if room then
        room_ids [uid] = nil
      end -- if
      return room, next (room_ids) == nil
    end,  -- function
    show_vnums,  -- show vnum?
    count,      -- how many to expect
    false       -- don't auto-walk
    )
  
end -- map_find


]]>
</script>


</muclient>
Australia Forum Administrator #3
I can't see anything obvious, but what I usually do with timing or sequence-related problems is to add in more debugging.

For a start, turn on Game -> Trace, and see what triggers are firing and in what order.

Then if that doesn't help add some debugging prints into your functions.
#4
turned on trace and got:


TRACE: Matched alias "^n$"
Mapper_Triggers enabled
TRACE: Executing Plugin Two_Towers_Mapper_modified script "OnPluginSent"
n
Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy couches together in pairs to promote discussion and
togetherness.  Small glass tables rest nearby for those hot drinks you can order from the waitress who undoubtedly must also be a struggling
artist. A rolling fire near the south end is surrounded by a few large pillows and a few good books on the mantle. The western wall has a small
stage with a microphone and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A large board has a 'list' of
items on it for you to order. There is a door to the south, which seems to lead back to the street. There is also a stairwell going down, which
Jennette only allows certain people access to.
 You may also use the bulletin board here to post stories, jokes, and anything of artistic value for others to read.
 
Soft music of some foreign origin plays over the speakers.

There are two obvious exits: south and down.
TRACE: Matched trigger "^(?P<roomdesc>\S.*\n(.*\n)*)(The only|There are .*) obvious exit(s:| is) (?P<exits>.*)\.\Z"
TRACE: Matched trigger "(The only|There are .*) obvious exit(s:| is)"
Mapper_Triggers disabled
TRACE: Executing trigger script "process_room_description"
Mapper adding room 402F7BAE, name: togetherness

Jennette

* Expression Board * is here.

587/587 3 822392 3725 off undrugged > 
TRACE: Matched alias "^s$"
Mapper_Triggers enabled
TRACE: Executing Plugin Two_Towers_Mapper_modified script "OnPluginSent"
s
You are standing on the eastern side of Senate Blvd.  To the east, you can catch a better glimpse of the Medical Facilities of Imperial City.
Also, from this area, is a Coffee House to the north, and the Imperial Complex to the south.
 
There are four obvious exits: south, north, east, and west.
TRACE: Matched trigger "^(?P<roomdesc>\S.*\n(.*\n)*)(The only|There are .*) obvious exit(s:| is) (?P<exits>.*)\.\Z"
TRACE: Matched trigger "(The only|There are .*) obvious exit(s:| is)"
Mapper_Triggers disabled
TRACE: Executing trigger script "process_room_description"
Mapper adding room 9DDEE217, name: Jennette

587/587 3 822392 3725 off undrugged > 
TRACE: Matched alias "^s$"
Mapper_Triggers enabled
TRACE: Executing Plugin Two_Towers_Mapper_modified script "OnPluginSent"
s
This is the lush lobby of the Imperial Complex.  There are potted plants that line the walls, as well as at the base of the massive columns that
are also here.  There is a stairwell that leads down to a conference room for loyal citizens of the Empire.  There are some stormtroopers posted
near the stairwell, and they look like they mean to keep out anyone who isn't a loyal citizen of the Empire.
 
There are two obvious exits: north and down.
TRACE: Matched trigger "^(?P<roomdesc>\S.*\n(.*\n)*)(The only|There are .*) obvious exit(s:| is) (?P<exits>.*)\.\Z"
TRACE: Matched trigger "(The only|There are .*) obvious exit(s:| is)"
Mapper_Triggers disabled
TRACE: Executing trigger script "process_room_description"
Mapper adding room 8FA83799, name: from this area, is a Coffee House to the north, and the I...


So, it looks like somehow it grabbed the name of a mob, 'Jennette' between rooms 1 and 2, despite her name seeming to appear at a moment when
the triggers were disabled.

When I walked into room 3, it used a bit of room 2's description for the name, even tho I would have thought that would have been data from the prior
iteration overwritten by the current iteration when I walked into 3.

Hmm.

added the following code just before 'end' to the function 'process_room_description'


  name = nil
   
  roomdesc = nil

  collectgarbage()

  print ("name: ", name)


I had meant to add a print line for roomdesc but was adding and testing one line at a time and by happenstance captured a bizarre result where a player happened to walk through in the middle of testing.

While the triggers were seemingly disabled, it somehow grabbed 'Cherry enters.' and used it to name the next room I walked into 'Cherry enters'

Somehow, my attempts to disable the triggers and reset the variables are not accomplishing my intents:

1. to not collect data while the triggers are disabled
2. to not use old data from prior rooms
Amended on Fri 08 Nov 2019 03:42 PM by Clafoutis
#5

n
Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy couches together in pairs to promote discussion and
togetherness.  Small glass tables rest nearby for those hot drinks you can order from the waitress who undoubtedly must also be a struggling
artist. A rolling fire near the south end is surrounded by a few large pillows and a few good books on the mantle. The western wall has a small
stage with a microphone and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A large board has a 'list' of
items on it for you to order. There is a door to the south, which seems to lead back to the street. There is also a stairwell going down, which
Jennette only allows certain people access to.
 You may also use the bulletin board here to post stories, jokes, and anything of artistic value for others to read.
 
Soft music of some foreign origin plays over the speakers.

There are two obvious exits: south and down.

Jennette

* Expression Board * is here.

587/587 3 822392 3725 off undrugged > Autosaving.
Cherry enters.
Cherry leaves down.
Cherry enters.
Cherry's Bodyguard enters.
Cherry leaves south.
Cherry's Bodyguard leaves south.
TRACE: Executing Plugin Two_Towers_Mapper_modified script "OnPluginInstall"
MUSHclient mapper installed, version 2.5
Added plugin
TRACE: Fired unlabelled timer 
TRACE: Matched alias "^s$"
Mapper_Triggers enabled
TRACE: Executing Plugin Two_Towers_Mapper_modified script "OnPluginSent"
s
You are standing on the eastern side of Senate Blvd.  To the east, you can catch a better glimpse of the Medical Facilities of Imperial City.
Also, from this area, is a Coffee House to the north, and the Imperial Complex to the south.
 
There are four obvious exits: south, north, east, and west.
TRACE: Matched trigger "^(?P<roomdesc>\S.*\n(.*\n)*)(The only|There are .*) obvious exit(s:| is) (?P<exits>.*)\.\Z"
TRACE: Matched trigger "(The only|There are .*) obvious exit(s:| is)"
Mapper_Triggers disabled
TRACE: Executing trigger script "process_room_description"
Mapper adding room C408F5CB, name: Cherry enters
name:  nil
Amended on Fri 08 Nov 2019 04:12 PM by Clafoutis
#6
It seems like I'm expecting it to evaluate the output starting from the next line to appear after the triggers are enabled.

Instead, it seems like there's some buffer it's reading from. All turning the triggers on does is tell it to begin evaluating from wherever it happens to be in the buffer.

Commented out the '<variable> = nil' lines and added a couple of lines to print asterisks to break up the text


TRACE: Executing Plugin Two_Towers_Mapper_modified script "OnPluginInstall"
MUSHclient mapper installed, version 2.5
TRACE: Matched alias "^n$"
Mapper_Triggers enabled
TRACE: Executing Plugin Two_Towers_Mapper_modified script "OnPluginSent"
n
Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy couches together in 
pairs to promote discussion and togetherness.  Small glass tables rest nearby for those hot drinks you can 
order from the waitress who undoubtedly must also be a struggling artist. A rolling fire near the south end 
is surrounded by a few large pillows and a few good books on the mantle. The western wall has a small stage 
with a microphone and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A 
large board has a 'list' of items on it for you to order. There is a door to the south, which seems to lead 
back to the street. There is also a stairwell going down, which Jennette only allows certain people access to.
 You may also use the bulletin board here to post stories, jokes, and anything of artistic value for others 
to read.
 
Soft music of some foreign origin plays over the speakers.

There are two obvious exits: south and down.
TRACE: Matched trigger "^(?P<roomdesc>\S.*\n(.*\n)*)(The only|There are .*) obvious exit(s:| is) 
(?P<exits>.*)\.\Z"
TRACE: Matched trigger "(The only|There are .*) obvious exit(s:| is)"
Mapper_Triggers disabled
TRACE: Executing trigger script "process_room_description"
Mapper adding room 402F7BAE, name: togetherness
name:  togetherness
***********
roomdesc:  togetherness.  Small glass tables rest nearby for those hot drinks you can order from the waitress 
who undoubtedly must also be a struggling artist. A rolling fire near the south end is surrounded by a few 
large pillows and a few good books on the mantle. The western wall has a small stage with a microphone and 
chair for poets, musicians and storytellers to entertain and enlighten the crowd. A large board has a 'list' 
of items on it for you to order. There is a door to the south, which seems to lead back to the street. There 
is also a stairwell going down, which Jennette only allows certain people access to.
 You may also use the bulletin board here to post stories, jokes, and anything of artistic value for others 
to read.
 
Soft music of some foreign origin plays over the speakers.
***********

Jennette

* Expression Board * is here.

587/587 3 822392 3725 off undrugged > 
TRACE: Fired unlabelled timer 
TRACE: Matched alias "^s$"
Mapper_Triggers enabled
TRACE: Executing Plugin Two_Towers_Mapper_modified script "OnPluginSent"
s
You are standing on the eastern side of Senate Blvd.  To the east, you can catch a better glimpse of the 
Medical Facilities of Imperial City.  Also, from this area, is a Coffee House to the north, and the Imperial 
Complex to the south.
 
There are four obvious exits: south, north, east, and west.
TRACE: Matched trigger "^(?P<roomdesc>\S.*\n(.*\n)*)(The only|There are .*) obvious exit(s:| is) 
(?P<exits>.*)\.\Z"
TRACE: Matched trigger "(The only|There are .*) obvious exit(s:| is)"
Mapper_Triggers disabled
TRACE: Executing trigger script "process_room_description"
Mapper adding room 9DDEE217, name: Jennette
name:  Jennette
***********
roomdesc:  Jennette

* Expression Board * is here.

587/587 3 822392 3725 off undrugged > 
You are standing on the eastern side of Senate Blvd.  To the east, you can catch a better glimpse of the 
Medical Facilities of Imperial City.  Also, from this area, is a Coffee House to the north, and the Imperial 
Complex to the south.
***********
Amended on Fri 08 Nov 2019 04:28 PM by Clafoutis
#7
Looking into using to add a 'simulate' to my movement alias in order to push unique identifiers onto the room descriptions.

In theory, I can trigger off of this unique signifier instead of trying to get the trigger to guess what is and what isn't a room description.

Will take some work; will edit results into post if results are promising.

EDIT:

can simulate a 'testphrase' and trigger off of that but struggling to integrate 'testphrase' into


match="^(?P&lt;roomdesc&gt;\S.*\n(.*\n)*)(The only|There are .*) obvious exit(s:| is) (?P&lt;exits&gt;.*)\.\Z"


^testphrase(?...
testphrase(?...
^(?P&lt;roomdesc&gt;testphrase\S.*n...
^(?P&lt;roomdesc&gt;testphrase.*n...

doesn't seem to trigger. Probably need to take a break and come back with fresh eyes.
Amended on Fri 08 Nov 2019 11:19 PM by Clafoutis
Australia Forum Administrator #8

It seems like I’m expecting it to evaluate the output starting from the next line to appear after the triggers are enabled.

Instead, it seems like there’s some buffer it’s reading from. All turning the triggers on does is tell it to begin evaluating from wherever it happens to be in the buffer.

See How MUSHclient processes text arriving from the MUD

A line of input is collected and then trigger evaluation begins. If a low sequence (early) trigger enables a trigger that was previously off, and yet to be processed (in the evaluation sequence) then that same line will be sent to that trigger.

Also, script processing (in the script file, not send-to-script) is deferred until all triggers are processed. So you can disable triggers and then see that (previously handled) script functions are called.

#9
Thanks for the link; I'm digesting the implications and have bookmarked it for reference.

So, I've decided to back up and simply for it bit. I've adjusted the north moving alias to:


  <alias
   match="^n$"
   enabled="y"
   send_to="12"
   sequence="100"
   regexp="y"
  >
  <send>
   EnableTriggerGroup ("Mapper_Triggers", true)
   Note ("Mapper_Triggers enabled")
   Send("n")
   Simulate ("(*)")
    </send>
    </alias>	


Effectively, when I move north, I expect the vary next thing to be the next room's description. Here, I "mark" it with a unique notation. The hope is that eventually I can get a trigger to be able to differentiate between:

(*)some_text (this is a room description)

and

some_text (this is not a room description)

I have these triggers set up:


  <trigger
   enabled="n"
   lines_to_match="10"
   group="Mapper_Triggers"
   keep_evaluating="y"
   match="\(\*\)"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
   Note ("match found")
  </send>
    </trigger>	
  <trigger
   enabled="n"
   group="Mapper_Triggers"
   keep_evaluating="y"
   match="(The only|There are .*) obvious exit(s:| is)"
   regexp="y"
   send_to="12"
   sequence="200"
  >
  <send>
  EnableTriggerGroup ("Mapper_Triggers", false)
  Note ("Mapper_Triggers disabled")
    </send>
    </trigger>


I expected to get:


Mapper_Triggers enabled
n
(*)Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy couches together in pairs to promote discussion and
match found
togetherness.  Small glass tables rest nearby for those hot drinks you can order from the waitress who undoubtedly must also be a struggling artist. A
rolling fire near the south end is surrounded by a few large pillows and a few good books on the mantle. The western wall has a small stage with a
microphone and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A large board has a 'list' of items on it for you to
order. There is a door to the south, which seems to lead back to the street. There is also a stairwell going down, which Jennette only allows certain
people access to.
 You may also use the bulletin board here to post stories, jokes, and anything of artistic value for others to read.


Soft music of some foreign origin plays over the speakers.

There are two obvious exits: south and down.
Mapper_Triggers disabled

Jennette

* Expression Board * is here.

587/587 3 822392 3725 off undrugged >


I instead got:


Mapper_Triggers enabled
n
(*)Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy couches together in pairs to promote discussion and
match found
togetherness.  Small glass tables rest nearby for those hot drinks you can order from the waitress who undoubtedly must also be a struggling artist. A
match found
rolling fire near the south end is surrounded by a few large pillows and a few good books on the mantle. The western wall has a small stage with a
match found
microphone and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A large board has a 'list' of items on it for you to
match found
order. There is a door to the south, which seems to lead back to the street. There is also a stairwell going down, which Jennette only allows certain
match found
people access to.
match found
 You may also use the bulletin board here to post stories, jokes, and anything of artistic value for others to read.
match found
 
match found
Soft music of some foreign origin plays over the speakers.
match found
match found
There are two obvious exits: south and down.
Mapper_Triggers disabled

Jennette

* Expression Board * is here.

587/587 3 822392 3725 off undrugged >


I experimented with turning 'keep_evaluating' off, but got the same result. I feel like I've done something horrifically wrong.
Amended on Sat 09 Nov 2019 01:39 AM by Clafoutis
Australia Forum Administrator #10
The multi-line thing is screwing you up. You are matching on "(*)" found anywhere over the last 10 lines. Which it was.
Australia Forum Administrator #11
Personally I wouldn't be injecting packets like you are. Why not just set a global flag, which you can test in other triggers? Much simpler.
#12
Nick Gammon said:

The multi-line thing is screwing you up. You are matching on "(*)" found anywhere over the last 10 lines. Which it was.


Yea. It was instructive to see my assumptions shattered and examine why and how I was wrong.

Nick Gammon said:

Personally I wouldn't be injecting packets like you are. Why not just set a global flag, which you can test in other triggers? Much simpler.


So, I can flag a trigger for things like 'keep_evaluating' y or n, enable or disable a timer, etc.
I could set a variable and test it; if variable = true do x, else y. Right?

Isn't my problem that I can ask MUSHclient to grab a chunk of text, but I'm failing to express to MUSHclient what kinds of text to keep and
what to ignore?

Edit said:

There are examples elsewhere in the forum I need to review; I should set aside the rest of this post and the subsequent post until I have worked over them; sorry.


Two Towers seems to have a format where they begin room descriptions with 4 spaces, so that's easy to key off of. SWmud doesn't seem to
have a unique quirk of room descriptions to use.

One quirk of SWmud is that it does have what I think most mudders would think of as a room name. It treats it as a "short decription". If
brief mode is on, I'll get this short description instead of the regular description


Down on the Upside Cafe
[2: s, down]
Jennette

* Expression Board * is here.


As a side effect, it also formats the exits differently but that's fine.

Alternatively, regardless of brief mode, I can stand outside the room and 'lpeer [direction] [optional distance]' into the room and get
something similar


lpeer n 1
Down on the Upside Cafe
[2: s, down]
Jennette
* Expression Board * is here.


If the mud didn't frown on sending/triggering multiple commands to the mud all at once, I would have been tempted to write a script to maybe

move into a room (while brief mode was on)
omit everything but the roomname
look at the room while omitting the command sent from the output window

and get something like:


Down on the Upside Cafe
Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy couches together in pairs to promote discussion and
togetherness.  Small glass tables rest nearby for those hot drinks you can order from the waitress who undoubtedly must also be a 
struggling artist. A rolling fire near the south end is surrounded by a few large pillows and a few good books on the mantle. The western 
wall has a small stage with a microphone and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A large 
board has a 'list' of items on it for you to order. There is a door to the south, which seems to lead back to the street. There is also a  
stairwell going down, which Jennette only allows certain people access to.
 You may also use the bulletin board here to post stories, jokes, and anything of artistic value for others to read.
 
Soft music of some foreign origin plays over the speakers.

There are two obvious exits: south and down.

Jennette

* Expression Board * is here.

587/587 3 843640 9475 off undrugged > 


maybe indent the 'room name' a little to help it stand out.
Amended on Sat 09 Nov 2019 05:55 PM by Clafoutis
#13
So, the 'exit' line is unique and reliably consistent. Looking at:

https://www.gammon.com.au/scripts/doc.php?function=GetLineInfo

I thinking about trying to write a function to grab the last 10ish lines from the buffer at the moment a trigger matches the exit line.

If I could consistently get the function to return line 10 as the exit line, I might be able to work backwards to get the room description. Something informally like


SetVariable ("roomdesc", "")

for line 9 to 1
   if line = [n,s,e,w, etc]
      then lineheader = line - 1
      end
   else lineheader = 1

for line lineheader to 9
   roomdesc = roomdesc + line


and then proceed to feed the roomdesc into the code the mapper already has to hash out a unique room number, etc.
Australia Forum Administrator #14
Yes, what I try to do in situations like that is consider how I, as a human, recognise that I am looking at a room name, description, exits, contents, prompt, and other stuff. Then try to codify my thought processes into Lua code.

Your idea of working backwards from the next prompt may well be useful. Get a batch of rooms and see what there is consistent about them (eg. a leading space, length of line, colour of line, text in the line and so on). You may have to do something like "there is nothing special about the exits line, but it is always just before a prompt line".
#15
Worked on some other things for a day or two and tried to apply what I learned to the mapper.

I've disconnected the triggers from the mapper script and am just having it output notes.
The good news is, I seem to be getting consistent room description captures which should go
a long ways towards fixing some of my original problems porting the mapper over to SWmud.

The bad news is, something weird is going on with my exits capture.


  <trigger
   enabled="n"
   group="Mapper_Triggers"
   keep_evaluating="y"
   match="^\D.*"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
   table.insert (room_table, "%0")
    </send>
    </trigger>	
  <trigger
   enabled="n"
   group="Mapper_Triggers"
   keep_evaluating="y"
   match="(?:The only|There are .*) obvious exit(?:s:| is) (?P&lt;exits&gt;.*)\."
   regexp="y"
   send_to="12"
   sequence="200"
  >
  <send>
   room_table = room_table or {}
    
   for _, item in ipairs (room_table) do
     print (item)
   
   end
   
   print ("---")
   
   print (%1)
   print (exits)

   EnableTriggerGroup ("Mapper_Triggers", false)
   Note ("Mapper_Triggers disabled")
   
    </send>
    </trigger>


Result 1:

Mapper_Triggers enabled
n
Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy 
couches together in pairs to promote discussion and togetherness.  Small glass tables rest 
nearby for those hot drinks you can order from the waitress who undoubtedly must also be a 
struggling artist. A rolling fire near the south end is surrounded by a few large pillows 
and a few good books on the mantle. The western wall has a small stage with a microphone 
and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A 
large board has a 'list' of items on it for you to order. There is a door to the south, 
which seems to lead back to the street. There is also a stairwell going down, which 
Jennette only allows certain people access to.
 You may also use the bulletin board here to post stories, jokes, and anything of artistic
value for others to read.
 
Soft music of some foreign origin plays over the speakers.

There are two obvious exits: south and down.

((not actually in the code, but added this line more easily show where the code starts to 
return what it captured, since it's normally distinguished by color on my client))

Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy 
couches together in pairs to promote discussion and togetherness.  Small glass tables rest 
nearby for those hot drinks you can order from the waitress who undoubtedly must also be a 
struggling artist. A rolling fire near the south end is surrounded by a few large pillows 
and a few good books on the mantle. The western wall has a small stage with a microphone 
and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A 
large board has a 'list' of items on it for you to order. There is a door to the south, 
which seems to lead back to the street. There is also a stairwell going down, which 
Jennette only allows certain people access to.
 You may also use the bulletin board here to post stories, jokes, and anything of artistic
value for others to read.
 
Soft music of some foreign origin plays over the speakers.
There are two obvious exits: south and down.
---
nil
nil

((end of capture))

Mapper_Triggers disabled

Jennette

* Expression Board * is here.

587/587 -4 464391 4704 off undrugged > 


In this case, instead of capturing the exits, I'm getting nil results. However in the 2nd result, when I move into a room that has three or more exits, it seems that because the exit line has commas in it like so:


There are four obvious exits: south, north, east, and west.


Then I get this error message:


Error number: 0
Event:        Compile error
Description:  [string "Trigger: "]:12: unexpected symbol near 'and'
Called by:    Immediate execution
Amended on Tue 12 Nov 2019 10:10 PM by Clafoutis
Australia Forum Administrator #16
This needs to be quoted:


   print (%1)


Because if the exits are "south and down" then it will turn that into:


   print (south and down)


Hence the error message about "unexpected symbol near 'and'".

It should read:



   print ("%1")
#17
Thank you for your patience;


print ("%1")


now correctly displays the exit line in all tested cases, (e.g. "south, north, east, and west")

however


print (exits)


returns "nil"

My possibly misplaced concern is that ultimately I want the function process_room_description to manipulate room_desc and exits.

I can display the contents of room_desc but not exits, and am assuming I won't be able to get the function to work if I'm not
properly capturing both variables.

I have some further concerns that I understand some of what the function is doing, but there are a few parts that are beyond me;
however I'm assuming that won't matter until I can get the capture variables right.
Amended on Wed 13 Nov 2019 05:38 PM by Clafoutis
Australia Forum Administrator #18

   print (exits)


You haven't assigned anything to the variable "exits" so it is nil.

Since you are using named wildcards you could pull in the named wildcard like this:


   exits = "%<exits>"
   print (exits)
#19
So I've been tinkering with this basic plugin to get it to work for SWMud.

After trying several approaches with the multiline trigger I think this regex may work pretty consistently

match="^.+\s&gt;\s$\s^(?P&lt;roomdesc&gt;(?:(?!\s&gt;\s)[\s\S])*)(The only|There are .*) obvious exit(s:| is) (?P&lt;exits&gt;.*)\.\Z"

What it does look for the end of the prompt string (" > " end of line) followed by anything that is not the end of the prompt string followed by the exit string.

I know that the greater than sign is used other places in room descriptions but as far as I know you shouldn't have any instances of " > " found anywhere other than the prompt (let me know if you find this is not the case).

Play around with this let me know what you think.
#20
Drago said:

Play around with this let me know what you think.


Wow, this is magnitude's of order way better than any of my attempts. There's a few odd rooms that it doesn't pick up but this is miles way more functional.

I've tried to go back to basics and read a book on Lua while working on a few simpler projects. I'll see if I can work out a few of the odd stubborn rooms to work with this but even if I can't, this is more than workable.

Thanks Drago, to both you and Nick, for your assistance; I really appreciate it.
#21
On an initial quick pass, a couple of the rooms are over 10 lines; it was relatively simple to up the lines_to_match to 15 and that fixed a couple of rooms the mapper wasn't picking up.

One thing that I'm not sure how to correct is, occasionally some interaction will happen between the last prompt '>' and the next room description:


612/612 1 292459 12941 off undrugged [0] > Ryoh enters.
Ryoh leaves northeast.
sw
This is the lobby of the commercial tower of Imperial City.  In this tower you will find many vendors to purchase from and sell to.  The main shop is
located here in the lobby, and a shopkeeper patiently waits behind the counter to either buy from you or sell something to you.

Type 'panic shop' for more information.
 
There are four obvious exits: south, northeast, west, and up.

Shop Keeper

Trashcan is here.

612/612 1 292459 12941 off undrugged [0] > 


And that will throw the mapper off. If I leave the room and reenter, the mapper reorients and sorts itself out. However, sometimes this behavior will cause it to create a new room based on the extra interaction; I'm not sure if this will lead to the state file gradually growing to be larger than it needs to be.
Amended on Fri 10 Jan 2020 01:24 AM by Clafoutis
Australia Forum Administrator #22
Conceivably you could try to omit bogus lines like "* leaves *" from the table that you are building up of the room description.

Or, maybe omit really short lines, if they are followed by a long line.
#23
I could omit things, but the range of possible things seems pretty wide, from entities moving around, emotes, chat. Still, it's the most functional model I've got so far so I'm definately holding onto this branch.

That said, I was looking at a seperate project I've been working on. I used your inventory sorter from the faq to successfully capture flight coordinate data, send it to a seperate session window and thus leave the main output window much less cluttered.

http://mushclient.com/forum/?id=7794#37

With this code, we're able to tell the client exactly when to start collecting lines, use those lines to populate a table, and when to stop. Then, instead of sending the table to a seperate session window, rather it would get sent to the mapper scripts for processing.

The minor hitch, is that this creates a table whereas the mapper scripts I think take a wildcard/variable as input, so I'll need to study converting formats but it ought to be possible.
Australia Forum Administrator #24
You can use table.concat to convert a table into lines, if that is what you mean.
#25
So I realize that having put this down two months ago, I find that in the last couple days I've mulled over several options only to wind up in my last post *unwittingly* where I left off.

To my mild embarrassment.

That said, *this* time around, the data capture actually works really well. It's doing really well at picking up the room description and not grabbing the extraneous chats, movement, emotes, etc.

Before I move onto sending the data to the mapper, there is one persistent little exception. There are a handful of rooms where if you enter them from a specific direction, the mud will send an extra line that it won't send if you come at the room from other directions. This one plagues both my branch and Draco's solution, so it's good if I can tackle it either way.

Now, I can individually write omission triggers for every different instance of this, but that's tedious and if I don't catch one ahead of time, I've gotta go back and prune the collected data. I think the advise to 'omit really short lines, if they are followed by a long line' ought to winnow the exceptions down.

I'm just not quite sure of the regex:


^\S((\D|\d){1,49})$^\S((\D|\d){49,})$

or maybe

^\S((\D|\d){1,49})$^\S.*$


but I'm afraid my grasp of regex is rather crude and I'm probably not expressing:


"line of between 2 and 50 characters followed by line of at least 50 characters"

or

"line of between 2 and 50 characters followed by line with at least one non-white space character"


all that well or accurately.
Australia Forum Administrator #26
Before I try them out, I would point out that $ is supposed to be end of the subject. I you want to test for a linebreak put \n there.
#27
Nick Gammon said:

You can use table.concat to convert a table into lines, if that is what you mean.


I suspect I meant to say string and just communicated poorly.

In any case, this is *exactly* the needed command. Thank you so much; more to follow.
#28
Ok so, I need to clean up my crude tinkerings and post the results for scrutiny but... I think we have it (or at least a working rough draft).

So, I tried the whole matching the short line followed by the long, but I realized even if I could match that, I struggled to articulate to the client to only omit part of that match.

Instead, and this is where things get a little crude, I opted to fire off of an alias where I simply look at the room I'm standing in. It's crude in the sense that, in a traditional mapper, you simply move and mapper takes care of you. Here, it winds up being a two step process of, move + look. However it's a special alias so that normal look commands won't trigger anything. That said, *so far* it seems to have cut out all the interference as well as omitting the special messages that only appear when you enter a room from a specific direction.

While getting there is a little clunky, the end result map is much cleaner than even Draco's solution (which, I must reiterate was far superior to my initial attempts). It's way too early to say with much confidence until more rigorous testing, but so far I haven't had any cases where I've gotten duplicate/conflicting entries in the map table for a given room.

It does make speedwalking a little hinky as you'll stop in each room and have to hit the 'map'look alias to move to the next step.

But the map is *clean and consistent* which was my primary aim.

I'll need to give some thought into chaining the move and maplook together; in most muds you'd just throw them into one trigger that'd fire them off in order. However, SWmud rules don't like it when you trigger commands *to the mud*. Client side triggers are fine (color and highlighting triggers, pulling in the data for the mapper, etc).
Amended on Fri 17 Jan 2020 01:51 AM by Clafoutis
#29
Of course, on reflection, now I'm effectively sending an extra look command everytime I want to update my map location; i.e. not simply when I'm *creating* the map.

Hrm.
Australia Forum Administrator #30
You should be able to get the automated system to work. After all, as a human you look at a bunch of recent lines and can filter out what is part of the description and what isn't. This should be able to be codified. Forget about complex trigger matches, just capture (say) 20 recent lines and then analyze them when a new line arrives. There should be a pattern that you recognize, and therefore you can make code recognize.

A tip that might help is that conceivably the MUD splits things like "Ryoh leaves northeast." into a separate packet. If you work at the packet level you may be able to detect the difference between a room description (which quite possibly would end up in one large packet) and a message from the MUD, in a short one.

In a plugin you can process incoming packets (OnPluginPacketReceived). Turn on packet debug under the Edit menu to see if this is happening.

You could conceivably save all incoming packets into a table (throwing away old ones to save memory). Then if, when processing what looks like a description, if a line like "Ryoh leaves northeast." appears on its own in a packet you could assume that it is not part of the description, otherwise it is.

Also, I have used in the past detecting the colours of text to help distinguish messages like that from room descriptions. Either the movement message might be in a different colour, or the room description might be. Those clues can be useful in working out the meaning of what you are seeing.
#31
So, the "Ryoh leaves northeast" I can handle in a couple of ways though doing it on the packet level might be better.

The niggling problem is when the mud sends an extra message when you enter a room from a specific direction. It bundles that extra bit along with the room desc, exits and my next prompt all into one packet:

Here's an example room in standard output:


648/648 3 142218 22724 off undrugged [0] > 
s
You enter the SWmud Hall of Fame.
The lobby of the Hall of Fame is a huge circular room which dwarfs even the tallest of Wookiees. An intricate pattern of stained glass fills the
ceiling above you and a polished marble floor lies underfoot. The Great Hall lies to the south, while a bar is located to the east for those wishing
to relax a bit during their visit to the Hall of Fame.
 
The smell of freshly-mixed drinks drifts in from the east.

Music from across the Star Wars galaxy is being piped in over the intercom.

There are three obvious exits: south, north, and east.

An important-looking sign is here.

648/648 3 142218 22724 off undrugged [0] >


from the north vs from the east


648/648 3 142218 22724 off undrugged [0] > 
w
The lobby of the Hall of Fame is a huge circular room which dwarfs even the tallest of Wookiees. An intricate pattern of stained glass fills the
ceiling above you and a polished marble floor lies underfoot. The Great Hall lies to the south, while a bar is located to the east for those wishing
to relax a bit during their visit to the Hall of Fame.
 
The smell of freshly-mixed drinks drifts in from the east.

Music from across the Star Wars galaxy is being piped in over the intercom.

There are three obvious exits: south, north, and east.

An important-looking sign is here.

648/648 3 142218 22724 off undrugged [0] >


It's that extra chunk "You enter the SWmud Hall of Fame." that will cause the mapper to think both of the above examples are two different rooms, when they aren't. In fact, if you enter this particular from from the south, you'll get a different entrance message, causing poor mapper to think there are three rooms.

Alas, that extra chunk is not sent in its own packet; it comes bundled with the rest of the room and my next prompt in one packet:


when room entered from the north:
------------------------------------------------------------
You enter the SWmud Hall of Fame.\1b[0m
\1b[0mThe lobby of the Hall of Fame is a huge circular room which dwarfs even the tallest of Wookiees. An intricate pattern of stained glass fills the\1b[0m
ceiling above you and a polished marble floor lies underfoot. The Great Hall lies to the south, while a bar is located to the east for those wishing\1b[0m
to relax a bit during their visit to the Hall of Fame.\1b[0m
 \1b[0m
\1b[0m\1b[1m\1b[33mThe smell of freshly-mixed drinks drifts in from the east.\1b[0m
\1b[1m\1b[33m\1b[0m
\1b[1m\1b[33m\1b[0m\1b[32mMusic from across the Star Wars galaxy is being piped in over the intercom.\1b[0m
\1b[32m\1b[0m
\1b[32m\1b[0m\1b[36mThere are three obvious exits: south, north, and east.\1b[0m
\1b[36m\1b[0m
\1b[36m\1b[0m\1b[37mAn important-looking sign is here.\1b[0m
\1b[37m\1b[0m
\1b[37m\1b[0m\1b[38;5;82m648\1b[0m/\1b[38;5;82m648\1b[0m \1b[38;5;34m3\1b[0m 142218 22724 off \1b[38;5;82mundrugged\1b[0m \1b[1m\1b[37m\1b[0m[0] > \1b[0m\ff\f9
------------------------------------------------------------

when room entered from the east:
------------------------------------------------------------
The lobby of the Hall of Fame is a huge circular room which dwarfs even the tallest of Wookiees. An intricate pattern of stained glass fills the\1b[0m
ceiling above you and a polished marble floor lies underfoot. The Great Hall lies to the south, while a bar is located to the east for those wishing\1b[0m
'"to relax a bit during their visit to the Hall of Fame.\1b[0m
 \1b[0m
\1b[0m\1b[1m\1b[33mThe smell of freshly-mixed drinks drifts in from the east.\1b[0m
\1b[1m\1b[33m\1b[0m
\1b[1m\1b[33m\1b[0m\1b[32mMusic from across the Star Wars galaxy is being piped in over the intercom.\1b[0m
\1b[32m\1b[0m
\1b[32m\1b[0m\1b[36mThere are three obvious exits: south, north, and east.\1b[0m
\1b[36m\1b[0m
\1b[36m\1b[0m\1b[37mAn important-looking sign is here.\1b[0m
\1b[37m\1b[0m
\1b[37m\1b[0m\1b[38;5;82m648\1b[0m/\1b[38;5;82m648\1b[0m \1b[38;5;34m3\1b[0m 142218 22724 off \1b[38;5;82mundrugged\1b[0m \1b[1m\1b[37m\1b[0m[0] > \1b[0m\ff\f9
------------------------------------------------------------

when room entered from the south:
------------------------------------------------------------
You climb the stairs back to the lobby.\1b[0m
\1b[0mThe lobby of the Hall of Fame is a huge circular room which dwarfs even the tallest of Wookiees. An intricate pattern of stained glass fills the\1b[0m
ceiling above you and a polished marble floor lies underfoot. The Great Hall lies to the south, while a bar is located to the east for those wishing\1b[0m
to relax a bit during their visit to the Hall of Fame.\1b[0m
 \1b[0m
\1b[0m\1b[1m\1b[33mThe smell of freshly-mixed drinks drifts in from the east.\1b[0m
\1b[1m\1b[33m\1b[0m
\1b[1m\1b[33m\1b[0m\1b[32mMusic from across the Star Wars galaxy is being piped in over the intercom.\1b[0m
\1b[32m\1b[0m
\1b[32m\1b[0m\1b[36mThere are three obvious exits: south, north, and east.\1b[0m
\1b[36m\1b[0m
\1b[36m\1b[0m\1b[37mAn important-looking sign is here.\1b[0m
\1b[37m\1b[0m
\1b[37m\1b[0m\1b[38;5;82m648\1b[0m/\1b[38;5;82m648\1b[0m \1b[38;5;34m3\1b[0m 142218 22724 off \1b[38;5;82mundrugged\1b[0m \1b[1m\1b[37m\1b[0m[0] > \1b[0m\ff\f9
------------------------------------------------------------


Somehow, (and I'm sure there's some oddball room that doesn't conform), it'd have to catch back to back "\1b[0m" or something.

I'm curious as to what the # in [0m, [37m, etc is referring to.
Amended on Fri 17 Jan 2020 02:27 PM by Clafoutis
Australia Forum Administrator #32
I can't see a # symbol, you mean the number? That is the ANSI colour code:


// ANSI Colour Codes

#define ANSI_RESET             0
#define ANSI_BOLD              1
#define ANSI_BLINK             3
#define ANSI_UNDERLINE         4
#define ANSI_SLOW_BLINK        5
#define ANSI_FAST_BLINK        6
#define ANSI_INVERSE           7
#define ANSI_STRIKEOUT         9

#define ANSI_CANCEL_BOLD      22
#define ANSI_CANCEL_BLINK     23
#define ANSI_CANCEL_UNDERLINE 24
#define ANSI_CANCEL_SLOW_BLINK  25
#define ANSI_CANCEL_INVERSE   27
#define ANSI_CANCEL_STRIKEOUT 29

#define ANSI_TEXT_BLACK       30
#define ANSI_TEXT_RED         31
#define ANSI_TEXT_GREEN       32
#define ANSI_TEXT_YELLOW      33
#define ANSI_TEXT_BLUE        34
#define ANSI_TEXT_MAGENTA     35
#define ANSI_TEXT_CYAN        36
#define ANSI_TEXT_WHITE       37
#define ANSI_TEXT_256_COLOUR  38

#define ANSI_SET_FOREGROUND_DEFAULT 39

#define ANSI_BACK_BLACK       40
#define ANSI_BACK_RED         41
#define ANSI_BACK_GREEN       42
#define ANSI_BACK_YELLOW      43
#define ANSI_BACK_BLUE        44
#define ANSI_BACK_MAGENTA     45
#define ANSI_BACK_CYAN        46
#define ANSI_BACK_WHITE       47
#define ANSI_BACK_256_COLOUR  48

#define ANSI_SET_BACKGROUND_DEFAULT 49


And \1b is ESC (escape). So this line:


\1b[0m\1b[1m\1b[33mThe smell of freshly-mixed drinks drifts in from the east.\1b[0m


Means:


ANSI_RESET / ANSI_BOLD / ANSI_TEXT_YELLOW (message) ANSI_RESET


And the troubling extra line is this:


You enter the SWmud Hall of Fame.\1b[0m


Note that it does not start with an ANSI_RESET nor a colour code.

So it seems in general that the room description lines (except the blank ones) conform to the pattern:


ESC [ (some number) m (Some description) ESC [ 0 m


The exception seems to be entering from the east, which is puzzling. Did you not copy the full packet? There is no message about "You enter from the east".
Australia Forum Administrator #33
I had a quick play on SWmud, and didn't see any messages like "You enter the SWmud Hall of Fame.".

And certainly the room descriptions did not always start with the ANSI_RESET.

However, if you are expecting a room description, and the first line is long (say, over 70 characters) then it is probably the first line of a description, and not a message about how you got there.

In the lines that I saw there were no blank lines in the middle of the description.
Australia Forum Administrator #34
From your test data:


You enter the SWmud Hall of Fame.\1b[0m
\1b[0mThe lobby of the Hall of Fame is a huge circular room which dwarfs even the tallest of Wookiees. An intricate pattern of stained glass fills the\1b[0m
ceiling above you and a polished marble floor lies underfoot. The Great Hall lies to the south, while a bar is located to the east for those wishing\1b[0m
to relax a bit during their visit to the Hall of Fame.\1b[0m
 \1b[0m


  • First line does not start with \1b[0m
  • Second line does start with \1b[0m\
  • Description ends with line being: (space)\1b[0m


Therefore discard the first line. Description is remaining lines up to the line with (space)\1b[0m


The lobby of the Hall of Fame is a huge circular room which dwarfs even the tallest of Wookiees. An intricate pattern of stained glass fills the\1b[0m
ceiling above you and a polished marble floor lies underfoot. The Great Hall lies to the south, while a bar is located to the east for those wishing\1b[0m
'"to relax a bit during their visit to the Hall of Fame.\1b[0m
 \1b[0m


  • First line does not start with \1b[0m
  • Second line does not start with \1b[0m\
  • Description ends with line being: (space)\1b[0m


Therefore keep all lines up to the line with (space)\1b[0m

Remember, this stuff is computer-generated. It will tend to have a pattern.

For example, the line at the end of the description with a leading space is probably a quirk, but a useful one from your point of view.

See here for example:


You are standing in a rather large building just south of a dock that many\1b[0m
beings are entering from.  You hear the hum of thrusters as a ship takes off and\1b[0m
another lands, depositing more people on the dock.  They enter from the north\1b[0m
and make their way past you.  There is a large sign that has something written\1b[0m
in many different languages on it.  You locate one that you can understand, and\1b[0m
it reads: 'Imperial City Customs'.  There is a hallway to the south which leads\1b[0m
to the \1b[1m\1b[32mInformation Center \1b[0mand the \1b[1m[33mSimulation Center\1b[0m.  At the end of the hallway\1b[0m
is the door that will take you to the streets of Imperial City.\1b[0m
\1b[0m
There is also a map that you can look at in most areas of Imperial City, so that\1b[0m
you know where you are going.  Just <\1b[1m\1b[36mlook map\1b[0m> to see it.\1b[0m
 \1b[0m


There is a blank line in the description, but the end of the description has a blank line with a leading space. So, you can tell the difference.
Amended on Sat 18 Jan 2020 12:09 AM by Nick Gammon
#35
Nick Gammon said:

I can't see a # symbol, you mean the number? That is the ANSI colour code:


I did mean the number; thanks this was very informative.

Nick Gammon said:

The exception seems to be entering from the east, which is puzzling. Did you not copy the full packet? There is no message about "You enter from the east".


The exception is indeed entering from the east. I copied the full packet. So let me back up a second:

Most rooms do not have these extra 'entrance' messages, although a handful do. I specifically chose this room as an example because it had not merely one entrance message, but two (one for entering north and one for south respectively) as well as a third direction that has no such entrance message.

As such, I intended to highlight the difference.

Nick Gammon said:

In the lines that I saw there were no blank lines in the middle of the description.


So you're right, most rooms do not. Technically SWmud rooms are formatted something like:


Short Desc (or what we'd think of as a room name)
Long Desc (or room desc; [1])

Smell Desc (optional and infrequent)

Sound Desc (optional and infrequent)

Exits

Room contents (mobs and objects)

Prompt


[1] effectively you either see the Short Desc (brief mode) or Long Desc plus optional descs (verbose mode), but not both. Not sure why but that's how it is.

Now, just because there's always an exception somewhere, you have a room like this:


This is the lobby of the commercial tower of Imperial City.  In this tower you will find many vendors to purchase from and sell to.  The main shop is
located here in the lobby, and a shopkeeper patiently waits behind the counter to either buy from you or sell something to you.

Type 'panic shop' for more information.
 
There are four obvious exits: south, northeast, west, and up.

Shop Keeper

Trashcan is here.

648/648 3 142218 6962 off undrugged [0] >


That 'Type 'panic shop' for more information' isn't one of the optional descs; it's just there you've got a blank line in the middle of the basic room desc, because that's how the author wrote it I guess. The converted packet:

------------------------------------------------------------
This is the lobby of the commercial tower of Imperial City. In this tower you will find many vendors to purchase from and sell to. The main shop is\1b[0m
located here in the lobby, and a shopkeeper patiently waits behind the counter to either buy from you or sell something to you.\1b[0m
\1b[0m
Type 'panic shop' for more information.\1b[0m
\1b[0m
\1b[0m\1b[36mThere are four obvious exits: south, northeast, west, and up.\1b[0m
\1b[36m\1b[0m
\1b[36m\1b[0m\1b[1m\1b[37mShop Keeper\1b[0m
\1b[1m\1b[37m\1b[0m
\1b[1m\1b[37m\1b[0m\1b[37mTrashcan is here.\1b[0m
\1b[37m\1b[0m
\1b[37m\1b[0m\1b[38;5;82m648\1b[0m/\1b[38;5;82m648\1b[0m \1b[38;5;34m3\1b[0m 142218 6962 off \1b[38;5;82mundrugged\1b[0m \1b[1m\1b[37m\1b[0m[0] > \1b[0m\ff\f9
------------------------------------------------------------

Now, all that said, so far blank lines the middle of things haven't really been a problem on any of the various solutions tried. Mostly the room desc and any optional descs seem to get pulled into the mapper script and any blank lines in the middle seem to just get discarded.
Amended on Sat 18 Jan 2020 02:53 AM by Clafoutis
#36
I'll look at more packets, but I think you've highlighted the pattern for entrance messages as something like:

[line]\1b[0m
\1b[0m

as distinct from other cases where there is a space before the second \1b[0m.

Hmm, something like:

^.*\1b[0m\n\1b1[0m

but, I've used OnPluginPacketReceived once before, but it was it's own self-contained script. I'm not sure how to integrate this with the extant triggers.

Maybe get rid of the triggers altogether and do everything as part of a script?
#37
I'll look at more packets, but I think you've highlighted the pattern for entrance messages as something like:


[line]\1b[0m
\1b[0m


as distinct from other cases where there is a space before the second \1b[0m.

Hmm, something like:


^.*\1b[0m\n\1b[0m


I've used OnPluginPacketReceived once before, but it was it's own self-contained script. I'm not sure how to integrate this with the extant triggers.

Maybe get rid of the triggers altogether and do everything as part of a script?
Amended on Sat 18 Jan 2020 03:24 AM by Clafoutis
Australia Forum Administrator #38
I've had a bit of an attempt at making the mapper work for SWmud.

You can grab a copy here:

Template:gitplugin=SWmud mapper
To save and install the SWmud mapper plugin do this:
  1. Go to the GitHub page: SWmud mapper.xml
  2. Select all the page and copy it to the Clipboard
  3. Open a text editor (such as Notepad) and paste the plugin into it
  4. Save to disk on your PC, preferably in your plugins directory, as: SWmud mapper.xml
    • The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
  5. Go to the MUSHclient File menu -> Plugins
  6. Click "Add"
  7. Choose the file SWmud mapper.xml (which you just saved in step 4) as a plugin
  8. Click "Close"
  9. Save your world file, so that the plugin loads next time you open it.

The main GitHub page for this plugin is at: https://github.com/nickgammon/plugins/blob/master/SWmud mapper.xml.

There you will find the commit history and other information.



This is what is looks like after I did a bit of exploring with the "guest" login.



I didn't capture room names, I didn't know how to activate the short names, but I'll leave that as an exercise.

If you are having problems, uncomment the ColourNote in the DEBUG function, and see what it reports.

One little issue is that the exits line can be split up into two lines if there are a lot of them, so I made two triggers to handle that.

I haven't tested the "Ryoh leaves northeast" stuff, but there is code that should (hopefully) work.

It seems to take about two visits to a room to have the linking between them set up correctly. The first visit detects the new room, the second visit tracks which room it took to get there, and which exit takes you back.
Amended on Sat 18 Jan 2020 06:13 AM by Nick Gammon
#39
Nick Gammon said:

I've had a bit of an attempt at making the mapper work for SWmud.


This is far too kind.

I know I had concerns about what to do once I'd actually grabbed a packet but this lays out how to surgically dissect everything. Very informative.

Nick Gammon said:

I didn't capture room names, I didn't know how to activate the short names, but I'll leave that as an exercise.


I don't know that there's all that much that can be done. One can get the mud to either show you the room names or the full room descriptions but not both at the same time. I suppose I could try to write some command to manually assign room names but that'd be really tedious and honestly, the room names aren't essential.

I did submit a request to the coders for a mode where both could be displayed at the same time but it's probably low priority, if they even consider it worth their time.

Nick Gammon said:

I haven't tested the "Ryoh leaves northeast" stuff, but there is code that should (hopefully) work.


As far as I can see, this works great, thanks.

On a related note, that other room where you get different entrance messages depending on what direction you come from: I notice on the map you posted you stopped just short of going in there, but your code handles it wonderfuly.

Nick Gammon said:

It seems to take about two visits to a room to have the linking between them set up correctly.


This is fine; all the various attempts throughout this thread function this way and once the map is drawn out, it's a non-issue.

***

Rooms that have the same room description, usually either as filler or maze, throw the all iterations of the mapper off, but I'm pretty sure that's a known thing and there's not much to be done about it.

***

The one new wrinkle, and I have to stress that this is pretty great as is, is a couple of the rooms take more than one packet(?) to communicate to the client.

Both of the below chunks seem to have the same packet #, 497, but they're clearly handled in discrete chunks so my terminology is probably inaccurate.

3e, n of your position on the map png you linked:


Incoming packet: 497 (1024 bytes) at Saturday, January 18, 2020, 12:58:00 PM
------------------------------------------------------------
Welcome to the new Down on the Upside Cafe. Looking around in the dim room you find comfy couches together in pairs to promote discussion and\1b[0m
togetherness.  Small glass tables rest nearby for those hot drinks you can order from the waitress who undoubtedly must also be a struggling artist. A\1b[0m
rolling fire near the south end is surrounded by a few large pillows and a few good books on the mantle. The western wall has a small stage with a\1b[0m
microphone and chair for poets, musicians and storytellers to entertain and enlighten the crowd. A large board has a 'list' of items on it for you to\1b[0m
order. There is a door to the south, which seems to lead back to the street. There is also a stairwell going down, which Jennette only allows certain\1b[0m
people access to.\1b[0m
 You may also use the bulletin board here to post stories, jokes, and anything of artistic value for others to read.\1b[0m
 \1b[0m
\1b[0m\1b[32mSoft music of some foreign origin plays over the speakers.\1b[0m
\1b[32m\1b[0m
\1b[32m\1b[0m\1b[36mThere are
------------------------------------------------------------

Incoming packet: 497 (304 bytes) at Saturday, January 18, 2020, 12:58:00 PM
------------------------------------------------------------
 two obvious exits: south and down.\1b[0m
\1b[36m\1b[0m
\1b[36m\1b[0m\1b[1m\1b[37mJennette\1b[0m
\1b[1m\1b[37m\1b[0m
\1b[1m\1b[37m\1b[0m\1b[37m\1b[31m* \1b[38;5;208mExpression Board\1b[31m *\1b[0m is here.\1b[0m
\1b[0m
\1b[0m\1b[38;5;82m648\1b[0m/\1b[38;5;82m648\1b[0m \1b[38;5;34m3\1b[0m 142218 5812 off \1b[38;5;82mundrugged\1b[0m \1b[1m\1b[37m\1b[0m[0] > \1b[0m\ff\f9
------------------------------------------------------------


to which the DEBUG function responds with:

exits: south and down
Size of last packet is 304
Cannot find end of description
Amended on Sat 18 Jan 2020 07:42 PM by Clafoutis
Australia Forum Administrator #40

Both of the below chunks seem to have the same packet #, 497, but they’re clearly handled in discrete chunks so my terminology is probably inaccurate.

It didn’t happen to me, but I adjusted the packet capturing to combine multiple packets with the same number. It’s something to do with MCCP I think.

I’ve made a few improvements, follow the earlier link to find the updated version.

  • Debugging messages are separated into information and warnings, so you can have warnings on but information off (the default)

  • The mapper find function now shows the matching words in a line under the room number, eg. finding “this is”

    6F320D07 - 5 rooms away
    This is the lush lobby of the Imperial Complex. ...
    D00C1746 - 7 rooms away
    This is the northern end of Imperial Square. ...
    FC758C42 - 7 rooms away
    This is the southern end of Imperial Square. ...
    FE3A1426 - 8 rooms away
    This is the lobby of the commercial tower ...
    2A61A3FD - 9 rooms away
    This is the great storage room where diplomats ...

    This is handy if you are trying to find a shop or something

  • Added “mapper goto xxx” where xxx is the room ID. You can specify a partial ID, so if you remember your favourite room as 20D4773602E4EE62CD72A52D2 then you could type “mapper goto 20d47”.

  • Added the first sentence of the room description to the hover message when you mouse-over a room in the map. This should help identify rooms.

  • Combined two packets with the same packet number

#41
Wow, this works wonderfully. Better than anything I could hope to cobble together. Thank you so much.
#42
Having minions follow you creates duplicate rooms, which is really weird as looking at the packets, I would have thought the code that dealt with eliminating 'entrance messages' would have dealt with this.


------------------------------------------------------------
Your Bodyguard enters.\1b[0m
\1b[0mKRT-W91 enters.\1b[0m
\1b[0mR4-PJ4 enters.\1b[0m
\1b[0mB2-V3G5 enters.\1b[0m
\1b[0mB2-R6Q6 enters.\1b[0m
\1b[0mS9E-X1 enters.\1b[0m
\1b[0mYou are standing in a narrow hallway in the hidden Rebel base on Hoth. The walls are plain and white. Temporary lighting has been rigged in the\1b[0m
hallways. The hallway extends north to an intersection and south into the main hangar bay.\1b[0m
 \1b[0m
\1b[0m\1b[36mThere are two obvious exits: south and north.\1b[0m
\1b[36m\1b[0m
\1b[36m\1b[0m\1b[1m\1b[37mYour Bodyguard\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37mRebel Soldier\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37m\1b[1m\1b[37m\1b[1m\1b[37mB2-R6Q6\1b[0m [Listening]\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37mS9E-X1\1b[0m [Listening]\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37mKRT-W91\1b[0m [Listening]\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37mB2-V3G5\1b[0m [Listening]\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37mR4-PJ4\1b[0m [Listening]\1b[0m
\1b[0m
\1b[0m\1b[38;5;82m648\1b[0m/\1b[38;5;82m648\1b[0m \1b[38;5;40m2\1b[0m 143257 19489 off \1b[38;5;82mundrugged\1b[0m \1b[1m\1b[37m\1b[0m[0] > \1b[0m\ff\f9
------------------------------------------------------------

creates a separate entry from: 

------------------------------------------------------------
You are standing in a narrow hallway in the hidden Rebel base on Hoth. The walls are plain and white. Temporary lighting has been rigged in the\1b[0m
hallways. The hallway extends north to an intersection and south into the main hangar bay.\1b[0m
 \1b[0m
\1b[0m\1b[36mThere are two obvious exits: south and north.\1b[0m
\1b[36m\1b[0m
\1b[36m\1b[0m\1b[1m\1b[37mYour Bodyguard\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37mRebel Soldier\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37m\1b[1m\1b[37m\1b[1m\1b[37mB2-R6Q6\1b[0m [Listening]\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37mS9E-X1\1b[0m [Listening]\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37mKRT-W91\1b[0m [Listening]\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37mB2-V3G5\1b[0m [Listening]\1b[0m
\1b[1m\1b[37m\1b[1m\1b[37mR4-PJ4\1b[0m [Listening]\1b[0m
\1b[0m
\1b[0m\1b[38;5;82m648\1b[0m/\1b[38;5;82m648\1b[0m \1b[38;5;40m2\1b[0m 143257 19489 off \1b[38;5;82mundrugged\1b[0m \1b[1m\1b[37m\1b[0m[0] > \1b[0m\ff\f9
------------------------------------------------------------
Amended on Sun 19 Jan 2020 03:51 AM by Clafoutis
Australia Forum Administrator #43

Rooms that have the same room description, usually either as filler or maze, throw the all iterations of the mapper off, but I’m pretty sure that’s a known thing and there’s not much to be done about it.

Yep, there isn’t much you can do unless you convince the MUD admins to send room numbers. They will probably resist, but I’m not sure what the point is. They may not like mappers, but the mapper as it stands would let you explore 90% of the rooms (hopefully) so that particular battle has already been lost.

Australia Forum Administrator #44

Having minions follow you creates duplicate rooms, which is really weird as looking at the packets, I would have thought the code that dealt with eliminating ‘entrance messages’ would have dealt with this.

It will only deal with the first line. I suggest for this specific case you simply have a find/replace (string.gsub) that eliminates the minion messages from the (copy of the) packet.

#45
after

  last_packet = string.gsub (last_packet, "\r\n", "\n") -- get rid of carriage returns

I added:

  last_packet = string.gsub (last_packet, "^.* enters\.\027%[0m\n", "") -- get rid of minion messages
  
  print (last_packet)

the print isn't neccesary of course but it helped me get the regex right.

So this seems to work getting results such as:

(print results; slightly different from packet_convert)

entering the room:

[0mYou are looking at the controls of the Sluissi shuttle model 7000. This ship is especially designed for cargo transport, but without the hold[0m
installed, it will not be able to carry much. When the hold is in fact installed it can be found to your west. [0m
 [0m
[0m[36mThere are two obvious exits: exit and west.[0m
[36m[0m
[36m[0m[1m[37mYour Bodyguard[0m
[1m[37m[1m[37m[1m[37mB2-R6Q6[0m [Listening][0m
[1m[37m[1m[37mS9E-X1[0m [Listening][0m
[1m[37m[1m[37mKRT-W91[0m [Listening][0m
[1m[37m[1m[37mB2-V3G5[0m [Listening][0m
[1m[37m[1m[37mR4-PJ4[0m [Listening][0m
[0m
[0m[38;5;82m648[0m/[38;5;82m648[0m [38;5;40m2[0m 626106 33139 off [38;5;82mundrugged[0m [1m[37m[0m[0] > [0mÿù


looking at the room:

You are looking at the controls of the Sluissi shuttle model 7000. This ship is especially designed for cargo transport, but without the hold[0m
installed, it will not be able to carry much. When the hold is in fact installed it can be found to your west. [0m
 [0m
[0m[36mThere are two obvious exits: exit and west.[0m
[36m[0m
[36m[0m[1m[37mYour Bodyguard[0m
[1m[37m[1m[37m[1m[37mB2-R6Q6[0m [Listening][0m
[1m[37m[1m[37mS9E-X1[0m [Listening][0m
[1m[37m[1m[37mKRT-W91[0m [Listening][0m
[1m[37m[1m[37mB2-V3G5[0m [Listening][0m
[1m[37m[1m[37mR4-PJ4[0m [Listening][0m
[0m
[0m[38;5;82m648[0m/[38;5;82m648[0m [38;5;40m2[0m 626106 33139 off [38;5;82mundrugged[0m [1m[37m[0m[0] > [0mÿù


They're *almost* identical but there's an extra [0m in the first case; however this does not seem to matter to the mapper. It treats both cases as identical and does not create erroneous extra room entries. I'll test further but initial tests look positive.

I did note something subtle you said re:entrance messages
Nick Gammon said:

It will only deal with the first line.


In that, I have found that indeed, many entrace messages come first and the code handles that great. However, there are a couple of weird instances
where it will add something after the minions but before the room description. On the other hand, they seem to be systematic and predicatable (entering and leaving ships, very rare lighting cues) as opposed to whimsical things unique to a room; therefore they ought to be easy to weed out with further string.gsub and increasing rare as they get found and weeded out.
Amended on Sun 19 Jan 2020 07:21 PM by Clafoutis
Australia Forum Administrator #46

I’m glad it is working so well.

They’re almost identical but there’s an extra [0m in the first case; however this does not seem to matter to the mapper. It treats both cases as identical and does not create erroneous extra room entries. I’ll test further but initial tests look positive.

This line strips the ANSI sequences, which the additional ANSI_RESET would be one of, so the end result is identical lines.

  -- get rid of ANSI codes
  description = StripANSI (description)
Australia Forum Administrator #47
@Clafoutis: I'm getting some bounced email messages from your email address: (reason: 550 5.1.1 User unknown)
#48
Nick Gammon said:

@Clafoutis: I'm getting some bounced email messages from your email address: (reason: 550 5.1.1 User unknown)


I'm receiving email notifications whenever this thread is updated, so that's going through.

I checked my profile and it looks like my correct address, but I didn't see an option to change it to an alternate address if the current one is causing issues.
Australia Forum Administrator #49

I decided to make a more generic solution to the problem of people wanting to add the mapper to their MUDs.

See Nick’s Learning Mapper.

It works on SWmud (or seems to) plus it has a few other options like marking rooms as shops, adding notes, and so on.

#50
I spent a decent portion of yesterday training this on SWmud, and it's fantastic. All the stubborn, niggling little nuances that plagued me, here a little bit of training and it's got it sorted it out.

I'm blown away. Thank you so much.
Australia Forum Administrator #51
Make sure you do backups, in case things go wrong later.


mapper export map
mapper export corpus