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 »

Interestingly, I have zero problems so long as I only work with the map via code, no matter what I do, or how long I do it. I can add rooms, delete rooms, make and delete areas, move rooms from area to area, etc. And everything works fine (in Mudlet 2.1). Until there is a stable release for 3.0, I obviously need to keep my development targeted at 2.1, so as to make things work for the majority of users. I'd be more than happy to test things out to see if I can replicate the problem in a new version though, assuming someone can make a compiled binary for me.

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 »

Well Vadim is nagging that we need to get another (probably will be an "epsilon" preview) release out...

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Generic Mapping Script

Post by Nyyrazzilyss »

Jor'Mox wrote:I'd be more than happy to test things out to see if I can replicate the problem in a new version though, assuming someone can make a compiled binary for me.
I've got osx and win32 binaries posted that I built a couple month ago. They're not 100% current, but they are fairly close.

http://forums.mudlet.org/viewtopic.php?f=7&t=5712

User avatar
Belgarath
Posts: 232
Joined: Fri Jul 26, 2013 7:19 am
Discord: macjabeth#7149

Re: Generic Mapping Script

Post by Belgarath »

I've noticed the mapper has issues parsing rooms that have a in/out exit in them. It will put them overtop the first room I created. Is this intentional? Apart from that it seems to work very well. All that's missing is an autowalking feature. +1

chrio
Posts: 73
Joined: Mon Aug 22, 2016 11:34 am

Re: Generic Mapping Script

Post by chrio »

Belgarath wrote:Apart from that it seems to work very well. All that's missing is an autowalking feature. +1
I'm pretty sure that's because different muds need different checks when walking (stamina, delays etc), so that part is left to the end user to customise in the doSpeedWalk function.

One of the most basic speedwalk functions you could use is this:

Code: Select all

function doSpeedWalk(...)
	for k,dir in ipairs(speedWalkDir) do
		send(dir)
	end
	roomID = speedWalkPath[#speedWalkPath]
	centerview(roomID)
end
But it doesn't handle any special cases at all. It just sends the directions, all at once, hope that it works out and center the map on the last room in the path.

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 »

Some existing systems reserve the keyword "script:" at the start of a speedWalkDir entry to indicate that the command is a Lua script to be executed locally rather than a command to be sent to the server with "send(<command>)" - I'd recommend that this is replicated in anyone's own attempt (some tool-tips refer to it and that confused even me until I came to realise it was a convention and not part of the C++ application code).

As it happens, I am working on a significant revision to the Room structure that will make it possible amongst other things to drop in such a "command" into the normal exits as well without having to convert a "normal" exit into a "special" one with a script (it should also be to identify a special exit with a "name" which is not the same as the "script"/"command" - though for backwards compatibility if the latter is empty the former is used instead; which should work although I have to check all the relevant provided Lua commands that involve "special" exits function as expected!)

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

Re: Generic Mapping Script

Post by Jor'Mox »

Belgarath wrote:I've noticed the mapper has issues parsing rooms that have a in/out exit in them. It will put them overtop the first room I created. Is this intentional? Apart from that it seems to work very well. All that's missing is an autowalking feature. +1
This is definitely intentional behavior, and it has a similar behavior for rooms generated by creating a portal. This is because the Mudlet mapping system has only 3 dimensions, allowing you to move rooms up, down, left, right, front, and back (corresponding to n,s,w,e,u,d, respectively). There is no fourth dimension to allow for in and out, so it is left to the mapper to move the newly created room into a position that they find desirable (using the shift alias).

I know what you are saying about the auto-walking feature, but as has been pointed out above, sometimes this can be tricky, depending on the game. I should, however, have included the doSpeedWalk function into the instructions section so that it was clear that the current function just prints out directions, and actual walking would be up to the user. But, given that I had to code in doors in the up/down direction, and they probably similarly don't exist for the in/out direction (but no such exception has been coded, because the game I play doesn't use in/out for anything), there may need to be some tweaking to adjust for that, as well as to build a simple function that can be called to check for doors, rather than expecting someone to be able to look in all the right places for the unusual door setup.

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

Re: Generic Mapping Script

Post by Jor'Mox »

I just updated the script in the opening post so that it now handles in/out doors in the same way that it does up/down ones, adjusted a function I was using to check for doors to be more easily useable for things like doing speedwalks, and added a bit to the help section detailing what is going on in terms of the doSpeedWalk function and how to use the check_doors function.

chrio
Posts: 73
Joined: Mon Aug 22, 2016 11:34 am

Re: Generic Mapping Script

Post by chrio »

I noted something that might cause problems on muds that allow duplicate room names, such as mine.
Code: [show] | [select all] lua
local function set_room(roomID)
    -- moves the map to the new room
    if currentRoom ~= roomID then
        prevRoom = currentRoom
        currentRoom = roomID
    end
    if getRoomName(currentRoom) ~= currentName then
        prevName = currentName
        prevExits = currentExits
        currentName = getRoomName(currentRoom)
        currentExits = getRoomExits(currentRoom)
    end
    currentArea = getRoomArea(currentRoom)
    centerview(currentRoom)
end
currentExits won't be updated if the new room has the same name as the last one.

Wouldn't you get the desired effect by removing the following lines, or would that mess something else up that I'm not aware of?

Code: Select all

end
if getRoomName(currentRoom) ~= currentName then

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

Re: Generic Mapping Script

Post by Jor'Mox »

That particular if statement is actually there as a back stop, in the event that for some reason you can't see the room properly (say, you are running around blind). When you are able to see normally, that information is updated at a different stage. There is indeed some potential for failure here, but if I get rid of the check here, it would actually be duplicating effort, and losing the previous room info. Mostly though, just don't try to build a map when you can't see, and it should be fine. When moving on a finished map, moving blind can be a problem if you also have random movement involved, and it has to try to guess where you went, but once it can see again, and you walk into some room that is sufficiently unique, it will find you automatically (any time you move, it checks the current and previous room name and exits, and makes sure that it has you in a room where the room you came from exits in the direction you moved into the room you entered).

It isn't perfect of course, and the game I play in has whole areas where there may be only one or two unique room names, which can make it hard to pin you down at times, but I find it to be about as good as you could expect given the available information.

Post Reply