Generic Mapping Script

All and any discussion and development of the Mudlet Mapper.
Lithaen1
Posts: 4
Joined: Fri Dec 02, 2022 7:18 pm

Re: Generic Mapping Script

Post by Lithaen1 »

Jor'Mox wrote:
Sun Dec 04, 2022 11:22 pm
Can you post, and label, the existing exits trigger, multi line exits trigger, and the new trigger that you made that you said you got to work to capture both lines of exits, so hopefully we can work out how to get things working for you?
Sure thing! This is the existing Exits trigger (I removed all of the trigger lines as they weren't relevant to my game, but the code remains unchanged):
existing exits
existing exits
This is the existing multiline exits trigger:
existing multiline exits
existing multiline exits
The corresponding Exit lines trigger:
Existing Exit line
Existing Exit line
and finally, my trigger (EDIT: the roomExits variable is one that I made, just a string to pass to the onNewRoom Event):
Replacement trigger
Replacement trigger
From my poking around the existing stuff is more suited to something like the following (found on the generic mapper additions wiki), but isn't well suited for what I was looking for.:
mud example
mud example
62421bb8f23e09a32b6e6941317076ea.png (21.1 KiB) Viewed 786 times

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

Re: Generic Mapping Script

Post by Jor'Mox »

So, it looks like what you have should work, though I'd advise you to make the roomExits variable you are using local, rather than global (just put local in front of it in the first line when you create it). With that setup, are you still experiencing any problems?

Lithaen1
Posts: 4
Joined: Fri Dec 02, 2022 7:18 pm

Re: Generic Mapping Script

Post by Lithaen1 »

Jor'Mox wrote:
Mon Dec 05, 2022 3:21 pm
So, it looks like what you have should work, though I'd advise you to make the roomExits variable you are using local, rather than global (just put local in front of it in the first line when you create it). With that setup, are you still experiencing any problems?
Not relevant to my original query, no. This works a charm at the moment. The only challenges I'm having are with the actual geography of the game :lol:

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

Re: Generic Mapping Script

Post by Eraene »

I would like to be able to have the mapping script recognize certain prefixed movement commands, like swim north or drive west. Ideally I would like the end result to be something written into the script itself to allow "custom" directional methods, or some such. Is this feasible?

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

Re: Generic Mapping Script

Post by Jor'Mox »

As the person who wrote the basis of this script, I can say that it is at least possible, as the script looks at every command sent while it is active, to check for movement commands. So, as it already treats 'n' and 'north' as identical, it wouldn't be overly complicated to make it have a bigger list of commands that are seen as the same, at least in principal. However, I've seen plenty of games that use commands like "run north" or whatever to START movement in a given direction, and keep going that way for more than a single room, and some that have commands like 'leap north' that move several rooms all at once, which makes incorporating that sort of thing into the general case much more... complicated, and ultimately unfeasible.

That said, there is nothing that would keep it from being modified for a particular game. That is literally what it is there for, to be a robust mapping framework for someone to work with, without having to know all the ins and outs involved, and all they have to do is tailor it to the environment they find themselves in. What you are asking is definitely beyond the scope of modifications that can be made without writing any lines of code, but if all you are asking for is to create a custom list of commands that the script treats as being a simple substitute command instead (i.e. anytime you send 'swim north', the script treats it as if you had send 'north' for its purposes, and so forth), then that is totally possible.

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

Re: Generic Mapping Script

Post by Eraene »

Okay, so... any advice for doing that?

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

Re: Generic Mapping Script

Post by Jor'Mox »

In the version I'm looking at, the function capture_move_cmd starts on line 1334, this is where you are going to want to focus your attention.

On line 1346, I see: local door = string.match(dir,"open (%a+)")
That bit of code compares the command sent to the pattern given, and stores the match contained in the parenthesis if found. You should be able to use line like that, with a different pattern, and a following if statement to check to see if you got a match, like this:

Code: Select all

local drive = string.match(dir,"drive (%a+)")
if drive then dir = drive end
Or, if you had a table of such commands you wanted to check against and strip out, you could do this:

Code: Select all

local special_cmd_tbl = {"drive","swim","climb"}
for i,v in ipairs(special_cmd_tbl) do
	local str = string.match(dir, v .. " (%a+)")
	if str then 
		dir = str
		break
	end
end
And then eventually that special table could be moved up to configurations somewhere, and incorporated into the official version, because as it stands, any time this script got updated, your changes would be wiped away, as this is a self updating script.

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

Re: Generic Mapping Script

Post by Eraene »

Exactly what I'm looking for. Thank you!

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

Re: Generic Mapping Script

Post by Vadi »

https://github.com/Mudlet/Mudlet/blob/d ... mapper.xml would be the place for getting is updated. Sounds like a great idea to have it in for everyone 👍

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

Re: Generic Mapping Script

Post by Eraene »

Yep. I will try to get a PR in for it soon.

Post Reply