From 9b1be289896c8ebe6ae3ec01f243989418ba59ed Mon Sep 17 00:00:00 2001 From: iLPdev Date: Wed, 1 Mar 2023 10:02:35 -0800 Subject: [PATCH 01/11] feat: :sparkles: announce PR on discord --- PRS.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PRS.lua b/PRS.lua index 3cf200d..f93cc19 100644 --- a/PRS.lua +++ b/PRS.lua @@ -12,3 +12,5 @@ registerAnonymousEventHandler("gmcp.Char.player", function() PRSstats.stats() end, true) +-- Announce PR on Discord +setDiscordGame("Procedural Realms") \ No newline at end of file From 753021e48e8ca1625b467225df2541f7e6c398f0 Mon Sep 17 00:00:00 2001 From: iLPdev Date: Wed, 1 Mar 2023 20:52:09 -0800 Subject: [PATCH 02/11] feat(mapper): :lipstick: add Obsidian Floor terrain type --- prs-mapper.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prs-mapper.lua b/prs-mapper.lua index 348551c..d1d8d40 100644 --- a/prs-mapper.lua +++ b/prs-mapper.lua @@ -96,7 +96,8 @@ local terrain_types = { ["Temple Entrance"] = {id = 85, r = 128, g = 0, b = 128}, ["Frozen River"] = {id = 86, r = 0, g = 255, b = 255}, ["Clearing"] = {id = 87, r = 0, g = 128, b = 0}, - ["Frozen Peak"] = {id = 88, r = 0, g = 0, b = 255}, + ["Frozen Peak"] = {id = 88, r = 0, g = 0, b = 255}, + ["Obsidian Floor"] = {id = 89, r = 192, g = 192, b = 192}, } -- list of possible movement directions and appropriate coordinate changes From d2a724956459b01b0f212fedd54b87a2db4b629f Mon Sep 17 00:00:00 2001 From: iLPdev Date: Wed, 1 Mar 2023 20:55:39 -0800 Subject: [PATCH 03/11] feat(mapper): :lipstick: add Obelisk Exit terrain type --- prs-mapper.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prs-mapper.lua b/prs-mapper.lua index d1d8d40..c4016d3 100644 --- a/prs-mapper.lua +++ b/prs-mapper.lua @@ -97,7 +97,8 @@ local terrain_types = { ["Frozen River"] = {id = 86, r = 0, g = 255, b = 255}, ["Clearing"] = {id = 87, r = 0, g = 128, b = 0}, ["Frozen Peak"] = {id = 88, r = 0, g = 0, b = 255}, - ["Obsidian Floor"] = {id = 89, r = 192, g = 192, b = 192}, + ["Obsidian Floor"] = {id = 89, r = 192, g = 192, b = 192}, + ["Obelisk Exit"] = {id = 90, r = 128, g = 0, b = 128}, } -- list of possible movement directions and appropriate coordinate changes From 8cc6915ad0dd7a7fffb4a4c92b0e57005db37c29 Mon Sep 17 00:00:00 2001 From: iLPdev Date: Wed, 1 Mar 2023 21:39:28 -0800 Subject: [PATCH 04/11] feat(mapper): :lipstick: add Permafrost terrain type --- prs-mapper.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prs-mapper.lua b/prs-mapper.lua index c4016d3..98a5c68 100644 --- a/prs-mapper.lua +++ b/prs-mapper.lua @@ -98,7 +98,8 @@ local terrain_types = { ["Clearing"] = {id = 87, r = 0, g = 128, b = 0}, ["Frozen Peak"] = {id = 88, r = 0, g = 0, b = 255}, ["Obsidian Floor"] = {id = 89, r = 192, g = 192, b = 192}, - ["Obelisk Exit"] = {id = 90, r = 128, g = 0, b = 128}, + ["Obelisk Exit"] = {id = 90, r = 128, g = 0, b = 128}, + ["Permafrost"] = {id = 91, r = 0, g = 255, b = 255}, } -- list of possible movement directions and appropriate coordinate changes From 1f5cf81db0b1bba3164c1e26feccdf2394ef91f6 Mon Sep 17 00:00:00 2001 From: iLPdev Date: Wed, 8 Mar 2023 08:18:56 -0800 Subject: [PATCH 05/11] feat(mapper): :lipstick: add Gold Mine Tailings terrain type --- prs-mapper.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prs-mapper.lua b/prs-mapper.lua index 98a5c68..dc4254e 100644 --- a/prs-mapper.lua +++ b/prs-mapper.lua @@ -99,7 +99,8 @@ local terrain_types = { ["Frozen Peak"] = {id = 88, r = 0, g = 0, b = 255}, ["Obsidian Floor"] = {id = 89, r = 192, g = 192, b = 192}, ["Obelisk Exit"] = {id = 90, r = 128, g = 0, b = 128}, - ["Permafrost"] = {id = 91, r = 0, g = 255, b = 255}, + ["Permafrost"] = {id = 91, r = 0, g = 255, b = 255}, + ["Gold Mine Tailings"] = {id = 92, r = 255, g = 255, b = 255}, } -- list of possible movement directions and appropriate coordinate changes From be5a0e81a5871b4eb07fb02fd3a9d2e28b14b7e4 Mon Sep 17 00:00:00 2001 From: iLPdev Date: Tue, 21 Mar 2023 10:17:28 -0700 Subject: [PATCH 06/11] docs(version): :memo: update local version --- PRS.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PRS.lua b/PRS.lua index f93cc19..2d2fbff 100644 --- a/PRS.lua +++ b/PRS.lua @@ -1,5 +1,5 @@ -- Procedural Realms Script (PRS) by Stack -local version = "0.12.0" +local version = "1.3.0" -- check if the generic_mapper package is installed and, if so, uninstall it if table.contains(getPackages(),"generic_mapper") then From 56d49370f532768a96059d28acb05f37b8908c1b Mon Sep 17 00:00:00 2001 From: iLPdev Date: Tue, 28 Mar 2023 09:30:56 -0700 Subject: [PATCH 07/11] build: update to MDK v2.8.3 (#64) * docs(readme): add usage section * docs(readme): add Usage to TOC * build: update MDK dependencies --- MDK/demontools.lua | 84 ++++----- MDK/emco.lua | 415 ++++++++++++++++++++++++----------------- MDK/loggingconsole.lua | 26 +-- MDK/sug.lua | 48 ++--- README.md | 32 +++- 5 files changed, 349 insertions(+), 256 deletions(-) diff --git a/MDK/demontools.lua b/MDK/demontools.lua index 04d069c..49cac61 100644 --- a/MDK/demontools.lua +++ b/MDK/demontools.lua @@ -1104,29 +1104,29 @@ end -- -- -- --- format --- What format to return the text as? 'h' for html, 'c' for cecho, 'a' for ansi, 'd' for decho, and 'x' for hecho --- "d" +-- format +-- What format to return the text as? 'h' for html, 'c' for cecho, 'a' for ansi, 'd' for decho, and 'x' for hecho +-- "d" -- -- --- win --- what console/window to dump the buffer of? --- "main" +-- win +-- what console/window to dump the buffer of? +-- "main" -- -- --- start_line --- What line to start dumping the buffer from? --- 0 +-- start_line +-- What line to start dumping the buffer from? +-- 0 -- -- --- end_line --- What line to stop dumping the buffer on? --- Last line of the console +-- end_line +-- What line to stop dumping the buffer on? +-- Last line of the console -- -- --- includeHtmlWrapper --- If the format is html, should it include the front and back portions required to make it a functioning html page? --- true +-- includeHtmlWrapper +-- If the format is html, should it include the front and back portions required to make it a functioning html page? +-- true -- -- -- @@ -1146,49 +1146,49 @@ end -- -- -- --- cols --- Number of columsn wide to display the colors in --- 4 +-- cols +-- Number of columsn wide to display the colors in +-- 4 -- -- --- search --- If not the empty string, will check colors against string.find using this property.
IE if set to "blue" only colors which include the word 'blue' would be listed --- "" +-- search +-- If not the empty string, will check colors against string.find using this property.
IE if set to "blue" only colors which include the word 'blue' would be listed +-- "" -- -- --- sort --- If true, sorts alphabetically. Otherwise sorts based on the color value --- false +-- sort +-- If true, sorts alphabetically. Otherwise sorts based on the color value +-- false -- -- --- echoOnly --- If true, colors will not be clickable links --- false +-- echoOnly +-- If true, colors will not be clickable links +-- false -- -- --- window --- What window/console to echo the colors out to. --- "main" +-- window +-- What window/console to echo the colors out to. +-- "main" -- -- --- removeDupes --- If true, will remove snake_case entries and 'gray' in favor of 'grey' --- true +-- removeDupes +-- If true, will remove snake_case entries and 'gray' in favor of 'grey' +-- true -- -- --- columnSort --- If true, will print top-to-bottom, then left-to-right. false is like showColors --- true +-- columnSort +-- If true, will print top-to-bottom, then left-to-right. false is like showColors +-- true -- -- --- justText --- If true, will echo the text in the color and leave the background black.
If false, the background will be the colour(like showColors). --- false +-- justText +-- If true, will echo the text in the color and leave the background black.
If false, the background will be the colour(like showColors). +-- false -- -- --- color_table --- Table of colors to display. If you provide your own table, it must be in the same format as Mudlet's own color_table --- color_table +-- color_table +-- Table of colors to display. If you provide your own table, it must be in the same format as Mudlet's own color_table +-- color_table -- -- -- diff --git a/MDK/emco.lua b/MDK/emco.lua index 56eb222..123ac13 100644 --- a/MDK/emco.lua +++ b/MDK/emco.lua @@ -42,6 +42,11 @@ local EMCO = Geyser.Container:new({ gags = {}, notifyTabs = {}, notifyWithFocus = false, + cmdLineStyleSheet = [[ + QPlainTextEdit { + border: 1px solid grey; + } + ]] }) -- patch Geyser.MiniConsole if it does not have its own display method defined @@ -80,275 +85,280 @@ end -- -- -- --- timestamp --- display timestamps on the miniconsoles? --- false +-- timestamp +-- display timestamps on the miniconsoles? +-- false -- -- --- blankLine --- put a blank line between appends/echos? --- false +-- blankLine +-- put a blank line between appends/echos? +-- false -- -- --- scrollbars --- enable scrollbars for the miniconsoles? --- false +-- scrollbars +-- enable scrollbars for the miniconsoles? +-- false -- -- --- customTimestampColor --- if showing timestamps, use a custom color? --- false +-- customTimestampColor +-- if showing timestamps, use a custom color? +-- false -- -- --- mapTab --- should we attach the Mudlet Mapper to this EMCO? --- false +-- mapTab +-- should we attach the Mudlet Mapper to this EMCO? +-- false -- -- --- mapTabName --- Which tab should we attach the map to? +-- mapTabName +-- Which tab should we attach the map to? --
If mapTab is true and you do not set this, it will throw an error --- +-- -- -- --- blinkFromAll --- should tabs still blink, even if you're on the 'all' tab? --- false +-- blinkFromAll +-- should tabs still blink, even if you're on the 'all' tab? +-- false -- -- --- preserveBackground --- preserve the miniconsole background color during append()? --- false +-- preserveBackground +-- preserve the miniconsole background color during append()? +-- false -- -- --- gag --- when running :append(), should we also gag the line? --- false +-- gag +-- when running :append(), should we also gag the line? +-- false -- -- --- timestampFormat --- Format string for the timestamp. Uses getTime() --- "HH:mm:ss" +-- timestampFormat +-- Format string for the timestamp. Uses getTime() +-- "HH:mm:ss" -- -- --- timestampBGColor --- Custom BG color to use for timestamps. Any valid Geyser.Color works. --- "blue" +-- timestampBGColor +-- Custom BG color to use for timestamps. Any valid Geyser.Color works. +-- "blue" -- -- --- timestampFGColor --- Custom FG color to use for timestamps. Any valid Geyser.Color works --- "red" +-- timestampFGColor +-- Custom FG color to use for timestamps. Any valid Geyser.Color works +-- "red" -- -- --- allTab --- Should we send everything to an 'all' tab? --- false +-- allTab +-- Should we send everything to an 'all' tab? +-- false -- -- --- allTabName --- And which tab should we use for the 'all' tab? --- "All" +-- allTabName +-- And which tab should we use for the 'all' tab? +-- "All" -- -- --- blink --- Should we blink tabs that have been written to since you looked at them? --- false +-- blink +-- Should we blink tabs that have been written to since you looked at them? +-- false -- -- --- blinkTime --- How long to wait between blinks, in seconds? --- 3 +-- blinkTime +-- How long to wait between blinks, in seconds? +-- 3 -- -- --- fontSize --- What font size to use for the miniconsoles? --- 9 +-- fontSize +-- What font size to use for the miniconsoles? +-- 9 -- -- --- font --- What font to use for the miniconsoles? --- +-- font +-- What font to use for the miniconsoles? +-- -- -- --- tabFont --- What font to use for the tabs? --- +-- tabFont +-- What font to use for the tabs? +-- -- -- --- activeTabCss --- What css to use for the active tab? --- "" +-- activeTabCss +-- What css to use for the active tab? +-- "" -- -- --- inactiveTabCSS --- What css to use for the inactive tabs? --- "" +-- inactiveTabCSS +-- What css to use for the inactive tabs? +-- "" -- -- --- activeTabFGColor --- What color to use for the text on the active tab. Any Geyser.Color works. --- "purple" +-- activeTabFGColor +-- What color to use for the text on the active tab. Any Geyser.Color works. +-- "purple" -- -- --- inactiveTabFGColor --- What color to use for the text on the inactive tabs. Any Geyser.Color works. --- "white" +-- inactiveTabFGColor +-- What color to use for the text on the inactive tabs. Any Geyser.Color works. +-- "white" -- -- --- activeTabBGColor --- What BG color to use for the active tab? Any Geyser.Color works. Overriden by activeTabCSS --- "<0,180,0>" +-- activeTabBGColor +-- What BG color to use for the active tab? Any Geyser.Color works. Overriden by activeTabCSS +-- "<0,180,0>" -- -- --- inactiveTabBGColor --- What BG color to use for the inactavie tabs? Any Geyser.Color works. Overridden by inactiveTabCSS --- "<60,60,60>" +-- inactiveTabBGColor +-- What BG color to use for the inactavie tabs? Any Geyser.Color works. Overridden by inactiveTabCSS +-- "<60,60,60>" -- -- --- consoleColor --- Default background color for the miniconsoles. Any Geyser.Color works --- "black" +-- consoleColor +-- Default background color for the miniconsoles. Any Geyser.Color works +-- "black" -- -- --- tabBoxCSS --- tss for the entire tabBox (not individual tabs) --- "" +-- tabBoxCSS +-- tss for the entire tabBox (not individual tabs) +-- "" -- -- --- tabBoxColor --- What color to use for the tabBox? Any Geyser.Color works. Overridden by tabBoxCSS --- "black" +-- tabBoxColor +-- What color to use for the tabBox? Any Geyser.Color works. Overridden by tabBoxCSS +-- "black" -- -- --- consoleContainerCSS --- CSS to use for the container holding the miniconsoles --- "" +-- consoleContainerCSS +-- CSS to use for the container holding the miniconsoles +-- "" -- -- --- consoleContainerColor --- Color to use for the container holding the miniconsole. Any Geyser.Color works. Overridden by consoleContainerCSS --- "black" +-- consoleContainerColor +-- Color to use for the container holding the miniconsole. Any Geyser.Color works. Overridden by consoleContainerCSS +-- "black" -- -- --- gap --- How many pixels to place between the tabs and the miniconsoles? --- 1 +-- gap +-- How many pixels to place between the tabs and the miniconsoles? +-- 1 -- -- --- consoles --- List of the tabs for this EMCO in table format --- { "All" } +-- consoles +-- List of the tabs for this EMCO in table format +-- { "All" } -- -- --- allTabExclusions --- List of the tabs which should never echo to the 'all' tab in table format --- {} +-- allTabExclusions +-- List of the tabs which should never echo to the 'all' tab in table format +-- {} -- -- --- tabHeight --- How many pixels high should the tabs be? --- 25 +-- tabHeight +-- How many pixels high should the tabs be? +-- 25 -- -- --- autoWrap --- Use autoWrap for the miniconsoles? --- true +-- autoWrap +-- Use autoWrap for the miniconsoles? +-- true -- -- --- wrapAt --- How many characters to wrap it, if autoWrap is turned off? --- 300 +-- wrapAt +-- How many characters to wrap it, if autoWrap is turned off? +-- 300 -- -- --- leftMargin --- Number of pixels to put between the left edge of the EMCO and the miniconsole? --- 0 +-- leftMargin +-- Number of pixels to put between the left edge of the EMCO and the miniconsole? +-- 0 -- -- --- rightMargin --- Number of pixels to put between the right edge of the EMCO and the miniconsole? --- 0 +-- rightMargin +-- Number of pixels to put between the right edge of the EMCO and the miniconsole? +-- 0 -- -- --- bottomMargin --- Number of pixels to put between the bottom edge of the EMCO and the miniconsole? --- 0 +-- bottomMargin +-- Number of pixels to put between the bottom edge of the EMCO and the miniconsole? +-- 0 -- -- --- topMargin --- Number of pixels to put between the top edge of the miniconsole container, and the miniconsole? This is in addition to gap --- 0 +-- topMargin +-- Number of pixels to put between the top edge of the miniconsole container, and the miniconsole? This is in addition to gap +-- 0 -- -- --- timestampExceptions --- Table of tabnames which should not get timestamps even if timestamps are turned on --- {} +-- timestampExceptions +-- Table of tabnames which should not get timestamps even if timestamps are turned on +-- {} -- -- --- tabFontSize --- Font size for the tabs --- 8 +-- tabFontSize +-- Font size for the tabs +-- 8 -- -- --- tabBold --- Should the tab text be bold? Boolean value --- false +-- tabBold +-- Should the tab text be bold? Boolean value +-- false -- -- --- tabItalics --- Should the tab text be italicized? --- false +-- tabItalics +-- Should the tab text be italicized? +-- false -- -- --- tabUnderline --- Should the tab text be underlined? --- false +-- tabUnderline +-- Should the tab text be underlined? +-- false -- -- --- tabAlignment --- Valid alignments are 'c', 'center', 'l', 'left', 'r', 'right', or '' to not include the alignment as part of the echo (to allow the stylesheet to handle it) --- 'c' +-- tabAlignment +-- Valid alignments are 'c', 'center', 'l', 'left', 'r', 'right', or '' to not include the alignment as part of the echo (to allow the stylesheet to handle it) +-- 'c' -- -- --- commandLine --- Should we enable commandlines for the miniconsoles? --- false +-- commandLine +-- Should we enable commandlines for the miniconsoles? +-- false -- -- --- cmdActions --- A table with console names as keys, and values which are templates for the command to send. see the setCustomCommandline function for more --- {} +-- cmdActions +-- A table with console names as keys, and values which are templates for the command to send. see the setCustomCommandline function for more +-- {} -- -- --- backgroundImages --- A table containing definitions for the background images. Each entry should have a key the same name as the tab it applies to, with entries "image" which is the path to the image file,
and "mode" which determines how it is displayed. "border" stretches, "center" center, "tile" tiles, and "style". See Mudletwikilink for details. --- {} +-- cmdLineStyleSheet +-- What stylesheet to use for the command lines. +-- "QPlainTextEdit {\n border: 1px solid grey;\n }\n" -- -- --- bufferSize --- Number of lines of scrollback to keep for the miniconsoles --- 100000 +-- backgroundImages +-- A table containing definitions for the background images. Each entry should have a key the same name as the tab it applies to, with entries "image" which is the path to the image file,
and "mode" which determines how it is displayed. "border" stretches, "center" center, "tile" tiles, and "style". See Mudletwikilink for details. +-- {} -- -- --- deleteLines --- Number of lines to delete if a console's buffer fills up. --- 1000 +-- bufferSize +-- Number of lines of scrollback to keep for the miniconsoles +-- 100000 -- -- --- gags --- A table of Lua patterns you wish to gag from being added to the EMCO. Useful for removing mob says and such example: {[[^A green leprechaun says, ".*"$]], "^Bob The Dark Lord of the Keep mutters darkly to himself.$"} see this tutorial on Lua patterns for more information. --- {} +-- deleteLines +-- Number of lines to delete if a console's buffer fills up. +-- 1000 -- -- --- notifyTabs --- Tables containing the names of all tabs you want to send notifications. IE {"Says", "Tells", "Org"} --- {} +-- gags +-- A table of Lua patterns you wish to gag from being added to the EMCO. Useful for removing mob says and such example: {[[^A green leprechaun says, ".*"$]], "^Bob The Dark Lord of the Keep mutters darkly to himself.$"} see this tutorial on Lua patterns for more information. +-- {} -- -- --- notifyWithFocus --- If true, EMCO will send notifications even if Mudlet has focus. If false, it will only send them when Mudlet does NOT have focus. --- false +-- notifyTabs +-- Tables containing the names of all tabs you want to send notifications. IE {"Says", "Tells", "Org"} +-- {} +-- +-- +-- notifyWithFocus +-- If true, EMCO will send notifications even if Mudlet has focus. If false, it will only send them when Mudlet does NOT have focus. +-- false -- -- -- @@ -701,7 +711,6 @@ function EMCO:createComponentsForTab(tabName) if self.tabFont then tab:setFont(self.tabFont) end - tab:echo(tabName, self.inactiveTabFGColor) tab:setAlignment(self.tabAlignment) tab:setFontSize(self.tabFontSize) tab:setItalics(self.tabItalics) @@ -710,6 +719,7 @@ function EMCO:createComponentsForTab(tabName) tab:setClickCallback(self.switchTab, self, tabName) self.tabs[tabName] = tab self:adjustTabBackground(tabName) + tab:echo(tabName, self.inactiveTabFGColor) local window local windowConstraints = { x = self.leftMargin, @@ -718,6 +728,7 @@ function EMCO:createComponentsForTab(tabName) width = string.format("-%dpx", self.rightMargin), name = string.format("%sWindow%s", self.name, tabName), commandLine = self.commandLine, + cmdLineStyleSheet = self.cmdLineStyleSheet, path = self:processTemplate(self.path, tabName), fileName = self:processTemplate(self.fileName, tabName), logFormat = self.logFormat @@ -758,6 +769,7 @@ function EMCO:createComponentsForTab(tabName) end window:hide() self:processImage(tabName) + self:switchTab(tabName) end --- Sets the buffer size and number of lines to delete for all managed miniconsoles. @@ -899,6 +911,57 @@ function EMCO:setFileName(fileName) end end +--- Sets the stylesheet for command lines in this EMCO +-- @tparam string styleSheet the stylesheet to use for the command line. See https://wiki.mudlet.org/w/Manual:Lua_Functions#setCmdLineStyleSheet for examples +function EMCO:setCmdLineStyleSheet(styleSheet) + self.cmdLineStyleSheet = styleSheet + if not styleSheet then + return + end + for _, window in pairs(self.mc) do + window:setCmdLineStyleSheet(styleSheet) + end +end +--- Enables the commandLine on the specified tab. +-- @tparam string tabName the name of the tab to turn the commandLine on for +-- @param template the template for the commandline to use, or the function to run when enter is hit. +-- @usage myEMCO:enableCmdLine(tabName, template) +function EMCO:enableCmdLine(tabName, template) + if not table.contains(self.consoles, tabName) then + return nil, f"{self.name}:enableCmdLine(tabName,template) tabName is not in the console list. Valid options are {table.concat(self.consoles, 'm')}" + end + local window = self.mc[tabName] + window:enableCommandLine() + if self.cmdLineStyleSheet then + window:setCmdLineStyleSheet(self.cmdLineStyleSheet) + end + self:setCmdAction(tabName, template) +end + +--- Enables all command lines, using whatever template they may currently have set +function EMCO:enableAllCmdLines() + for _, tabName in ipairs(self.consoles) do + self:enableCmdLine(tabName, self.cmdActions[tabName]) + end +end + +--- Disables all commands line, but does not change their template +function EMCO:disableAllCmdLines() + for _, tabName in ipairs(self.consoles) do + self:disableCmdLine(tabName) + end +end + +--- Disables the command line for a particular tab +-- @tparam string tabName the name of the tab to disable the command line of. +function EMCO:disableCmdLine(tabName) + if not table.contains(self.consoles, tabName) then + return nil, f"{self.name}:disableCmdLine(tabName,template) tabName is not in the console list. Valid options are {table.concat(self.consoles, 'm')}" + end + local window = self.mc[tabName] + window:disableCommandLine() +end + --- Sets the command action for a tab's command line. Can either be a template string to send where '|t' is replaced by the text sent, or a funnction which takes the text --- @tparam string tabName the name of the tab to set the command action on --- @param template the template for the commandline to use, or the function to run when enter is hit. @@ -968,12 +1031,8 @@ function EMCO:reset() for _, tabName in ipairs(self.consoles) do self:createComponentsForTab(tabName) end - local default - if self.currentTab == "" then - default = self.allTabName or self.consoles[1] - else - default = self.currentTab - end + + local default = self.allTabName or self.consoles[1] self:switchTab(default) end @@ -1002,7 +1061,7 @@ function EMCO:createContainers() end function EMCO:stripTimeChars(str) - return string.gsub(string.trim(str), '[hHmMszZaApPdy:. ]', '') + return string.gsub(string.trim(str), '[ThHmMszZaApPdy0-9%-%+:. ]', '') end --- Expands boolean definitions to be more flexible. @@ -1411,6 +1470,20 @@ function EMCO:adjustTabBackgrounds() end end +--- Sets the inactiveTabCSS +-- @tparam string stylesheet the stylesheet to use for inactive tabs. +function EMCO:setInactiveTabCSS(stylesheet) + self.inactiveTabCSS = stylesheet + self:adjustTabBackgrounds() +end + +--- Sets the activeTabCSS +-- @tparam string stylesheet the stylesheet to use for active tab. +function EMCO:setActiveTabCSS(stylesheet) + self.activeTabCSS = stylesheet + self:adjustTabBackgrounds() +end + --- Sets the FG color for the active tab -- @param color Color string suitable for decho or hecho, or color name eg "purple", or table of colors {r,g,b} function EMCO:setActiveTabFGColor(color) @@ -2142,6 +2215,7 @@ function EMCO:save() gags = self.gags, notifyTabs = self.notifyTabs, notifyWithFocus = self.notifyWithFocus, + cmdLineStyleSheet = self.cmdLineStyleSheet, } local dirname = getMudletHomeDir() .. "/EMCO/" local filename = dirname .. self.name:gsub("[<>:'\"/\\|?*]", "_") .. ".lua" @@ -2211,6 +2285,7 @@ function EMCO:load() self.gags = configTable.gags self.notifyTabs = configTable.notifyTabs self.notifyWithFocus = configTable.notifyWithFocus + self.cmdLineStyleSheet = configTable.cmdLineStyleSheet self:move(configTable.x, configTable.y) self:resize(configTable.width, configTable.height) self:reset() diff --git a/MDK/loggingconsole.lua b/MDK/loggingconsole.lua index ec7849f..cbc812a 100644 --- a/MDK/loggingconsole.lua +++ b/MDK/loggingconsole.lua @@ -22,24 +22,24 @@ local LoggingConsole = {log = true, logFormat = "h", path = "|h/log/consoleLogs/ -- -- -- --- log --- Should the miniconsole be logging? --- true +-- log +-- Should the miniconsole be logging? +-- true -- -- --- logFormat --- "h" for html, "t" for plaintext, "l" for log (with ansi) --- h +-- logFormat +-- "h" for html, "t" for plaintext, "l" for log (with ansi) +-- h -- -- --- path --- The path the file lives in. It is templated.
|h is replaced by the profile homedir.
|y by 4 digit year.
|m by 2 digit month
|d by 2 digit day
|n by the name constraint
|e by the file extension (html for h logType, log for others) --- "|h/log/consoleLogs/|y/|m/|d/" +-- path +-- The path the file lives in. It is templated.
|h is replaced by the profile homedir.
|y by 4 digit year.
|m by 2 digit month
|d by 2 digit day
|n by the name constraint
|e by the file extension (html for h logType, log for others) +-- "|h/log/consoleLogs/|y/|m/|d/" -- -- --- fileName --- The name of the log file. It is templated, same as path above --- "|n.|e" +-- fileName +-- The name of the log file. It is templated, same as path above +-- "|n.|e" -- -- -- @@ -188,7 +188,7 @@ function LoggingConsole:xEcho(str, etype, log) local logType = self.logFormat if logType:find("h") then logType = "h" - else + elseif logType ~= "t" then logType = "l" end if etype == "d" then -- decho diff --git a/MDK/sug.lua b/MDK/sug.lua index 3db8a73..2624aff 100644 --- a/MDK/sug.lua +++ b/MDK/sug.lua @@ -56,44 +56,44 @@ end -- default -- -- --- active --- boolean, if true starts the timer updating --- true +-- active +-- boolean, if true starts the timer updating +-- true -- -- --- updateTime --- How often should the gauge autoupdate? Milliseconds. 0 to disable the timer but still allow event updates --- 333 +-- updateTime +-- How often should the gauge autoupdate? Milliseconds. 0 to disable the timer but still allow event updates +-- 333 -- -- --- currentVariable --- What variable will hold the 'current' value of the gauge? Pass the name as a string, IE "currentHP" or "gmcp.Char.Vitals.hp" --- "" +-- currentVariable +-- What variable will hold the 'current' value of the gauge? Pass the name as a string, IE "currentHP" or "gmcp.Char.Vitals.hp" +-- "" -- -- --- maxVariable --- What variable will hold the 'current' value of the gauge? Pass the name as a string, IE "maxHP" or "gmcp.Char.Vitals.maxhp" --- "" +-- maxVariable +-- What variable will hold the 'current' value of the gauge? Pass the name as a string, IE "maxHP" or "gmcp.Char.Vitals.maxhp" +-- "" -- -- --- textTemplate --- Template to use for the text on the gauge. "|c" replaced with current value, "|m" replaced with max value, "|p" replaced with the % full the gauge should be --- " |c/|m |p%" +-- textTemplate +-- Template to use for the text on the gauge. "|c" replaced with current value, "|m" replaced with max value, "|p" replaced with the % full the gauge should be +-- " |c/|m |p%" -- -- --- defaultCurrent --- What value to use if the currentVariable points to nil or something which cannot be made a number? --- 50 +-- defaultCurrent +-- What value to use if the currentVariable points to nil or something which cannot be made a number? +-- 50 -- -- --- defaultMax --- What value to use if the maxVariable points to nil or something which cannot be made a number? --- 100 +-- defaultMax +-- What value to use if the maxVariable points to nil or something which cannot be made a number? +-- 100 -- -- --- updateEvent --- The name of an event to listen for to perform an update. Can be run alongside or instead of the timer updates. Empty string to turn off --- "" +-- updateEvent +-- The name of an event to listen for to perform an update. Can be run alongside or instead of the timer updates. Empty string to turn off +-- "" -- -- -- @param container The Geyser container for this gauge diff --git a/README.md b/README.md index 619fcb9..be3a56a 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Mudlet Forum Topic: [https://forums.mudlet.org/viewtopic.php?f=6&t=23126] - [Background](#background) - [Install](#install) +- [Usage](#usage) - [Roadmap](#roadmap) - [Maintainer](#maintainer) - [Acknowledgements](#acknowledgements) @@ -61,16 +62,12 @@ Mudlet Forum Topic: [https://forums.mudlet.org/viewtopic.php?f=6&t=23126] - v0.12.0 - Mini-Map Congruence - v0.5.0 - Drag-and-Drop Package Installation - - ### Features - Automatic GMCP mapping of Procedural Realms MUD, including instanced areas/zones. - Automatic GMCP room styling based on terrain to matches colors in PR's 'map' and 'look' quickmap. - Tabbed Communications Channels with CLI -- Adjustable, dockable, resizable, and no conversations lost in scroll! -- Self-updating gauges for character vitals, including Hit Points, Energy, Stamina, Rage, Combo, and eXperience Points. +- Self-Updating Gauges for character vitals, including Hit Points, Energy, Stamina, Rage, Combo, and eXperience Points. - Speedwalking and pathfinding - Efficiently get where you're going - and fast! ### Built With @@ -104,7 +101,7 @@ The [Mudlet Makers](https://github.com/Mudlet/Mudlet/graphs/contributors) could +## Usage + +### User Interface Configuration + +There are two fully configurable UI elements that are currently included in PRS by default: the EMCO (Communications Tabs and Map) and the Vitals (character Stat guages) windows. The UI windows are docked on the right of mudlet's main display upon connection to the game server. The windows may be resized by dragging their borders, moved by click/dragging their window title/headings, as well as undocked or closed by clicking on their respective upper-right pop-out or close icons. + +On initial usage, you will typically need to resize the windows both horizontally and vertically to reveal their contents fully. Note that the window configurations are preserved but not restored until connection to the game server has been established. + +### Command Line Interface + +- A command line interface exists at the bottom of the `Chat`, `Newbie`, `Trade`, and `Local` tabs within the EMCO window. To communicate through any of these channels, simply click on the empty bottom line of the tab and input your text to be sent through the corresponding communication channel. + +- **@tell** - You may communicate privately with another player via the game's `tell` command from within any of the EMCO communication tabs' CLI via `@ `. For example, entering `@stack blah foo` into a tab's CLI will issue `tell stack blah foo` to the game server. + +**[^Top](#table-of-contents)** + ## Roadmap From 0754b4167b3cabb9b02246ca87d460a41435a2b2 Mon Sep 17 00:00:00 2001 From: eterchun Date: Tue, 28 Mar 2023 12:32:51 -0400 Subject: [PATCH 08/11] fix:(mapper): add hint for room stub connection (#59) I was experiencing errors in the automatic direction connection that seem to be fixed by specifying the room id we already looked up. --- prs-mapper.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prs-mapper.lua b/prs-mapper.lua index dc4254e..9209ee7 100644 --- a/prs-mapper.lua +++ b/prs-mapper.lua @@ -200,7 +200,7 @@ local function make_room() local exit_coords_delta = move_vectors[dir] local exit_room_id = get_room_id_by_coordinates(info.area, coords[1] + exit_coords_delta[1], coords[2] + exit_coords_delta[2], coords[3] + exit_coords_delta[3]) if exit_room_id ~= nill then - connectExitStub(room_id, dir) + connectExitStub(room_id, exit_room_id, dir) end end end @@ -239,7 +239,7 @@ local function handle_move() local exit_coords_delta = move_vectors[stubmap[v]] local exit_room_id = get_room_id_by_coordinates(info.area, coords[1] + exit_coords_delta[1], coords[2] + exit_coords_delta[2], coords[3] + exit_coords_delta[3]) if exit_room_id ~= nill then - connectExitStub(room_id, v) + connectExitStub(room_id, exit_room_id, v) end end end From 92782db2d06736d6fa4b53cb031541abaf8947df Mon Sep 17 00:00:00 2001 From: iLPdev Date: Tue, 2 May 2023 16:17:14 -0700 Subject: [PATCH 09/11] build: update MDK to 2.9.0 (#67) --- MDK/demontools.lua | 29 ++++----------------------- MDK/sug.lua | 50 +++++++++++++++++++++++----------------------- 2 files changed, 29 insertions(+), 50 deletions(-) diff --git a/MDK/demontools.lua b/MDK/demontools.lua index 49cac61..defcb4a 100644 --- a/MDK/demontools.lua +++ b/MDK/demontools.lua @@ -93,32 +93,11 @@ local htmlHeaderPattern = [=[ ]=] --- internal function, recursively digs for a value within subtables if possible -local function digForValue(dataFrom, tableTo) - if dataFrom == nil or table.size(tableTo) == 0 then - return dataFrom - else - local newData = dataFrom[tableTo[1]] - table.remove(tableTo, 1) - return digForValue(newData, tableTo) - end -end - -- Internal function, used to turn a string variable name into a value local function getValueAt(accessString) - if accessString == "" then - return nil - end - local tempTable = accessString:split("%.") - local accessTable = {} - for i, v in ipairs(tempTable) do - if tonumber(v) then - accessTable[i] = tonumber(v) - else - accessTable[i] = v - end - end - return digForValue(_G, accessTable) + local ok, err = pcall(loadstring("return " .. tostring(accessString))) + if ok then return err end + return nil, err end -- internal sorting function, sorts first by hue, then luminosity, then value @@ -832,7 +811,7 @@ function string.tocolor(self) local strTable = {} local part1 = {} local part2 = {} - self:gsub(".", function(c) + _ = self:gsub(".", function(c) table.insert(strTable, c) end) for index, value in ipairs(strTable) do diff --git a/MDK/sug.lua b/MDK/sug.lua index 2624aff..ea99c90 100644 --- a/MDK/sug.lua +++ b/MDK/sug.lua @@ -15,33 +15,11 @@ local SUG = { strict = true, } --- ========== Copied from demontools.lua in order to cut the dependency for just this small functionality ========== --- internal function, recursively digs for a value within subtables if possible -local function digForValue(dataFrom, tableTo) - if dataFrom == nil or table.size(tableTo) == 0 then - return dataFrom - else - local newData = dataFrom[tableTo[1]] - table.remove(tableTo, 1) - return digForValue(newData, tableTo) - end -end - -- Internal function, used to turn a string variable name into a value local function getValueAt(accessString) - if accessString == "" then - return nil - end - local tempTable = accessString:split("%.") - local accessTable = {} - for i, v in ipairs(tempTable) do - if tonumber(v) then - accessTable[i] = tonumber(v) - else - accessTable[i] = v - end - end - return digForValue(_G, accessTable) + local ok, err = pcall(loadstring("return " .. tostring(accessString))) + if ok then return err end + return nil, err end -- ========== End section copied from demontools.lua @@ -95,6 +73,11 @@ end -- The name of an event to listen for to perform an update. Can be run alongside or instead of the timer updates. Empty string to turn off -- "" -- +-- +-- updateHook +-- A function which is run each time the gauge updates. Should take 3 arguments, the gauge itself, current value, and max value. You can return new current and max values to be used, for example `return 34, 120` would cause the gauge to use 34 for current and 120 for max regardless of what the variables it reads say. +-- +-- -- -- @param container The Geyser container for this gauge -- @usage @@ -194,6 +177,16 @@ function SUG:setTextTemplate(template) self:update() end +--- Set the updateHook function which is run just prior to the gauge updating +-- @tparam function func The function which will be called when the gauge updates. It should take 3 arguments, the gauge itself, the current value, and the max value. If you wish to override the current or max values used for the gauge, you can return new current and max values, like `return newCurrent newMax` +function SUG:setUpdateHook(func) + local funcType = type(func) + if funcType ~= "function" then + return nil, "setUpdateHook only takes functions, no strings or anything like that. You passed in: " .. funcType + end + self.updateHook = func +end + --- Stops the Self Updating Gauge from updating function SUG:stop() self.active = false @@ -241,6 +234,13 @@ function SUG:update() self.name, self.currentVariable, self.maxVariable)) end end + if self.updateHook and type(self.updateHook) == "function" then + local ok, newcur, newmax = pcall(self.updateHook, self, current, max) + if ok and newcur then + current = newcur + max = newmax and newmax or self.defaultMax + end + end local text = self.textTemplate local percent = math.floor((current / max * 100) + 0.5) text = text:gsub("|c", current) From 9c32c42b7a56ab5533a976a282168ad2ab418c2a Mon Sep 17 00:00:00 2001 From: iLPdev Date: Tue, 2 May 2023 16:22:16 -0700 Subject: [PATCH 10/11] docs(readme): add Usage (#68) * docs(readme): add usage section * docs(readme): add Usage to TOC From 80f864795105b42f5204dab6a3bbeffcd461fe4d Mon Sep 17 00:00:00 2001 From: iLPdev Date: Tue, 2 May 2023 16:26:58 -0700 Subject: [PATCH 11/11] docs(readme): add Usage (#69) * docs(readme): add usage section * docs(readme): add Usage to TOC