Page 1 of 1

A little confused with the mapper and descriptions

Posted: Tue Dec 17, 2019 3:22 pm
by mordenkaim
Hi all. I'm working on mapping a MUD (a very old custom code base so I don't get any location/map info from the game).

I believe I need to parse descriptions in order to resolve position conflicts, and I have the triggers for capturing the descriptions done. I am a little confused on where I need to look in the generic mapper to update the logic that validates which room you are in.

Adding a little code flow below to describe how I am approaching this/my current understanding of it.. as of now I have the description capture working roughly, though I need to clean up when it is enabled.
Code: [show] | [select all] lua
--Match room title
--Grab all lines until the exits line, put into description variable
--disable capture on exits line
--player position is updated here by the mapper ( I am not sure yet where this happens, but I think I need to compare description to GetRoomUserData if there is more than one room with the same title and exits... if there is only one room found with the same title and exits ignore descriptions)
--if mapping, setUserRoomData(getPlayerRoom(), "description", description)
I guess the real question I have is: "How does the mapper compare the userdata description with the current room description?" It doesn't seem to maintain the description in a variable by default and I've just set up an arbitrary variable to hold it, so I'm not sure how it would know what to compare it to.

Re: A little confused with the mapper and descriptions

Posted: Tue Dec 17, 2019 7:29 pm
by mordenkaim
So, I went from another angle.

From the default generic mapping script I added two variables to the map table under variables, map.currentDescription and map.previousDescription. Then I went through the generic mapping script and added lines to capture the description during the parse for roomName and exits, then returned an array from the room capture script that returns name and description. Then basically anywhere that a room name check is being done I check for both name and description matches.

So far it is working pretty well with the occasional glitch. Once I get it cleaned up i'll post my code to this thread in case anyone else is trying to do the same thing.

Re: A little confused with the mapper and descriptions

Posted: Thu Mar 19, 2020 5:49 pm
by SlySven
I have played an old-school MUD which does not give any out-of-band location details and thus needed you to also consider the room description when looking for a location match. I too stored the multi-line room description as one item in the room user data as Mudlet has never considered a room description as a inherent part of a room's structure - possible because prior coders did not play MUDs that didn't provide the detail via GMCP or another off-screen method.

I did find that for a 15 to 20 K room MUD it does make the map files bloat a bit (and thus searching/displaying variables slow down noticeably - though a PR to ignore variables when searching in the editor is pending, keep an eye on PR #3415) and that searching the user data just on the description is not idea. I have experimented with developing a system of hashing the multi-line description strings (down to a 4 hex digit number) which showed promise in speeding up the searching but obviously did nothing to reduce the map file size and even worsened the variables in the editor issues (because I had massive tables cross-referencing room numbers/hashes/description). You might wish to investigate using an external database but I did not get around to doing much in that direction...