Generic Mapping Script

All and any discussion and development of the Mudlet Mapper.
Jor'Mox
Posts: 936
Joined: Wed Apr 03, 2013 2:19 am

Re: Generic Mapping Script

Post by Jor'Mox » Wed May 09, 2018 10:30 am

Okay, so looking at your included picture, you have several problems. First, you have the pattern for the prompt trigger in your room name trigger, and you have its pattern type as "substring" instead of "perl regex" (which would be the proper type for that pattern, when used in the prompt trigger). You need to change the pattern type for line 1 to "color trigger", rather than changing the colors used in highlighting (which is simply to show that something was matched by the trigger, mostly only useful to see if it is working or not).

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

Re: Generic Mapping Script

Post by Jor'Mox » Wed May 09, 2018 6:13 pm

@ulysses I just uploaded an updated package (and updated the script posted on the main page, so you can just copy/paste that over the existing script to see the changes), so that it should now properly add doors via the add door command in the up/down and in/out directions. Check it out, and let me know how it works for you.

ulysses
Posts: 41
Joined: Fri Jan 05, 2018 7:43 pm

Re: Generic Mapping Script

Post by ulysses » Wed May 09, 2018 10:39 pm

Jor'Mox wrote:
Wed May 09, 2018 6:13 pm
@ulysses I just uploaded an updated package (and updated the script posted on the main page, so you can just copy/paste that over the existing script to see the changes), so that it should now properly add doors via the add door command in the up/down and in/out directions. Check it out, and let me know how it works for you.
Hey, Jor'Mox. Thanks so much for looking at this.

Sorry to say, but the problem remains. I am now able to add an UP door and when I do I see:

Code: Select all

start mapping
Now mapping in area: Dreamlands    
add door up
983    down    2    
982    up    2  

Inspecting the room via the 'exits' menu on the context click shows that the up direction is now marked with a closed door (third radio button). However, when I move N away from this room, remove the item which causes me to fly (and therefore see the UP direction), move S back to the room which had the UP exit (but does not now since I'm not flying), then the glowing here-you-are pointer jumps to another location on the map (presumably the closest match it can find - it points to another room with a just a N and a W exit). it is not disregarding the fact that this is a potentially 'hidden' exit. It works as discussed above with the E direction (and presumably NE etc), but it is still not working with UP or DOWN. I verified the DOWN case was not working either in another spot on the map which has a hidden down location.

Sorry - perhaps it is something simple!

Thanks!
Ulysses/Wod

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

Re: Generic Mapping Script

Post by Jor'Mox » Wed May 09, 2018 10:59 pm

Mine was doing some weird things that made it work... so I fixed those, and finally replicated your issue, and then fixed it. I have updated the script in the first post, but not the package. Could you please check it out to see if it resolves the problem before I update the package file?

Scolius
Posts: 6
Joined: Mon Apr 30, 2018 7:24 am

Re: Generic Mapping Script

Post by Scolius » Thu May 10, 2018 3:49 am

Thanks! It's working now. I've got plenty of little things to learn, but so far so good. I'll have to get the hang of things like repeat named rooms and special entrance/exits. Speed walking too. Good enough for now.

ulysses
Posts: 41
Joined: Fri Jan 05, 2018 7:43 pm

Re: Generic Mapping Script

Post by ulysses » Fri May 11, 2018 4:03 am

Jor'Mox wrote:
Wed May 09, 2018 10:59 pm
Mine was doing some weird things that made it work... so I fixed those, and finally replicated your issue, and then fixed it. I have updated the script in the first post, but not the package. Could you please check it out to see if it resolves the problem before I update the package file?
Yes! It's working. Totally Oar-some dude.
Now to get those pesky mazes mapped :D

Thanks Jor'Mox, you're a legend.
-Wod

ulysses
Posts: 41
Joined: Fri Jan 05, 2018 7:43 pm

Re: Generic Mapping Script

Post by ulysses » Wed May 16, 2018 10:08 pm

Question about speed-walking:

Sometimes the glowing you-are-here pointer doesn't keep up with a speed-walk. I put a delay in which helps most of the time, but not always. At the end of the speed-walk I forced a 'find me' and that improves it most of the time if it fails mid-route, but again not always. Perhaps the delay needs to be a bit longer? Here is my function which I wrote for doing the walk:

Code: Select all

function doSpeedWalk()
    -- we can do a lot here, this fires when a room is double clicked on, and is intended to speedwalk to it
    print("Path to " .. getRoomName(speedWalkPath[#speedWalkPath]) .. ": " .. table.concat(speedWalkDir, ", "))
		delay = 0.5
		for i = 1,#speedWalkDir do
			tempTimer(delay, function()
  			send(speedWalkDir[i])
			end)
			delay = delay + 0.5
		end
		tempTimer(delay, function()
			map.find_me()
		end)	
end

Thanks!
Wod.

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

Re: Generic Mapping Script

Post by Jor'Mox » Thu May 17, 2018 6:45 pm

So, that sort of issue suggests that there is some problem tracking movement through one or more of the rooms along the designated path (i.e. it isn't recognizing the room when you walk into it). The timing of when commands are issued shouldn't make any difference at all, as the script keeps track of all movement commands sent in a table, and then removes them one at a time as rooms are entered, so speed walking should behave exactly like walking normally, or spamming commands in manually. So, to verify if this is the case, I suggest finding a problematic path, walking it manually to see if there are any problem rooms (under the same conditions obviously), and either fixing those issues, or coming back and letting me know that you don't see the same thing under both circumstances.

Also, just from a coding optimization standpoint, it might be a bit nicer to not have a ton of timers all running at once, to do that, you can use recursion, so that each timer creates the next one when it fires. Here is some code that would do that while producing the same result you should be getting with your current code:
Code: [show] | [select all] lua
function doSpeedWalk()
    -- we can do a lot here, this fires when a room is double clicked on, and is intended to speedwalk to it
    print("Path to " .. getRoomName(speedWalkPath[#speedWalkPath]) .. ": " .. table.concat(speedWalkDir, ", "))
    local delay = 0.5 -- using local variables so we don't clog the global name-space, and we don't use up memory we don't need once this process is done
    local path = table.deepcopy(speedWalkDir) -- copying the directions so we don't accidentally get them overwritten mid-walk
    local next_step -- pre-defining the function so it can call itself
    -- creating a function that grabs the first item from the directions table, sends it, then creates a timer if there are more steps left
    next_step = function () send(table.remove(path,1)) if #path > 0 then tempTimer(delay, next_step) else map.find_me() end end
    next_step() -- actually calling the function we just created, kicking off the whole process

ulysses
Posts: 41
Joined: Fri Jan 05, 2018 7:43 pm

Re: Generic Mapping Script

Post by ulysses » Fri May 18, 2018 7:59 pm

Jor'Mox wrote:
Thu May 17, 2018 6:45 pm
So, that sort of issue suggests that there is some problem tracking movement through one or more of the rooms along the designated path (i.e. it isn't recognizing the room when you walk into it). The timing of when commands are issued shouldn't make any difference at all, as the script keeps track of all movement commands sent in a table, and then removes them one at a time as rooms are entered, so speed walking should behave exactly like walking normally, or spamming commands in manually. So, to verify if this is the case, I suggest finding a problematic path, walking it manually to see if there are any problem rooms (under the same conditions obviously), and either fixing those issues, or coming back and letting me know that you don't see the same thing under both circumstances.

Also, just from a coding optimization standpoint, it might be a bit nicer to not have a ton of timers all running at once, to do that, you can use recursion, so that each timer creates the next one when it fires. Here is some code that would do that while producing the same result you should be getting with your current code:
Code: [show] | [select all] lua
function doSpeedWalk()
    -- we can do a lot here, this fires when a room is double clicked on, and is intended to speedwalk to it
    print("Path to " .. getRoomName(speedWalkPath[#speedWalkPath]) .. ": " .. table.concat(speedWalkDir, ", "))
    local delay = 0.5 -- using local variables so we don't clog the global name-space, and we don't use up memory we don't need once this process is done
    local path = table.deepcopy(speedWalkDir) -- copying the directions so we don't accidentally get them overwritten mid-walk
    local next_step -- pre-defining the function so it can call itself
    -- creating a function that grabs the first item from the directions table, sends it, then creates a timer if there are more steps left
    next_step = function () send(table.remove(path,1)) if #path > 0 then tempTimer(delay, next_step) else map.find_me() end end
    next_step() -- actually calling the function we just created, kicking off the whole process
As usual, thanks very much for your reply! Here are my observations:
  1. I chose two points on the map, reasonably far apart (by about 15 rooms) and walked manually between them in both directions, this was ok.
  2. Speedwalking between those rooms the tracking would go wrong most times, about 2 rooms before the end.
  3. Not all routes were the same, i.e. sometimes it picked a different route. However, whichever the route, the tracking would often (maybe always) fail on the 2nd or penultimate room. I ran this about 5 times in both directions, and the result is the same. Speed-walking a different route, but one which incorporated the rooms where the other routes were stalling, did not affect the behaviour - the room previously stalling were now ok and the lost-tracking rooms were now again near the new endpoints of the new route. This suggest something flawed in the script or a synchronisation issue between the running of the script and the mud output
  4. Replacing my script with yours made no difference to the behaviour (appreciate the coding tips though!)
  5. Setting delay = 0.1 made tracking fail much earlier on in the route, something like the 3 or 4th room.
  6. Setting delay = 1.0 (or indeed 2.0 - slow walking!) always made the tracking fail on the penultimate room
  7. Taking the delay out entirely, i.e. just having this function;

    Code: Select all

    		for i = 1,#speedWalkDir do
    				send(speedWalkDir[i])
    		end	
    Causes the tracking to go wrong almost immediately, on the 2nd room in fact.
The last points seem to indicate a synchronisation issue between the tracking and the mud output. It seems the tracking isn't fast enough for the mud output, and slowing down the movement allows the tracking to work better, but not perfectly. I think the fact that the tracking fails on the penultimate room at best could just be a logic error in the script, but I don't see it.

Thanks!
Wod-Ulysses.

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

Re: Generic Mapping Script

Post by Jor'Mox » Fri May 18, 2018 8:49 pm

The trick is, there shouldn't be any difference between entering the movements manually as compared to sending them via this particular function. What happens if you just spam in directions REALLY fast? Also, what if you have some other bit of code inputing a number of movement commands for you all at once (say, an alias that walks you along a particular path by sending the commands all at the same time)?

Also, I didn't expect that changing to the code I gave would change anything, it was definitely just a "here is a coding tip" sort of thing.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests