[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Manual Speedwalking AddToMapper

Manual Speedwalking AddToMapper

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


Posted by Falgor   (36 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,928 posts)  [Biography] 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
[Go to top] top

Posted by Falgor   (36 posts)  [Biography] 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?
[Go to top] top

Posted by Nick Gammon   Australia  (22,928 posts)  [Biography] 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
[Go to top] 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.


6,713 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]