Generic Mapping Script

All and any discussion and development of the Mudlet Mapper.
phyirie
Posts: 2
Joined: Sat Jan 06, 2018 4:32 pm

Re: Generic Mapping Script

Post by phyirie » Sat Jan 06, 2018 5:27 pm

I added all of those. When I type start mapping it says error no room detected.

Also, will the prompt one work if my prompt looks like this:
<Rathien(100%) >
<64331/64331 3239/6578 1041/1856 0>

The one with my name in it will change depending on if people in my group are in the room with me, it will add them to the prompt. Also, the bottom one changes to add whoever is tanking whatever I am fighting.

Thanks!

EDIT: Ok I got it to work! I think it is the prompt that was messing up but when I set it to the newbie starter prompt it recognized the area. So if you could just show me what to change for it to accept the prompt i use that would be great. Thanks so much!

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

Re: Generic Mapping Script

Post by Jor'Mox » Sat Jan 06, 2018 6:06 pm

So, to just capture the second line of your prompt (which is fine, since we don't actually care about the content), you should be able to use this as a pattern: ^<\d+/\d+[^>]+>

That should match it so long as it starts with a pair of numbers, as you show here. If the info for when someone is tanking doesn't start in the same way, it may need to be modified for that.

max4260
Posts: 2
Joined: Sat Jan 06, 2018 2:55 pm

Re: Generic Mapping Script

Post by max4260 » Sun Jan 07, 2018 12:09 pm

Jor'Mox wrote:
Sat Jan 06, 2018 4:09 pm
So, to answer the easiest portion first, the fact that only a single exit is linked when you move is a function of the map mode you are using, and can be easily changed via an included alias. There are three modes, simple, normal, and complex. Normal mode is the default, and connects the room you move from to the one you move to, in the direction you moved, and vice versa. Complex mode is for especially confusing areas, and it does not create a connection back the way you came, only creating the connection that must exist based on your movement. Simple mode connects exits to all appropriately positioned adjacent rooms when a new room is created, and is especially good for wide open areas with simple room connections. To change map modes, use the following command: map mode simple -- or normal, or complex

The more complex issue is preventing duplicate room creation, and that could depend on what exactly is going on. When you enter a room, the mapper gets the room name and exits, and looks in the direction you moved from the room you are currently located in for a match, if there is no match found along that line, a new room is created. So there are two common reasons why you might be getting a unique room created more than once. The first and easiest to address is a failure to align rooms properly, because games frequently do not have equal room spacing. So, for example, you could start in a room, go north twice, east three times, south three times, and west twice, and find yourself back in the room you started in. However, the mapping script cannot know that this is not a new room that happens to have the same name and exits (a not uncommon occurrence in certain areas in certain games). To make it properly use the existing room, you need to use the shift command (shift e , for example), or drag rooms around manually to give them proper positioning. Note that the shift command only acts on the room you are standing in, but it can be handy when you need to make small adjustments while creating a map. Once the room you are coming from, and the already existing room you are about to move to are lined up properly, the script should use the existing room, rather than creating a new one. For this reason, I often recommend a person figure out how they need to lay out a map before actually mapping it using the script.

The other major possibility is some mismatch in room name or exits. Most commonly, this happens with doors that keep an exit from showing when closed, but then reveal it when opened, so that the room appears to have a different set of exits when entered the second time than when it did originally. But, it can also be due to issues with triggers, causing the actual name or exits captured to vary to some degree or another. If the problem you are talking about ISN'T the first one I mentioned, then we can dig into this in more detail, to help figure out what is going on.
thank you for the quick and long reply! it is very appreciated.

The map mode makes a lot of sense for the room exits. Not sure why i didn't pick up on that in the help section of the code.

The other part is a little more confusing. I was testing it in a straight space with no doors and all exits obviously labeled. literally going n, s, n, s caused the map to generate 4 rooms instead of just two.

I uninstalled everything and need to rebuild the regex stuff (kinda a newbie with them) just to be safe that i didnt super mess anything up, but if you want to take a quick look the mud is located at: dbnu.mudhosting.net at Port 4321

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

Re: Generic Mapping Script

Post by Jor'Mox » Sun Jan 07, 2018 1:25 pm

Okay, so... for reasons I don't really understand, I totally failed to force exits to be all lower case so that they would match up with what the script uses. So, to fix your issue right now, take your trigger that captures exits, and use string.lower on the match before storing it in map.prompt.exits.

I'm in the process of updating the package right now, so once that is finished, this should no longer be an issue for new installs. But as this is the only change occurring, there is no particular need to wait on it.

Jevak
Posts: 6
Joined: Mon Dec 25, 2017 5:55 am

Re: Generic Mapping Script

Post by Jevak » Sun Jan 07, 2018 9:44 pm

well firstly, i really don't know much about muds, and have never touched "triggers" so i'm not sure what i'd be doing with them. and also i'v noticed a few things in the Mud that may cause alot of mapping issues.. like in one area, there is a room called "Main Hallway" with an exit east to the kitchen, and north.. if you go north you are still in the main hallway, and east is now to the dining room. it's like instead of all rooms being 1 by 1 there are many rooms that have different shapes. and many secret exits that don't appear untill you do something.

As for the error with the client setting i'm not sure, it should only be used to set up automatic character limit width before wraping, so shouldn't be too much of a worry to skip that part, if it will let you. try Shout to see if someone online can help you, as i don't know the answer i've never run into that issue.

you can also try the command "client 2" to manually set it to "let your mud client handle text wraping"

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

Re: Generic Mapping Script

Post by Jor'Mox » Sun Jan 07, 2018 10:35 pm

Jevak wrote:
Sun Jan 07, 2018 9:44 pm
well firstly, i really don't know much about muds, and have never touched "triggers" so i'm not sure what i'd be doing with them. and also i'v noticed a few things in the Mud that may cause alot of mapping issues.. like in one area, there is a room called "Main Hallway" with an exit east to the kitchen, and north.. if you go north you are still in the main hallway, and east is now to the dining room. it's like instead of all rooms being 1 by 1 there are many rooms that have different shapes. and many secret exits that don't appear untill you do something.

As for the error with the client setting i'm not sure, it should only be used to set up automatic character limit width before wraping, so shouldn't be too much of a worry to skip that part, if it will let you. try Shout to see if someone online can help you, as i don't know the answer i've never run into that issue.

you can also try the command "client 2" to manually set it to "let your mud client handle text wraping"
So, at that point, I had tried pretty much everything. It is in the process of asking a number of "y/n" questions, and when I put in "y" or "n" for that question, it doesn't respond at all (unlike the other similar questions). If I put in ANY other command, it tells me that isn't a valid choice and spits the question back out at me. As far as I can tell, there are literally no other options available to me. I cannot shout anything, or use the client command you mention because the character isn't even created yet. However, somewhat inspired by your comment, I tried using the client command BEFORE I tried creating a new character, and it worked. So... I should be able to get things working now.

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

Re: Generic Mapping Script

Post by Jor'Mox » Sun Jan 07, 2018 11:14 pm

Okay... so that presented an interesting challenge, but I have something that works.

First, I only got this to work in "client mode 0" (because the other modes don't have anything that comes after the exits that I could use as a prompt, to trigger room creation). I could modify the script to allow it to work without that, but basically the challenge is without some terminating line, rooms couldn't be created until after you walked OUT of them, rather than when you walked in, so I would need to set something up to have it ignore the most recent move command to get room placement correct.

So, down to the details. First, I use ^> as the pattern for the prompt trigger, and I set the code to this:
Code: [show] | [select all] lua
map.prompt.found = false
raiseEvent("onPrompt")
Second, I deleted the room name trigger, and totally reworked the exits trigger as follows. First I changed it to a color trigger, with the bright green color as the foreground, and black as the background. This seems to pick up both exits and room names, along with some random other text in between room name and exit lines (if either of these things can be different colors, then there will need to be some changes made here). Second, I set the code to the following:
Code: [show] | [select all] lua
local exits = {"up","down","in","out","north","south","east","west",
	"northeast","northwest","southeast","southwest"}

local dir = string.lower(matches[1])
if string.find(dir,",") then
	dir = string.split(dir,", ")
end
if table.contains(exits,dir) then
	map.prompt.exits = string.format("%s %s",map.prompt.exits,dir)
	raiseEvent("onNewRoom")
elseif type(dir) == "table" then
	local check = true
	for k,v in ipairs(dir) do
		if not table.contains(exits,v) then
			check = false
			break
		end
	end
	if check then
		for k,v in ipairs(dir) do
			map.prompt.exits = string.format("%s %s",map.prompt.exits,v)
		end
		raiseEvent("onNewRoom")
	end
else
	if not map.prompt.found then
		map.prompt.room = matches[1]
		map.prompt.found = true
		map.prompt.exits = ""
	end
end
I also made a Move Fail Trigger, with a begin of line substring pattern of: You wander around
And code of: raiseEvent("onMoveFail")

Jevak
Posts: 6
Joined: Mon Dec 25, 2017 5:55 am

Re: Generic Mapping Script

Post by Jevak » Sun Jan 07, 2018 11:43 pm

i don't believe the color idea will work, as the "score" profile that everyone has is also in the same color. you can look at it by typing "sc" for your own, and "sc <name>" for others. also anyone can add whatever they want to that profile, so that means it wouldn't be easy to get a script to recognize the score command and ignore that section, as it could end with literately anything. as i've been looking at it, i would have no idea how the script would be able to tell the room names unless it built the rooms and named them purely off the exits and not the rooms themselves.

I was informed that you may need to make sure you have echo enabled on your client. as that may be an issue in character creation.

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

Re: Generic Mapping Script

Post by Jor'Mox » Mon Jan 08, 2018 12:13 am

So, the way it is interacting with color is fairly specific, and should theoretically avoid the score issue you mention. I use a three step process. First, I capture the first line of that color and store that as the room name. Second, I match exits by checking against a table of possible exits, and append new exits line at a time. And finally, I catch the prompt, which resets things, so a new room name can be captured. The key feature here is that unless exits are detected, the script does not register a room. So what we would need to look for is one of the following:
  • some text of the relevant color comes after the prompt but before the room name, in which case the name would be wrong
  • the room name is of another color, in which case it isn't captured
  • exits are the wrong color, in which case they aren't captured
  • we see exit words in the relevant color in an instance where we are not seeing a room
Since the presence of the exits is necessary for a room to be generated, the only time we would need to be worried about accidentally making a room would be the last case, so as long as that is avoided, it should still work.

Jevak
Posts: 6
Joined: Mon Dec 25, 2017 5:55 am

Re: Generic Mapping Script

Post by Jevak » Mon Jan 08, 2018 1:40 am

ok, i just tryed to make a random junk character just to see if i could get through. just in case.. make sure you also aren't using any symbols in your name. it seems to be working for me, so if you can't get in i can just send you the login info for this junk character i made.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest