Hi folks!
I figured I'd make this post for any of the Mudlet SoA players out there. The web client is really neat in that it has a built-in live map, and I've always wanted that in Mudlet. Mudlet ofc has its own built in mapper, but that's not the same as the SoA map and doesn't offer, for example, color coding to show the presence of other players, etc. (Or... maybe it does, but I haven't figured out how to do any of that)
So, I built a trigger in Mudlet! For anyone who is interested, it basically looks like this:
It is inside an adjustable container, so you can drag it around the screen as much as you want.
All the trigger does is just look for the series of underscores that comes before and after the map (e.g. when the map displays). So far, this has not conflicted with anything else in-game ... reading might be an issue, but reading fortunately uses hyphens
Now, whenever you use the map command or (if you have config map_view enabled), it'll snag the map output from the main display and throw it in this little container, instead.
How to use this, if you want it:
1. Create a Mudlet Trigger of type perl regex and with matching string ^_{6,}$
(All this does is tell the trigger to fire whenever it sees a line that is nothing but 6 or more underscores)
2. Paste the following script into the LUA script box:
mapConsoleContainer = mapConsoleContainer or Adjustable.Container:new({name="mapConsoleContainer"})
mapConsole = Geyser.MiniConsole:new({
name = "mapConsole",
fontSize = 12,
font = "Cascadia Code",
color = "black",
x = 0, y = 0,
width = "100%", height = "100%",
scrollBar = false
}, mapConsoleContainer)
mapConsole:clear()
mapConsoleContainer:show()
-- Initialize variables if not already, or
-- If we've somehow made a mistake and have a weird number of underscore lines, just reset
if not underscoreLines or #underscoreLines > 2 then
underscoreLines = {}
end
-- Record the line number of this match
local currentLineNumber = getLineNumber()
table.insert(underscoreLines, currentLineNumber)
-- Check if we have a pair of line numbers
if #underscoreLines == 2 then
-- Get the start and end line numbers
local startLine = underscoreLines[1]
local endLine = underscoreLines[2]
-- Capture the lines between the start and end
local capturedMap = getLines(startLine + 1, endLine) -- Exclude the underscores themselves
local mapString = table.concat(capturedMap, "\n") -- Combine the lines into a single string
-- The first thing we do is loop from the first line (after the underscores) to the last-1
-- and copy that over to the mapConsole
moveCursor(0, startLine + 1)
for line = startLine + 1, endLine - 1, 1 do
-- select and copy
selectCurrentLine()
copy()
-- append what's in the clipboard to the map console
mapConsole:appendBuffer()
-- Move up one line
moveCursor(0, line + 1)
end
-- Then, we want to delete all of the map lines from the original display, underscores and all!
-- We loop backwards here to avoid any shenanigans when we delete the lines
moveCursor(0, endLine)
for line = endLine, startLine, -1 do
selectCurrentLine()
deleteLine()
moveCursor(0, line - 1)
end
-- Reset the variable for the next pair
underscoreLines = {}
end
3. Activate the trigger
4. Turn on config map_view
5. Profit? No, not really. But: you'll get the map snagged to the adjustable window instead of the main display!
Hope this is useful to someone! Maybe I'll do some more triggers at some point, they're fun to play with.
Disclaimer: I'm new to LUA and Mudlet coding, so... apologies if the above bugs out on y'all. But let me know and I'll work on adjusting it!