Speedwalk followthrough

All and any discussion and development of the Mudlet Mapper.
Post Reply
kalrykh
Posts: 10
Joined: Fri Sep 17, 2021 7:09 pm

Speedwalk followthrough

Post by kalrykh »

First of all, I'm long winded. I apologize in advance.

I'm having a bit of an issue with my mapper/script that I was hoping to find a solution for. I have the mud mapped. I just need it to follow me accurately. In zmud/cmud, I could tell the mapper not to verify room names on the way and just follow me based on the directions that have been input. Is this possible with mudlet?

I'm playing on The Two Towers(t2tmud dot org port 9999), an lpmud I believe. I'm using the generic mapper package, with some changes/additions based on what I've found here in the forums. Right now, the largest problem I have is that in one of the areas, there are random rooms thrown in with different names and they're changed regularly and it's hanging up my map if I move through one of the rooms that has changed while speedwalking and I have to use my teleport alias to put the map in the room where I'm actually at.

For instance, sometimes Lothlorien(n, e, s and w) becomes Near a guard flet(n, e, s and w) and reverse.

On the same note, if I move through a series of rooms with only special exits on a speedwalk, the mapper will not follow. If I move through them one room at a time by hand, it follows fine.

I considered adding my teleport code to the alias I made to go to the room, but it sends the command at the same time as the speedwalk starts, and then the mapper identifies other rooms I'm walking through on the way and adjusts my location, throwing everything off even more. I guess if I could find a way, I could set the teleport code to fire when all movement has finally stopped.

Is there a way to have the mapper follow me based on the path that is put in, starting at the current location, while ignoring room names/exits when the speedwalk function has been called via my "go" alias? I've included my changes/additions to the mapper script below. I have no real coding experience and I've pieced together everything by copying and adjusting other stuff I've found online. If any of this is bloated or using incorrect syntax or methodology or whatever, please forgive me.


Room name/exit regex triggers are nested, the first to just pick up the line starting with the background color:
I'm using this to hopefully capture rooms that have no visible exits so I can do something with those later.
^([A-Z,].+)*$ with colors.ANSI_COLORS_F{011}_B{004}
Child trigger is this, which is the standard room/exit.
^([A-Z].+)\(([\w\s,]+)\)\s*\[?([\w\s,]*)\]?
Code: [show] | [select all] lua
local dirs = {n = 'north', s = 'south', w = 'west', e = 'east', d = 'down', u = 'up', ne = 'northeast', nw = 'northwest', se = 'southeast', sw = 'southwest', enter = 'enter'}
local exits, found_exits
local combined = matches[3]
--local combined = matches[3] .. " " .. matches[4]
for w in combined:gmatch("%a+") do
       if dirs[w] then
          if not exits then
              exits = dirs[w]
          else
              exits = exits .. " " .. dirs[w]
          end
          found_exits = true 

      else 
          if not exits then
              exits = w
          else
              exits = exits .. " " .. w
          end
          found_exits = true
      end
end
if found_exits then
  map.prompt.exits = exits
  map.prompt.room = matches[2]
  raiseEvent("onNewRoom")
  print(map.prompt.exits)
end


The following aliases are things I've added for convenience. The big things for me are being
able to type "go (location abbreviation, like a favorite, or room number)" to go somewhere and teleport the map to a room if it
didn't follow me all the way through the speedwalk.

This alias adds a short name for the current room that I can use with the "go" and "tele" aliases.
^addroom (\w*)$
Code: [show] | [select all] lua
mapperRooms[matches[2]] = tostring(map.currentRoom)
^go (.+)$
Code: [show] | [select all] lua
local destination = matches[2]

if tonumber(destination) then
  roomDestination = tonumber(destination)
else
  if mapperRooms[destination] then
    roomDestination = tonumber(mapperRooms[destination])
  else
    cecho("\n<cyan>Location not yet assocated with a room number or room number is invalid.")
    return nil
  end
end

if roomDestination then
  map.speedwalk(roomDestination)
  cecho("\n<cyan>Headed to " .. getRoomName(roomDestination).. " in " .. getRoomAreaName(getRoomArea(roomDestination)))
end
^tele (.+)$
Code: [show] | [select all] lua
local setCurrentRoom = matches[2]

if tonumber(setCurrentRoom) then
  newLocation = tonumber(setCurrentRoom)

else
  if mapperRooms[setCurrentRoom] then
    newLocation = tonumber(mapperRooms[setCurrentRoom])
  else
    cecho("<cyan>Location not recognized.")
    return nil
  end
end

if newLocation then
  map.set("currentRoom", newLocation)
  centerview(tonumber(map.currentRoom))
  cecho("<cyan>Teleporting room to " ..getRoomName(newLocation).. " in " .. getRoomAreaName(getRoomArea(newLocation)))
else
  cecho("\n<cyan>You screwed that up!\n")
end
Quick edit - Some of these aliases stopped working 100% so I updated the logic, along with changing the room detection trigger back to firing based on background colors instead of using the exclude rooms table to filter some things out.

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

Re: Speedwalk followthrough

Post by Vadi »

If you've mapped the game and all you'd like to do is have the mapper follow you based on the directions you enter - you could uninstall the mapping script, intercept direction commands, and move your position on the map appropriately. So for example if you typed "e", look at which room is to the east of you and place your position there. How about that approach?

If that works we can work out the details following.

kalrykh
Posts: 10
Joined: Fri Sep 17, 2021 7:09 pm

Re: Speedwalk followthrough

Post by kalrykh »

The map is a good 10 years old. I took a multiyear break. New areas have been added. Thousands of room names in the lower level areas have been changed slightly, presumably to mess with botters. While I mainly stick to the areas I frequented when I played before, I'm still making updates and will be getting around to the new areas.

I really only need this during speedwalking, as it sends all the commands at once and the map doesn't seem to be able to keep up, even through rooms with no changes.

Perhaps I could treat the room/exit trigger like a trigger class, disable it at the start of my "go whatever" alias, use the code from the teleport alias to set my end location, and then reenable the room/exit trigger once I arrive? I'm not sure how I would write something to recognize when I reached the location and reenable the room/exit trigger. Since I still need the mapper script often enough that I don't want to completely remove it, would this type of automatic toggle off/on approach work? Is it possible to recognize once the movement has stopped to toggle it back on?

Also, mudlet crashes so often (5-10 times a day) that I've learned to save the map and the profile about every 10 minutes. It happens most often when I have the variable/trigger/alias/script window open. If I happen to be in the process of editing a specific value when it crashes, the entire thing will disappear from the profile, not just revert to the changes made before the last save. A few times, when it crashed, it corrupted multiple files -- none of the extra geyser stuff would work without throwing lua errors, permanent tables i had created disappeared. I've have to wipe everything and reinstall the software a few times, then manually pull out elements from my xml backups and reimport them in pieces, just to test functionality of various profile settings to see if it was something I did that made it unstable. I'd submit bug reports, but I haven't been able to reproduce or recognize specific events to know what to report. I'm on a Macbook Air with the new Apple silicon, so maybe it's an Intel > ARM translation issue in Rosetta.

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

Re: Speedwalk followthrough

Post by Vadi »

Look through `map config` - there is an option send commands with a delay. Several of them even. Would that work?

Mudlet crashing: that's not normal at all and unexpected. You're on a mac so the crash report is immensely useful, we'll look at it. Please file it on https://github.com/Mudlet/Mudlet/issues/new.

kalrykh
Posts: 10
Joined: Fri Sep 17, 2021 7:09 pm

Re: Speedwalk followthrough

Post by kalrykh »

Vadi wrote:
Sun Sep 19, 2021 3:58 pm
Look through `map config` - there is an option send commands with a delay. Several of them even. Would that work?
I found a convoluted way of making things work. It should hold me over until I get a better handle on this scripting stuff.

I set my "go" alias to append an unrecognized command at the end of the speedwalk that elicits "What?" from the mud. Since it's sent at the end of the chain, the "What?" only shows up after I've arrived.

I also added disableTrigger("Background Based Exits") -- the room name / exit matching -- at the beginning of the go script to stop it from following.
I added enableTrigger("What Trigger") at the same time time, with both of these setting to reverse if the room name or ID isn't recognized. "What Trigger" also reenables the room/exits and disables itself after firing.

Go Alias
Code: [show] | [select all] lua
local destination = matches[2]
disableTrigger("Background Based Exits")
enableTrigger("What Trigger")

if tonumber(destination) then
  roomDestination = tonumber(destination)
else
  if mapperRooms[destination] then
    roomDestination = tonumber(mapperRooms[destination])
  else
    cecho("\n<cyan>Location not yet assocated with a room number or room number is invalid.")
    enableTrigger("Background Based Exits")
    disableTrigger("What Trigger")
    return nil
  end
end

if roomDestination then
  map.speedwalk(roomDestination)
  cecho("\n<cyan>Headed to " .. getRoomName(roomDestination).. " in " .. getRoomAreaName(getRoomArea(roomDestination)))
  send("doodoo")
end
Trigger for ^What\?"
Code: [show] | [select all] lua
map.set("currentRoom", roomDestination)
centerview(tonumber(map.currentRoom))
disableTrigger("What Trigger")
enableTrigger("Background Based Exits")
Mudlet crashing: that's not normal at all and unexpected. You're on a mac so the crash report is immensely useful, we'll look at it. Please file it on https://github.com/Mudlet/Mudlet/issues/new.
Will do. If i'm just playing, it seems to be fine. It's just when I'm constantly adding/removing/editing that it gets unstable, which I've been doing nonstop for the past few weeks getting everything transferred over from cmud.

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

Re: Speedwalk followthrough

Post by Vadi »

You are on 4.12 as well, just to be sure? This is serious so would love the reports asap.

kalrykh
Posts: 10
Joined: Fri Sep 17, 2021 7:09 pm

Re: Speedwalk followthrough

Post by kalrykh »

Vadi wrote:
Mon Sep 20, 2021 5:46 am
You are on 4.12 as well, just to be sure? This is serious so would love the reports asap.
Yes sir/ma'am. Crashes or not, I'm still appreciative of the work. Cmud runs like trash on ARM macs (in a VM) or not at all in Crossover and is no longer being maintained. I'm happy to finally have a client I can use on windows, mac and Linux. I've been translating updated settings between cmud on windows and kbtin (tintin++ extended clone) for the mac and Linux for over a decade and it gets old :p Once I get everything set up and working the way I want, I'm hoping to share my setup with some others on the mud and give them a better alternative. Many have been using cracked versions of zmud for 20 years. Thanks again for humoring me and for the work the team is putting in.

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

Re: Speedwalk followthrough

Post by Vadi »

Happy to hear that you like it, everyone here puts in a lot of work :)

Post Reply