Generic Mapping Script

All and any discussion and development of the Mudlet Mapper.
Post Reply
Darmir
Posts: 226
Joined: Sun May 01, 2011 6:51 pm
Contact:

Re: Generic Mapping Script

Post by Darmir »

Jor'Mox,
I tried to copy the script in a new blank script but they won't save. i think I need an EventHandler.
Is there a way you can make this into a Generic Mapper Package?

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

Re: Generic Mapping Script

Post by Jor'Mox »

If the scripts won't save, then there is something else going on, and I doubt putting this into a package will rectify it for you. I set up a profile with the mapper just a couple of days ago to help someone figure something out, and all I did was copy/paste the two scripts, save them, and then get to work making triggers as detailed in the instructions. There is definitely no need for some special event handler, everything like that is taken care of by the script itself.

Can you walk me through what you are doing, and what happens? Maybe then I can spot what is going on, and why you are having trouble.

Chewbert
Posts: 3
Joined: Thu Jan 19, 2017 11:00 pm

Re: Generic Mapping Script

Post by Chewbert »

Is it possible to get examples of triggers that need to be made within Mudlet? I'm trying to learn lua and how I can incorporate this script into my client, but I'm having a hard time of it. Examples showing how to capture various outputs & feed them to scripts like this one has been beyond me so far.

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

Re: Generic Mapping Script

Post by Jor'Mox »

Chewbert wrote:Is it possible to get examples of triggers that need to be made within Mudlet? I'm trying to learn lua and how I can incorporate this script into my client, but I'm having a hard time of it. Examples showing how to capture various outputs & feed them to scripts like this one has been beyond me so far.
Making generic examples is hard, but I can show you how to make the triggers you need for the game you play, if you can show what there is to work with. Post a screenshot or two and point out where the room names, exits, and prompts are, and comment about ways that they might be significantly different (for example, room names being one color in the example, but a different color in some situations, or exits being different when there are exits in certain directions, etc.). Then I can try to walk you through making triggers to capture the right info, and the code to use it appropriately.

Chewbert
Posts: 3
Joined: Thu Jan 19, 2017 11:00 pm

Re: Generic Mapping Script

Post by Chewbert »

Thanks for the response! Sorry for my ignorance, I read quite a few places but it seems like there's a bit of an initial jump interfacing with things that I'm just not able to find.

Image
http://imgur.com/a/8nBU4

Here's an example of how rooms & exits are displayed. The mud is a Diku style (abandonedcodex.net port 4000)
Room titles, descriptions, and the exits never change.

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

Re: Generic Mapping Script

Post by Jor'Mox »

Okay, so I'll start with the easy ones, the exits and the prompt.

To capture the exits, make a new trigger, and use the following pattern in the first line for trigger patterns: ^Exits\: ([\w\s]+)\.
Then change the type to "perl regex" (selected from the drop down box to the right of the text box for the pattern).
For the code (in the large white box at the bottom), use this:
Code: [show] | [select all] lua
map.prompt.exits = matches[2]
raiseEvent("onNewRoom")
For the prompt, you will again use the "perl regex" type, and use this pattern: ^\d+/\d+hp \d+/\d+m \d+mv \d+xp.*$
And use this for the code:
Code: [show] | [select all] lua
raiseEvent("onPrompt")
map.prompt.name_found = false
The room name will be harder, because the name could be anything, so the major identifier of that line is the color, but other text can also have that color. So, for this trigger, you will change the type to "color trigger", and then select the color that matches the room name. Then, you will have the following code:
Code: [show] | [select all] lua
if not map.prompt.name_found then
   map.prompt.name_found = true
   map.prompt.room = matches[1]
end
Note the if statement, and the variable that is being checked. This is there so that we only ever catch the first line with the given color after the prompt is found, and since the room name is always first, that is what we should be capturing. If the room name can have multiple different colors, then we need a different strategy, such as just getting the first line after a prompt, regardless of what it is (using a "perl regex" trigger with a pattern of ^.*$). There can be other complications, such as occasional text that comes before the room name (like in the game I play, where when you walk through a portal, there is a message about you walking through the portal, which is then followed by the room name), in which case you need to check to be sure that the first line you are capturing isn't such a message.

In addition to these triggers, you will need more triggers to catch appropriate messages for when you try to go a given direction and can't (either because there is a closed door, or just simply no exit in that direction), when you move but are unable to see (because you are blinded or there isn't sufficient light in the room, etc.), and when you move but are unable to determine which direction you moved in (something that happens in the game I play when I flee from combat). Those triggers would raise the "onMoveFail", "onVisionFail", and "onRandomMove" events respectively. If you need help setting those up, just let me know.

Chewbert
Posts: 3
Joined: Thu Jan 19, 2017 11:00 pm

Re: Generic Mapping Script

Post by Chewbert »

Thanks! This is massively helpful. I've set color highlights to help verify that I'm grabbing the right information and everything seems to be on point. I was able to make my on move fail triggers as well, I'll have to find some good case on random moves.

I think I must need a way to start/stop the mapper? Or maybe make new maps?

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

Re: Generic Mapping Script

Post by Jor'Mox »

Indeed. There are aliases built into the map script that you use to do this. The most basic are the ones to start and stop mapping (start mapping <area name>, and stop mapping, respectively). But there are a number that you should be familiar with to help make mapping as smooth as possible. If you look at the comments at the top of the script, there is a section explaining the different aliases and how to use them. If you have specific questions about them, let me know, and I can explain in more detail.

Latino
Posts: 3
Joined: Wed Feb 01, 2017 10:50 am

Re: Generic Mapping Script

Post by Latino »

hi i play on an Italian MUD (Tempora Sanguinis) im trying to use ur script there but im not able to set my prompt


south
Il Centro Commerciale
Ti trovi nel famoso centro commerciale di Midia. Da qui partono strade
che portano in tutte le direzioni, a nord verso il centro della citta',
a sud verso la piazza dell'accordo e ad est ed ovest sulla strada
principale. Senti in lontananza i gruppi di avventurieri prepararsi alle
battaglie, hai quasi il cuore in gola, nonostante l'atmosfera e i
sentimenti che ti avvolgono non riesci a nascondere la vicinanza che hai
per questa bellissima citta' e tutto cio' che la circonda.
Uscite visibili: Nord Est Sud Ovest
Un cane randagio si aggira sperduto.

*H>284/284 M>554/554 V>115/115 X>30357127 B:- T [Angelico] (*(*)-(*)*) [0]


im not able to capture the prompt to set up the mapper also i cant locate my current position on the map, what can i do?

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

Re: Generic Mapping Script

Post by Jor'Mox »

Okay, so you need to do a few things to get this working. First, you will need a way to capture the room name and exits so that the script knows what room you are in (at which point you shouldn't have to worry about locating yourself, as the script will take care of that for you). Getting room names is generally the trickiest part of the process, as there is often not a lot to distinguish them from other text, though sometimes this information can be put in the prompt. If you need help with capturing room names, I will need a good bit more info, so as to account for different possibilities (a lot of people use color triggers to capture room names, or look back from the exit information to find the last line of text before a blank one, etc.). Capturing exits is fairly straightforward, and you should be able to use a pattern like this: ^Uscite visibili: ([\w\s]+)

Capturing your prompt should also be fairly simple, with a pattern like this: ^\*H\>\d+/\d+ M\>\d+/\d+ V\>\d+/\d+ X\>\d+/\d+

Note that you don't have to match against your entire prompt unless it has information that you need for the map script, which is why the pattern I gave stops after what I'm assuming is the experience part of the prompt.

Other than capturing the relevant info, you will also need to make some minor changes in the script to account for the different language used for exits. On line 159, there is a table called "exitmap", on line 170 is a table called "stubmap", and on line 185 there is a table called "reverse_dirs". In all of those, you will need to go through and replace each instance of the direction words with whatever their equivalent is in Italian. Similarly, if a different abbreviation is used for a direction, you will need to change that in the exitmap as well.

Post Reply