MDK 1.1.0 release: Logging and Command lines and Background Pics OH MY!

To go along with the Mudlet 4.10 release, here is MDK 1.1.0

demontools.lua

collection of useful functions which I use multiple places or do not fit in another class per se. Color converting functions, mkdir_p functionality, getValueAt (used to turn "gmcp.Char.Vitals" into the actual gmcp.Char.Vitals table), and others.

loggingconsole.lua

  • Do you want your miniconsole to log itself? OF COURSE YOU DO! Put this on your plate and eat it up then.
  • Supports all the Geyser.MiniConsole goodness you're used to. HELL YEAH!
  • Adds new templated constraints path and fileName. Allows you to setup automated rotation by replacing |y with year, |m with the month as 2 digits, |d with the day of the month as two digits, |n as the name of the miniconsole, |e as the file extension(base on logFormat) and |h as the output of getMudletHomeDir(). So if your path is "|h/log/consoleLogs/|y/|m|d" and your fileName is "|n.|e" then your logs will daily rotate into new folders without you having to worry about it.
  • Adds logFormat constraint. "h" logs in html, "l" logs in ansi colored log format, "t" logs in plain text.
  • generated html verified readable on ada-young (but the html source is ugly, do not recommend looking at the raw text)

Command line, background image, and logging support for EMCO

I added support for the miniconsole command lines and background images to EMCO. I find it best to perhaps show with an example.

After installing the mpackage from github, the following < 50 lines of code create a set of chat tabs in an adjustable container with gmcp message handling in Lusternia, including logging, sending the commandline from CT to the ct channel, the CGT commands to the CGT channel, and a background image. Image used is a joke meme someone posted on the Mudlet discord. Picture below, showing the image and the different 'modes' (same as Mudlet's setBackgroundImage for miniconsoles.). The logging requires you also include loggingconsole.lua and demontools.lua.

Add a trigger for "Password correct. Welcome to Lusternia." which does 
sendGMCP([[Core.Supports.Add ["IRE.Target 1"] ]])
sendGMCP([[Core.Supports.Add ["Comm.Channel 1"] ]])
The script itself which drives everything is:
local EMCO = require("MDK-1.EMCO")
emcoContainer = emcoContainer or Adjustable.Container:new({name = "EMCOCon"})
chatEMCO = EMCO:new({
  name = "Chatbox",
  x = 0,
  y = 0,
  height = "100%",
  width = "100%",
  consoles = { "All", "CT", "CGT", "Tells", "Misc", "Map" },
  allTab = true,
  allTabName = "All",
  mapTab = true,
  mapTabName = "Map",
  blankLine = true,
  blink = true,
  timestamp = true,
  fontSize = 12,
  commandLine = true,
  cmdActions = {
    CT = "ct |t",
    CGT = function(txt) send("cgt " .. txt) end,
  },
  backgroundImages = {
    CT = {
      image = "/home/demonnic/Pictures/i-am-the-mud-client-now.png", --edit for your own image
      mode = "center"
    }
  }
}, emcoContainer)

local function chatCapture()
  local info = gmcp.Comm.Channel.Text
  if info.channel:starts("tell ") then
    info.channel = "Tells"
  elseif not table.contains(chatEMCO.consoles, info.channel:upper()) then
    debugc("GMCP channel that isn't in console list: " .. info.channel)
    info.channel = "Misc"
  else
    info.channel = info.channel:upper()
  end
  local txt = ansi2decho(info.text)
  chatEMCO:decho(info.channel,txt)
end
if chatCaptureEventID then
  killAnonymousEventHandler(chatCaptureEventID)
end
chatCaptureEventID = registerAnonymousEventHandler("gmcp.Comm.Channel.Text", chatCapture)


Sign In or Register to comment.