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, 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.
 Entire forum ➜ MUSHclient ➜ Plugins ➜ Mapper: Road Distance

Mapper: Road Distance

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


Posted by Isolgrac   (3 posts)  Bio
Date Tue 12 May 2020 09:21 AM (UTC)
Message
I'm trying to get a mapper working on the mud I have just started playing, and along with all the usual issues I am also seeing an issue with differing road distances.

For example, a house with two rooms and a road round the outside might look like this:


[ ]--[ ]-------[ ]
 |              |
[ ]  [ ]--[ ]  [ ]
 |    |         |
[ ]--[ ]-------[ ]


Of course the mapper can't draw it cos the eastern road and the room need to draw in the same place.

Is there a way to tell the mapper to draw certain roads longer than others?

Thanks
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #1 on Tue 12 May 2020 06:22 PM (UTC)
Message
No

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 12 May 2020 10:07 PM (UTC)
Message
The mapper doesn't have any concept of road distances because the MUD doesn't supply that information.

- Nick Gammon

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

Posted by Isolgrac   (3 posts)  Bio
Date Reply #3 on Wed 13 May 2020 01:13 PM (UTC)

Amended on Wed 13 May 2020 01:39 PM (UTC) by Isolgrac

Message
Yes, indeed the distances have to be supplied manually, which is a bit tedious the first time round, but if you do it as you explore it's not too bad.

I've made some simple tweaks to mapper.lua which allow for different distances and it seems to work reasonably well.

Changes, for those who are interested, based on version 2.7 dated 1st Feb 2020

In function draw_room():

Line 548
Replace

  for dir, exit_uid in pairs (room.exits) do

with

  for dir, exit_data in pairs (room.exits) do
    local exit_uid
    local exit_distance
    if type(exit_data) == "table" then
      exit_uid = exit_data.touid
      exit_distance = exit_data.distance
    else
      exit_uid = exit_data
      exit_distance = 1
    end


Lines 599,600:
Replace

      local next_x = x + exit_info.at [1] * (ROOM_SIZE + DISTANCE_TO_NEXT_ROOM)
      local next_y = y + exit_info.at [2] * (ROOM_SIZE + DISTANCE_TO_NEXT_ROOM)

with

      local next_x = x + exit_info.at [1] * (ROOM_SIZE + DISTANCE_TO_NEXT_ROOM) * exit_distance
      local next_y = y + exit_info.at [2] * (ROOM_SIZE + DISTANCE_TO_NEXT_ROOM) * exit_distance



Line 657:
Replace

        if dest.exits [inverse_direction [dir]] ~= uid then

with

        local inv_exit_data = dest.exits [inverse_direction [dir]]
        local inv_uid
        if type(inv_exit_data) == "table" then
          inv_uid = inv_exit_data.touid
        else
          inv_uid = inv_exit_data
        end
        if inv_uid ~= uid then
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #4 on Wed 13 May 2020 01:48 PM (UTC)

Amended on Wed 13 May 2020 01:49 PM (UTC) by Fiendish

Message
I don't think that code will do much without also having a way to set, store, and load the desired distances.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Isolgrac   (3 posts)  Bio
Date Reply #5 on Wed 13 May 2020 02:21 PM (UTC)
Message
Well yes, obviously.

The client mapper code is responsible for sourcing the data and persisting it as required. Clearly you can't draw data you don't have. However, once I had obtained that data, I needed a way to draw it. What I have shown here is simply the changes I made to the publicly available drawing code in order to support this. If anyone else was having a similar problem, maybe this could help.

I don't have a way to automatically determine the distances, these I have to calculate and enter manually into my DB.

I forgot to mention, to use the distance drawing, you just have to define the exit as a table rather than just a string:
Instead of:

  room.exit[d] = uid

use:

  room.exit[d] = { touid = uid, distance = dist}


My changed version of mapper.lua is backwardly compatible and so would correctly handle either of the above
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #6 on Wed 13 May 2020 08:26 PM (UTC)
Message
Very good, thanks for sharing.

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


15,765 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.