Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Manual Speedwalking AddToMapper

Manual Speedwalking AddToMapper

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Falgor   (36 posts)  Bio
Date Tue 24 Aug 2021 08:21 PM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 24 Aug 2021 09:09 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Falgor   (36 posts)  Bio
Date Reply #2 on Thu 26 Aug 2021 06:12 AM (UTC)

Amended on Thu 26 Aug 2021 06:15 AM (UTC) by Falgor

Message
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?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 26 Aug 2021 08:26 PM (UTC)

Amended on Thu 26 Aug 2021 08:27 PM (UTC) by Nick Gammon

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

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


9,300 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.