Generic Mapping Script

All and any discussion and development of the Mudlet Mapper.
Eraene
Posts: 42
Joined: Wed Nov 27, 2013 10:18 pm

Re: Generic Mapping Script

Post by Eraene »

I'm back again to be a nuisance with questions!

This time, it's about rebuilding exits. Is there an easy way to loop through rooms, check for exits that loop into themselves, and then set them as stubs? I have a map with many unfinished areas that, when converted from an old ZMUD map, all stub exits ended up built as exits that loop into the same room. If I want to continue to map in those areas, I have to manually go through each room in the mapper window and remove the self-looping exits and revert them back into stubs. Is there an easier way to do this?

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

Re: Generic Mapping Script

Post by Jor'Mox »

What you would want to do here is make and use a custom function, that you can then throw away when you are done (or just put all of this in as command line Lua code).
Code: [show] | [select all] lua
local rooms = getRooms() -- this gets a list of ALL rooms
for k1,v1 in pairs(rooms) do
     local exits = getRoomExits(k1) -- this gets a list of exits from the room
     for k2,v2 in exits do
          if v2 == k1 then -- this checks if the exit leads to the same roomID
               setExit(k1,-1,k2) -- this clears the exit
               setExitStub(k1,k2,true) -- this creates the exit stub
          end
     end
end

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

Re: Generic Mapping Script

Post by Eraene »

Beautiful! Worked perfectly. Thank you.

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

Re: Generic Mapping Script

Post by SlySven »

When I was messing about testing possible mapper improvements in the past I spotted the issue of circular (self?) room exits - i.e. ones that led back into the same room. At some imprecise future date would specifically marking those be useful in general? :geek:

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

Re: Generic Mapping Script

Post by Jor'Mox »

It might be nice to have some way that they are indicated, since such things obviously do exist in some games, and having a visual indicator of them might be handy.

lugarza
Posts: 2
Joined: Sun Aug 05, 2018 9:15 pm

Re: Generic Mapping Script

Post by lugarza »

Hi there! How should I configure my triggers for this MUD:
name: Zebedee
access: zebedee-mud .org port: 7000

Example room (with contents):
You are in The Cormallen Shop. You can buy or sell things here.
Type 'help store' for a list of commands.
There is an opening to the north, and some shimmering
blue light in the doorway.
There are two obvious exits: east and south.
Satanikus the Demi-god (nice).
Orb of dragonkind.
Orb of dragonkind.
Orb of dragonkind.
A black key-chain.
Orb of dragonkind.
Mabel the shop assistant.

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

Re: Generic Mapping Script

Post by Jor'Mox »

So, this looks like one of those games that doesn't have proper room names, so if you look at the names of rooms made in the map, it may be a bit confusing, but we can work with it. To make this work, I would do the following:

First, for the Room Name Trigger, change the pattern to a regex pattern, and just set it to ^.
This will literally trigger off of ANY line at all, and we will be using it with the intent of grabbing the first line of the room description to use as the room "name". The code for the trigger will change to this: map.prompt.desc = map.prompt.desc or line

Next, change the pattern for the Exits trigger to this: There (?:is|are) \w+ obvious exits?: ([\w\s,]+)
And the code you can leave alone.

For the prompt trigger, make a pattern that matches whatever you have for your prompt, and change the code to the following:
map.prompt.room = map.prompt.desc
map.prompt.desc = nil
raiseEvent("onPrompt")

This should work so long as the first line of text you see after your prompt ANY time you see a room description and exits is the first line of the room description. In some games, this isn't the case, and you can see other messages before the room is shown, which we can still work with, but which will require some adjustment.

lugarza
Posts: 2
Joined: Sun Aug 05, 2018 9:15 pm

Re: Generic Mapping Script

Post by lugarza »

Thanks for the quick reply! I'll give this a try tonight.

This mud also has a "brief" mode where only the room name and exits are displayed. Maybe for the sake of mapping, i could keep brief mode on..
Rooms look like this with that setting turned on:

Code: Select all

The shop. [e, s].
A black key-chain.
Mabel the shop assistant.

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

Re: Generic Mapping Script

Post by Jor'Mox »

The problem there would be that if the room names in brief mode don't match the names you would be able to gather reliably normally, the map wouldn't function unless you remained in brief mode, because it tracks movement by comparing room names and exits observed to the ones stored in the map. If they don't match, then you won't go into the room you really did. So, unless there is a predictable formula by which you can extract the room names seen in brief mode from the descriptions seen in normal mode, don't map in brief mode. And if there IS such a formula, then... just do that to get the room names, and map in normal mode.

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

Re: Generic Mapping Script

Post by SlySven »

One thing that might help to pick out the room name might be if it has a specific colour that other bits of text does not - you can then use a colour trigger to limit the room name trigger to only fire on the correct foreground/background colours. There is a change that will go in soon (I hope) that will mean you can ignore one of the foreground or background colour in such triggers which might make it easier to set such a thing up if you only have to identify the, say, foreground colour.

Post Reply