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

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Reverse Exits in Automapper
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Reverse Exits in Automapper

You need to log onto the forum to reply or create new threads.

  [Refresh] Refresh page


Posted by Emer   (2 posts)  [Biography] bio
Date Sun 10 Jun 2018 11:11 AM (UTC)

Amended on Sun 17 Jun 2018 10:00 AM (UTC) by Emer

Message
Hello,
I am trying to adapt the automapper for TempestSeason.
My latest attempt is here: https://github.com/EmerFox/Mushclient-Plugins-for-Tempest-Season-Mud/blob/master/Tempest_Season_MAP.xml

I want it to automatically add reverse exits when walking around. I can see how it is done in the Example Mapper but I can't figure out how to put them into the sqlite database.

I tried pasting this in at line 712:
  dbcheck (db:execute (string.format ([[
        UPDATE exits SET touid = %s WHERE fromuid = %s AND dir = %s;
      ]],
          fixsql  (from_room),     -- previous room
          fixsql  (current_room),  -- destination room
          fixsql  (inverse_direction.last_direction_moved)  -- inverse direction (eg. "s")
          )))
  
    room.exits [inverse_direction [last_direction_moved]] = from_room  


That just creates exits in both directions for every room eg if a room has exits north and east, it adds exits south and west too. How do I make it add reverse exits but only when I move?
[Go to top] top

Posted by Nick Gammon   Australia  (21,677 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 10 Jun 2018 09:13 PM (UTC)

Amended on Sun 10 Jun 2018 11:35 PM (UTC) by Nick Gammon

Message
This part is wrong:


       fixsql  (inverse_direction.last_direction_moved)  -- inverse direction (eg. "s")



To index into a table with a variable, you can't use the "dot notation" like that. That just looks for the key "last_direction_moved" not the variable (contents of last_direction_moved). It should be like your last line, in other words:


          fixsql  (inverse_direction [last_direction_moved])  -- inverse direction (eg. "s")

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Emer   (2 posts)  [Biography] bio
Date Reply #2 on Mon 11 Jun 2018 07:13 AM (UTC)
Message
Thank you. That makes sense.
I still have a problem with exits not being drawn properly and extra ones being drawn where they shouldn't exist but I think that is to do with the layout of the mud. There are some rooms with repeat names and descriptions and then there are lots of exits that are not compass directions eg go door, go path.
The owner seems keen to make the mud automappable but players can't see vnums so I'll ask him to change that.
[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.


167 views.

You need to log onto the forum to reply or create new threads.

  [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 FutureQuest]