Showing doors in the mapper

Posted by Calamarain on Tue 21 Jun 2016 12:25 AM — 5 posts, 19,865 views.

#0
I've converted the Materia Magicka mapper to mostly work for Wotmud. Is there any way currently to graphically represent doors between rooms? I think cmud does it by drawing a small rectangle halfway on the line connecting two rooms.
Australia Forum Administrator #1
There is no support for that at present. You could conceivably modify the code that draws the line between rooms to add the extra line you speak of.

Of course, you would need to know (somehow) that the door is there in the first place.
#2
I've modified mapper.lua so that doors can be shown. However, I'd like to rename mapper.lua so that it won't potentially interfere with any mappers for other muds someone might be using. Renaming and requiring the new lua file gives the following errors:

The alias subroutine named "mapper.cancel_speedwalk" could not be found.
The alias subroutine named "mapper.zoom_out" could not be found.
The alias subroutine named "mapper.zoom_in" could not be found.
The alias subroutine named "mapper.hide" could not be found.
The alias subroutine named "mapper.show" could not be found.

Delete those aliases and this error message shows up.

Error number: 0
Event: Run-time error
Description: [string "Plugin"]:443: attempt to index global 'mapper' (a nil value)

stack traceback:

[string "Plugin"]:443: in function <[string "Plugin"]:429>
Called by: Function/Sub: OnPluginInstall called by Plugin Wotmud_Mapper

Reason: Executing plugin Wotmud_Mapper sub OnPluginInstall

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
  
  -- initialize mapper
  
  mapper.init { config = config, 
                get_room = get_room,
                show_help = OnHelp,         -- to show help
                room_click = room_click,    -- called on RH click on room square
                timing = show_timing,       -- want to see timing
                show_completed = show_completed,  -- want to see "Speedwalk completed." message
                show_other_areas = show_other_areas,  -- want to see areas other than the current one?
                show_up_down = show_up_down,          -- want to follow up/down exits?
                show_area_exits = show_area_exits,    -- want to see area exits?
                speedwalk_prefix = speedwalk_prefix,  -- how to speedwalk
  } 
  mapper.mapprint (string.format ("MUSHclient mapper installed, version %0.1f", mapper.VERSION))

  -- open databases on disk 
  db    = assert (sqlite3.open(GetInfo (66) .. Trim (WorldAddress ()) .. "_" .. WorldPort () .. ".db"))
  
  create_tables ()    -- create database structure if necessary

  --prevent possible startup crash
  EnableTrigger ("Name_Line", true)
  EnableTrigger ("Prompt_Name_Line", true)
  EnableTrigger ("Description_Or_Exits", false)
  EnableTrigger ("Exit_Line", false)
  
end -- OnPluginInstall
Australia Forum Administrator #3
In your plugin there should have been a line like this:


mapper = require "your_mapper"


You shouldn't change the variable name (the LH side of the assign) because that is the "internal" name which would be used by various aliases.
#4
Thanks, that fixed it.