Skip to main content.

SoA Map, in Mudlet

posted by Yasin

Yasin
Posts: 110
SoA Map, in Mudlet 1 of 5
Feb. 16, 2025, 11:31 p.m.

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 :toolbox:

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!

Feb. 16, 2025, 11:31 p.m.
Quote
pilgrim
Posts: 282
Re: SoA Map, in Mudlet 2 of 5
Feb. 17, 2025, 8:10 p.m.

This is sincerely awesome, thank you, pof Yasin! 

 

We had some GMCP support going for the game at one point, but I took it out because it was causing some issues with the webclient. However, if we ever get that back in, it'll be fun for you to fiddle about with in mudlet for making fun UI stuff.

Feb. 17, 2025, 8:10 p.m.
Quote
Yasin
Posts: 110
Re: SoA Map, in Mudlet 3 of 5
Feb. 18, 2025, 1:15 a.m.

Thanks, pilgrim! I agree, having GMCP would be FUN. I'd love to experiment with that in the future.

Also, I wanted to share that another player tried this and ran into an issue. FYI, this requires Mudlet 4.8+, as it takes advantage of AdjustableContainers from Geyser, which is Mudlet's layout manager, and those adjustable containers were added only in version 4.8. (The latest is 4.19). So if you're on an older version than 4.8 it won't work. Fortunately, upgrading fixes that right up!

Feb. 18, 2025, 1:15 a.m.
Quote
pilgrim
Posts: 282
Re: SoA Map, in Mudlet 4 of 5
Feb. 18, 2025, 12:12 p.m.

Do you have any specific requests for the things you'd like to have in GMCP? Previously I had in only a few things, like the room name and character name, just kind of testing out the data sending. I figure it might be useful to have stuff like character combat pools (trauma, etc), vicinity data, room exits, map... 

Feb. 18, 2025, 12:12 p.m.
Quote
Yasin
Posts: 110
Re: SoA Map, in Mudlet 5 of 5
Feb. 20, 2025, 4:10 a.m.

I'm new to all this, so I only just recently read up on what could be done with GMCP.

Things that could be fun, if we really wanted to go a bit nuts with display: (This is in no particular order, and umm. Is... maybe... excessive. Tell me to stop.)

  • room name, exits
  • map (replace my clunky underscore parsing with something legit? O.o)
  • inventory, or at least
    • in-hand inventory (I find myself always asking, 'wait, what is he holding, again...')
    • what is being wielded
  • basic stats such as encumbrance
  • weather (sometimes we forget! Though the ambiance does a glorious job reminding us)
  • roundtime!
  • body part coverage, thinking on both what things are being worn where, and the armor and warmth values
  • disguise status ("Oops, my hood's up")
  • room pose
  • vicinity and place status
  • travel string
  • language!
Feb. 20, 2025, 4:10 a.m.
Quote