So, it is actually fairly similar here. Though I recommend using the “shift” command to slide rooms around on the map via text rather than dragging with the mouse (sometimes using the mouse makes unpleasant errors I don’t understand). So just “shift n” or whatever appropriate direction, then “merge rooms” to combine them.
By the way, the most common reason for rooms to fail to merge automatically is doors. If there is an exit that doesn’t show up the first time, due to a door, then it shows up later because the door is open, then suddenly you have a room with an extra exit, so it assumes it is a new room with an identical name (not exactly an uncommon situation). So I recommending adding doors when you make a new room (“add door n”, for example).
Generic Mapping Script
-
- Posts: 7
- Joined: Thu Nov 02, 2017 10:25 pm
Re: Generic Mapping Script
Fortunately, I have been around since early mud mappers and have learned not to expect anything to work "easily" .
That being said, I have had quite and easy time mapping since we got some things tweaked a bit. The biggest being my brain.
The addition of the move fail trigger has done wonders. If I come across a new failure, I just stop mapping and add a line to the trigger before I get to far off.
Thanks for the help thus far
That being said, I have had quite and easy time mapping since we got some things tweaked a bit. The biggest being my brain.
The addition of the move fail trigger has done wonders. If I come across a new failure, I just stop mapping and add a line to the trigger before I get to far off.
Thanks for the help thus far
-
- Posts: 7
- Joined: Thu Nov 02, 2017 10:25 pm
Re: Generic Mapping Script
Is there a way to attach a command to an exit?
example: "open <direction> door"
example: "open <direction> door"
Re: Generic Mapping Script
Not entirely sure what you mean. Do you mean for when it gives you directions from point A to point B, so that instead of just telling you to go east, it says to open the door to the east?
Assuming that is what you are talking about, then that would end up being something you would need to code into the doSpeedWalk function down near the very bottom of the script. Right now, it just prints out directions, but it is intended to actually move you from room to room. Due to the differences in how movement is handled in different games, that particular function was left to be filled in as needed for each game. Assuming you aren't looking for something special (meaning that "open e door" or "open east door" would work for you all the time), then it shouldn't be a problem to do that automatically.
In the doSpeedWalk function, you will see speedWalkPath and speedWalkDir referenced. They are tables with the roomIDs and the direction to move to go from that room to the next one, respectively. You can use the getDoors function to get a table of doors in a room, and use the exit direction to check if there is a door that way, like this: getDoors(speedWalkPath[n])[speedWalkDir[n]]
Assuming that 'n' is your index variable as you go along the path, that call should return one of 4 values: nil (meaning no door), 1 (open door), 2 (closed door), or 3 (locked door). Note that you have to set the state of the door yourself when you add it with the "add door" command. Based on what is returned, you can decide what additional commands you need to send before sending the actual move command, or how you need to adjust the movement command, if that is how things are done in your game.
If, on the other hand, you need some sort of special command to move in a given direction, I think the easier strategy would be to treat it as a portal, even if it really isn't one. When you add a portal, it will create a new room directly on top of the room you are currently in (unless it finds the connecting room the portal leads to), and add a special exit between them, for which a special entry command is used. For special exits, the command needed to use them is included, so you don't need to do anything special to handle them when it comes time to manage speed walking.
Assuming that is what you are talking about, then that would end up being something you would need to code into the doSpeedWalk function down near the very bottom of the script. Right now, it just prints out directions, but it is intended to actually move you from room to room. Due to the differences in how movement is handled in different games, that particular function was left to be filled in as needed for each game. Assuming you aren't looking for something special (meaning that "open e door" or "open east door" would work for you all the time), then it shouldn't be a problem to do that automatically.
In the doSpeedWalk function, you will see speedWalkPath and speedWalkDir referenced. They are tables with the roomIDs and the direction to move to go from that room to the next one, respectively. You can use the getDoors function to get a table of doors in a room, and use the exit direction to check if there is a door that way, like this: getDoors(speedWalkPath[n])[speedWalkDir[n]]
Assuming that 'n' is your index variable as you go along the path, that call should return one of 4 values: nil (meaning no door), 1 (open door), 2 (closed door), or 3 (locked door). Note that you have to set the state of the door yourself when you add it with the "add door" command. Based on what is returned, you can decide what additional commands you need to send before sending the actual move command, or how you need to adjust the movement command, if that is how things are done in your game.
If, on the other hand, you need some sort of special command to move in a given direction, I think the easier strategy would be to treat it as a portal, even if it really isn't one. When you add a portal, it will create a new room directly on top of the room you are currently in (unless it finds the connecting room the portal leads to), and add a special exit between them, for which a special entry command is used. For special exits, the command needed to use them is included, so you don't need to do anything special to handle them when it comes time to manage speed walking.
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: Generic Mapping Script
Just for the record there is a third table nowadays called speedWalkWeight that gives the effective cost/weight (either that of the destination room or the overriding weight set on the exit to it) for each step as well...
Re: Generic Mapping Script
Hi Jor'Mox,
Thanks for all your work on this, it's a great resource for the community!
I would like to modify the mapper script here to use MSDP, but I am having a difficult time deciding what I need to remove. My msdp.ROOM table looks like this:
It seems to me that having this data available would let me simplify the code significantly, since I am guaranteed to get the data every time I move. The exits also show which room vnum they are linked to.
Since I am an implementor on the MUD I can also add whatever info is helpful, like door info.
Would you mind providing a little direction as to how I can get your mapping script working with this MSDP data? Thanks!
Thanks for all your work on this, it's a great resource for the community!
I would like to modify the mapper script here to use MSDP, but I am having a difficult time deciding what I need to remove. My msdp.ROOM table looks like this:
Code: Select all
{
VNUM = "1208",
NAME = "A Room for Relaxing",
TERRAIN = "Inside",
EXITS = {
south = "1206"
},
AREA = "<*> Staff Simplex",
COORDS = {
Y = "0",
X = "0",
Z = "0"
}
}
Since I am an implementor on the MUD I can also add whatever info is helpful, like door info.
Would you mind providing a little direction as to how I can get your mapping script working with this MSDP data? Thanks!
Re: Generic Mapping Script
So, cutting down my script to fit your needs doesn't really make any sense, as you would need to cut out 90%+ of it. Mine is built around the idea of the game not giving any info, and having to work with just what the player sees, namely the room name and exits. With what you have available, a mapping script can actually be really simple. I whipped something up that I think will more or less work, after accounting for the fact that I have zero experience with MSDP.
Re: Generic Mapping Script
This is fantastic, thanks! I do think I would need some way to place the rooms as the coords data is not populated, every room is (0, 0, 0).
I guess I would use the previous room and check the exit vnums to see which direction I went, then add a corresponding vector to the coords of the previous room. This sound correct?
That would also mean I need a way to move rooms if there is a collision.
Thanks again for your help!
I guess I would use the previous room and check the exit vnums to see which direction I went, then add a corresponding vector to the coords of the previous room. This sound correct?
That would also mean I need a way to move rooms if there is a collision.
Thanks again for your help!
Re: Generic Mapping Script
Ah, seeing the coordinates in the table made me assume they were valid. Layout and collision management is a big part of what my script does, since as you are likely aware, game room layout doesn’t need to make sense spatially (i.e. 2n, 2e, 2s, 2w isn’t always going to land you back in the same room you started from). The basic strategy is basically just to try to place it where movement would dictate (in this case, pulling from previous room data would work, so you don’t need to capture movement commands). But since we know the room’s unique ID, we run into a bit of an issue if things don’t line up, and we make a connection between already existing rooms that aren’t positioned the way we would expect. Granted, the mapper itself will gladly make the connection happen, but it will look weird, so there needs to be a way to let the player shift a room around so things line up nicely (the logic necessary for doing something like that would be very complicated, especially in more complex areas, and impossible in areas that intentionally have less than logical room connections.
I can easily add in something to handle basic room placement, and a simple alias that will let people slide a room around from the command line.
I can easily add in something to handle basic room placement, and a simple alias that will let people slide a room around from the command line.
Re: Generic Mapping Script
That makes sense. I would really appreciate that!
I was thinking, to solve collisions, couldn't you theoretically cover most cases by doing the following:
1.) Check if the new room exists, if not, get the direction you travelled to get here.
2.) Add the vector, for example if the movement was east, add (1, 0, 0) to the previous coords.
3.) If collision, add the vector above to all rooms with x-coordinate equal to or greater that the new room's x-coordinate.
This would make an ugly map if you then had 10 rooms east but at least it would be a valid map.
What do you think?
I was thinking, to solve collisions, couldn't you theoretically cover most cases by doing the following:
1.) Check if the new room exists, if not, get the direction you travelled to get here.
2.) Add the vector, for example if the movement was east, add (1, 0, 0) to the previous coords.
3.) If collision, add the vector above to all rooms with x-coordinate equal to or greater that the new room's x-coordinate.
This would make an ugly map if you then had 10 rooms east but at least it would be a valid map.
What do you think?