Generic Mapping Script

All and any discussion and development of the Mudlet Mapper.
dilemma
Posts: 3
Joined: Thu Feb 22, 2018 5:58 pm

Re: Generic Mapping Script

Post by dilemma »

I'm a total noob when it comes to scripts and coding. I tried copying the script and activating it in mudlet. wasn't recording any of my movements. I'm used to oldschool zMud. haven't done any MUDing since the late 90's, early 2000's though and I'm banging my head against the wall trying to get the mapper to work. Should this script run AS-IS? or is it meant to be customized, as in, i'm expected to do coding to get it working? Any help would be great.

User avatar
Vadi
Posts: 5041
Joined: Sat Mar 14, 2009 3:13 pm

Re: Generic Mapping Script

Post by Vadi »

Just about what it says in the first paragraph, yes, you do need to adapt it to your game! Many games are completely different and unique in how they represent rooms, movement, what kind of abilities there are.

Give it a go, see how you do, and if you need any help, ask here!

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Generic Mapping Script

Post by Jor'Mox »

If you are completely new at things, I strongly recommend you use the command line code at the very bottom of the first post to download and install this script as a package, which includes some example triggers that are needed for making things work. Then at least you will have something to work with. I also recommend you read the documentation at the top of the script, as it explains how to use its various commands to make it work. Once you have working triggers to capture the room name, exits, and prompt, you should be able to use those to do all the things needed to map successfully.

Eraene
Posts: 42
Joined: Wed Nov 27, 2013 10:18 pm

Re: Generic Mapping Script

Post by Eraene »

Hi. I'm having an issue getting my mapper to follow me when I'm using an alternate method of movement. Like say, sailing. If I have to type "sail north" to move my ship north, how do I get my mapper to know to move me in the "north" direction?

User avatar
SlySven
Posts: 1022
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Generic Mapping Script

Post by SlySven »

Would a Special exit called "sail north" work - then it could be included in speed-walkssails? ;)

Eraene
Posts: 42
Joined: Wed Nov 27, 2013 10:18 pm

Re: Generic Mapping Script

Post by Eraene »

SlySven wrote:
Wed Mar 14, 2018 9:11 pm
Would a Special exit called "sail north" work - then it could be included in speed-walkssails? ;)
I'd rather not modify hundreds of rooms to include special sail exits, honestly.

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Generic Mapping Script

Post by Jor'Mox »

So, there are two possible strategies. The first is if there is some sort of message sent by the game when you are sailing that lets you know what direction you moved in, such as "You sail north.". If something to that effect exists, then you can trigger off of that, and make use of the "onForcedMove" event built into the script (this also works well for when you are following someone, and other similar situations where you really do move without entering a command). If there is no such message, then you can make a fairly small modification to the script to allow for the variant command. You would need to find the capture_move_cmd function within the script (around line 550), and add some code right before this line within it:
Code: [show] | [select all] lua
if table.contains(exitmap,dir) or string.starts(dir,"enter ") or dir == "recall" then
What you would need to add would be the following:
Code: [show] | [select all] lua
if string.starts(dir,"sail ") then dir = string.gsub(dir,"sail ","") end
Doing that will just strip the word "sail" from the command, making it look just like you had typed the direction normally.

Eraene
Posts: 42
Joined: Wed Nov 27, 2013 10:18 pm

Re: Generic Mapping Script

Post by Eraene »

Jor'Mox wrote:
Thu Mar 15, 2018 12:18 pm
So, there are two possible strategies. The first is if there is some sort of message sent by the game when you are sailing that lets you know what direction you moved in, such as "You sail north.". If something to that effect exists, then you can trigger off of that, and make use of the "onForcedMove" event built into the script (this also works well for when you are following someone, and other similar situations where you really do move without entering a command). If there is no such message, then you can make a fairly small modification to the script to allow for the variant command. You would need to find the capture_move_cmd function within the script (around line 550), and add some code right before this line within it:
Code: [show] | [select all] lua
if table.contains(exitmap,dir) or string.starts(dir,"enter ") or dir == "recall" then
What you would need to add would be the following:
Code: [show] | [select all] lua
if string.starts(dir,"sail ") then dir = string.gsub(dir,"sail ","") end
Doing that will just strip the word "sail" from the command, making it look just like you had typed the direction normally.
I did try the onForcedMove method, though for some reason it wasn't wanting to work. Because there is in fact a message like that. I'm not sure if it just didn't want to work that way, or I did something wrong.

Adding that line of code makes it work perfectly, though. Thank you!

Edit: I just realized onForcedMove didn't work because I had it in the wrong profile! But the second method is better.

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Generic Mapping Script

Post by Jor'Mox »

So, the code addition is actually less ideal than the onForcedMove strategy, given that there is an indication in game that you have sailed in a particular direction, for two reasons. The first is simply that in the event you need to update your script at some later point, you will have to remember to maintain this code change through the update. The second, and much more significant, is that if you use this code addition AND the onForcedMove strategy (so you can track movement when someone else is sailing a ship that you are on, for example), then it will result in double movement when you are sailing. This problem can obviously be avoided if you never try to keep track of where you are when someone else is sailing, but it forces you into only being able to track your own sailing movements, whereas the onForcedMove strategy would track ANY sailing movement equally well.

Eraene
Posts: 42
Joined: Wed Nov 27, 2013 10:18 pm

Re: Generic Mapping Script

Post by Eraene »

That's a very good point, actually. Thanks for the insight!

Post Reply