Mapper

Posted by Copycatnebula on Wed 10 Aug 2022 08:37 PM — 6 posts, 16,859 views.

#0
I am trying to think through how I would create a function for the mapper that would allow validation if directions were possible from a roomid.

e.g. if the path I got was n, e, s, e, u is that possible from that room

mapper_validate ROOMID PATH

and have it return either the resultant room ID OR not possible.

Anyone have thoughts on how this best works with the functionality already implemented. I see a lot of room1-room2 path discovery but not a lot of if this path is possible from room 1 type capability. Maybe I am missing it.
USA Global Moderator #1
Starting from your current room and the first direction, check if the direction can be moved from that room, if so, look at the room in that direction and check the second direction, then the next room and the third direction, and so on. If you get through all of the directions, then yes, otherwise no.
#2
Fiendish said:

Starting from your current room and the first direction, check if the direction can be moved from that room, if so, look at the room in that direction and check the second direction, then the next room and the third direction, and so on. If you get through all of the directions, then yes, otherwise no.


I take this reply to mean there is no existing functionality within the mapper that I can leverage given a room id to determine where a path goes? I would have to custom code the entire capability vs utilizing existing function calls.
USA Global Moderator #3
Correct. What do you want it for anyway? It doesn't seem like it would be very useful on my MUD. What circumstance on yours calls for this?
Amended on Thu 11 Aug 2022 03:36 AM by Fiendish
#4
Fiendish said:

Correct. What do you want it for anyway? It doesn't seem like it would be very useful on my MUD. What circumstance on yours calls for this?


we are given random directions from a specific map location and need to find the room things are hidden in. Meaning given a set of possible starting points it would be nice to be able to calculate the possibilities.

Another is knowing which path your target took when viewing them with a spell it would be nice to quickly plug in the viewed roomID and the path they took to run and get back a room id to goto to find them.

The third reason is for validating speed paths that are created without actually walking them (which can be dangerous in some areas of our mud). So i can make a speedwalk and validate it from the room to ensure that I arrive where I expect.

Thanks for replying. I just wanted to make sure there wasn't built in functionality to harvest here vs writing an entirely new plugin. Sounds like i need to build a searcher that can iterate the directions and either get back "not possible" or "roomid"
Amended on Thu 11 Aug 2022 04:06 PM by Copycatnebula
Australia Forum Administrator #5

There is no such function, ie. “is this path valid?”.

However it wouldn’t be hard to write.

The function get_room (id) returns information about a room, including its exits. So you would do something like:

  1. id = starting_room
  2. n = 1 (first exit)
  3. room = get_room (id)
  4. see if room.exits [exit_list [n]] exists
  5. if so, add 1 to n, and make id = the room that the exit led to
  6. go back to (3) above until the list of exits is exhausted.