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 ➜ Lua ➜ Reverse Exits in Automapper

Reverse Exits in Automapper

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


Posted by Emer   (2 posts)  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?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  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
Top

Posted by Emer   (2 posts)  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.
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.


10,056 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.