Generic Mapping Script

All and any discussion and development of the Mudlet Mapper.
Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Generic Mapping Script

Post by Jor'Mox »

I created the triggers from a character I successfully created, and performed preliminary testing within the started area, with successful results. You obviously play the game, so may encounter some situations that are different from that entry zone, but if everything is as I saw, what I made should work.

kitchen
Posts: 5
Joined: Mon Jan 08, 2018 6:32 am

Re: Generic Mapping Script

Post by kitchen »

I loaded up the Mapping script and played around with it a bit but was unable to adjust the capture triggers to properly get it working. I was able to capture things like room directions and room names via color code, but that's not ideal because my trigger would also get caught up if a room description or object had the same color code as the exits. I'm a bit of a trigger noob, so if anyone could help me out getting the script running on the particular mud I play, I'd greatly appreciate it!

The mud I'm playing is found at: astromud(dot)net , port 2447

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

Re: Generic Mapping Script

Post by Vadi »

Post up the triggers you've got and we'll see where they need fixing!

kitchen
Posts: 5
Joined: Mon Jan 08, 2018 6:32 am

Re: Generic Mapping Script

Post by kitchen »

A typical room might look something like this:

The Throne and the Sun Disk
This is the heart of Delos, the main altar and monument to Isis. A
magnificent golden sun rests under a huge shimmering Sun Disk, blindingly
bright, a magnificent altar on which offerings and prayers alike are sent to
Isis, the mother goddess. An aura of peace and tranquility washes over the
room like a cool breeze, healing your wounds and refreshing the spirit.
Obvious exits:
north - The Northern Gate of Delos
east - The Delos Offering Chamber
south - Square of Devotion
west - The Halls of Wisdom
down - The Healing Temple of Delos
An American Flag is proudly unfurled here.
A Sign Pointing in different directions is standing here.
A Magnificent Golden Throne stands in the center of the room, tribute to Isis.
A Brilliant Golden Sun Disk hovers above the throne.
A Magnificent Altar rests here, shifting black and white spectral colors.
Damodred is level 35 is standing here.
Tibo Purified is sitting on the Golden Throne.
Gerald the Megadude of Magic is standing here.

When you type 'look' or move in any direction, the room name is displayed on the first line, followed by the room description, then exits (can be north east south west down up), finally a list of objects and mobiles in the room. There's also a 'brief/compact' that can be enabled that will cut out the room description and exit names while you are moving around that looks something like this :

The Throne and the Sun Disk
[ Exits: n e s w d ]

For Room Name Trigger, I used a color capture trigger that matches the color displayed for most room names on the first line, and the second line I used the begin of line substring "Obvious exits:" with a line delta of 10. This seems to work for capturing the room name and I somewhat verified this by ticking the highlight box and confirming that the roomname does highlight (unfortunately sometimes also NPC and player 'says' will also get highlighted as they are the same color). I'm open to advice on a better way to more consistently capture the room name.

For the Exits Trigger, I used a begin of line substring "Obvious exits:" on the first line, and then a color trigger on line 2 to capture the direction of the exits. This works to highlight the exit directions when I tick the highlight box, but it does not capture the exit name as the direction and name are in different colors.

For the Prompt Trigger, I used a perl regex to capture ^(\d+)Hp (\d+)Ma (\d+)Mv (\d+)Lev .

For the Move Fail Trigger, I used a begin of line substring for "Alas, you cannot go that way..." As far as I know, this is the only one that I'm sure should be working!

The body of the triggers is unmodified from what the package came with, for example exits trigger still contains the code:
map.prompt.exits = matches[2]
raiseEvent("onNewRoom")
I tried echoing the values for map.prompt.exits , map.prompt.room, but I get a debug error like this: "...attempt to concatenate field 'room' (a nil value), which indicates to me that my triggers for capturing names aren't actually capturing anything at all. Anyway, that's where I'm at now with the mapper. How can I fix it?

kitchen
Posts: 5
Joined: Mon Jan 08, 2018 6:32 am

Re: Generic Mapping Script

Post by kitchen »

Playing around with it some more, I was able to succeed in getting the mapper to start working while using the brief/compact mode.
I played around with multimatches and perl regex until I was able to the trigger to match. Here's an example of the code body I used for the exits trigger.

map.prompt.exits = multimatches[2][1]
echo("Here is contents of map.prompt.exits: ")
display(map.prompt.exits)
raiseEvent("onNewRoom")

While it seems to work, for the brief/compact mode, I still haven't figured out how match properly normally when exit names are also displayed. Does the mapper need access to room names in the exits in order to function properly? I have seen some strange behavior while mapping if I return to a previously mapped room (for example going west east west east west east over and over again will just cause the map to expand rather than realizing that I haven't moved from where I began.) I'll see if I can also get things into their proper places outside of the brief/compact mode

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

Re: Generic Mapping Script

Post by Jor'Mox »

So, I logged in briefly, and these are the triggers I made that seemed to address your problem.

First, I made the room name trigger off the relevant color (dark cyan), and had it use this code:
Code: [show] | [select all] lua
if not map.prompt.desc then
    map.prompt.desc = line
end
Then, I gave the Exits Trigger two patterns, as follows:
  • ^Obvious exits
  • ^(\w+)\s+\-
And gave it the following code:
Code: [show] | [select all] lua
if string.starts(line,"Obvious") then
    raiseEvent("onNewRoom")
    map.prompt.exits = ""
else
    map.prompt.exits = string.format("%s %s",map.prompt.exits,matches[2])
end
And finally, I gave the prompt trigger the following code:
Code: [show] | [select all] lua
map.prompt.room = map.prompt.desc
map.prompt.desc = nil
raiseEvent("onPrompt")
I did notice that the game occasionally moves your character around a bit on its own, so you enter one room, and then are transported to a second room, which will be problematic in a general sense (as you have no frame of reference for where you move to for the second room, and no prompt between the two), but as I was only wandering around the newbie school area, I have no way to know if it will be a significant complication or not.

kitchen
Posts: 5
Joined: Mon Jan 08, 2018 6:32 am

Re: Generic Mapping Script

Post by kitchen »

Well that works fantastically! Thanks so much for taking the time to help me out with the code and regex. I think that may have been a bit beyond my ability to solve by myself.

Xavious
Posts: 7
Joined: Sat Nov 21, 2015 9:48 pm

Re: Generic Mapping Script

Post by Xavious »

Is there a GitHub of this script somewhere? I noticed the version date of the original is like only a week ago, even though that the original thread was years ago :lol:

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

Re: Generic Mapping Script

Post by Jor'Mox »

It is just me maintaining it, so all the editing is done locally, and I store the results on a server for download. Whenever I make a change, I update the script posted in the original post to match, even though it is easier for people to get by using the download/install command at the bottom of the post. So, no, this doesn't exist on GitHub or any similar service.

crl775m
Posts: 1
Joined: Wed Jan 24, 2018 3:02 pm

Re: Generic Mapping Script

Post by crl775m »

In check_room shouldn't the following:

Code: Select all

    return table.is_empty(t_exits) or check_doors(roomID,t_exits)
actually be:

Code: Select all

    return (not table.is_empty(t_exits)) or check_doors(roomID,t_exits)
Until I made that change it wouldn't backtrack into the previous room, it would just create new ones on every exit.

Post Reply