Manual Speedwalking AddToMapper

Posted by Falgor on Tue 24 Aug 2021 08:21 PM — 4 posts, 13,856 views.

#0
I'm trying to use AddToMapper("north","south") but it is adding the directions in this format to my Mapper:

(/north)

reverse

(south/)

when I try to backtrack the route - it just executes empty lines.
Australia Forum Administrator #1
You realise this is nothing to do with the graphical mapper, right?

Anyway, I tested it. I typed:


AddToMapper("north","south")


And then verified with:


print (GetMappingString ())


And it printed:


(north/south) 


As expected.


Template:version
Please help us by advising the version of MUSHclient you are using. Use the Help menu -> About MUSHclient.
#2
Thanks for the reply Nick,

To add some more substance I'm trying to modify the Slow_Speedwalk plugin to add steps from that plugin to the auto-Mapper (so I can retrace steps).

The issue I'm coming into is that "walk_lines" in the plugin, although recognized as a type string isn't cooperating with any of my code trying to read it as such (that is why the example above was giving empty directions).

What I would like to achieve is the following in the Slow_Speedwalk.xml plugin.

Quote:

-- send the speedwalk
reverse_dirs = {north = "south", south = "north", west = "east", east = "west"}

Send (walk_line)

AddToMapper(walk_line, reverse_dirs[walk_line])


I was wrong in thinking AddtoMapper was broken, it is my understanding of lua that is, as always - not up to standard :)

As a side note, is there a way to edit the "standard directions" inside MUSHclient. I know I can add a special step via DoMapperSpecial but is there a way to the NWES directions to include (in/out) or should I just use an alias to achieve that?
Amended on Thu 26 Aug 2021 06:15 AM by Falgor
Australia Forum Administrator #3
It's hard coded and I'm reluctant to change it at this stage. You can do it in Lua, for example from elsewhere on this forum:



local 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
  
-- for calculating the way back
local inverse_direction = {
  n = "s",
  s = "n",
  e = "w",
  w = "e",
  u = "d",
  d = "u",
  ne = "sw",
  sw = "ne",
  nw = "se",
  se = "nw",
  ['in'] = "out",
  out = "in",
  }  -- end of inverse_direction


First you can "normalise" a direction by using the first table (so "up" becomes "u") and then use the second table to get the inverse direction.


"In" is done differently because it is a Lua keyword.