Class EMCO
Embeddable Multi Console Object.
This is essentially YATCO, but with some tweaks, updates, and it returns an object similar to Geyser so that you can a.) have multiple of them and b.) easily embed it into your existing UI as you would any other Geyser element.
Info:
- Copyright: 2020 Damian Monogue
- License: MIT, see LICENSE.lua
- Author: Damian Monogue
Methods
EMCO:new(cons, container) | Creates a new Embeddable Multi Console Object. |
EMCO:miniConvertYATCO() | Scans for the old YATCO configuration values and prints out a set of constraints to use. |
EMCO:convertYATCO() | Echos to the main console a script object you can add which will fully convert YATCO to EMCO. |
EMCO:display(tabName, item[, item2[, item_n]]) | Display the contents of one or more variables to an EMCO tab. |
EMCO:removeTab(tabName) | Remove a tab from the EMCO |
EMCO:addTab(tabName[, position]) | Adds a tab to the EMCO object |
EMCO:reset() | resets the object, redrawing everything |
EMCO:fuzzyBoolean(bool) | Expands boolean definitions to be more flexible. |
EMCO:clear(tabName) | clears a specific tab |
EMCO:clearAll() | clears all the tabs |
EMCO:setTabFont(font) | sets the font for all tabs |
EMCO:setSingleTabFont(tabName, font) | sets the font for a single tab. |
EMCO:setFont(font) | sets the font for all the miniconsoles |
EMCO:setSingleWindowFont(tabName, font) | sets the font for a specific miniconsole. |
EMCO:enableCustomTimestampColor() | enables custom colors for the timestamp, if displayed |
EMCO:disableCustomTimestampColor() | disables custom colors for the timestamp, if displayed |
EMCO:enableTimestamp() | enables the display of timestamps |
EMCO:disableTimestamp() | disables the display of timestamps |
EMCO:setTimestampFormat(format) | Sets the formatting for the timestamp, if enabled |
EMCO:setTimestampBGColor(color) | Sets the background color for the timestamp, if customTimestampColor is enabled. |
EMCO:setTimestampFGColor(color) | Sets the foreground color for the timestamp, if customTimestampColor is enabled. |
EMCO:setAllTabName(allTabName) | Sets the 'all' tab name. |
EMCO:enableAllTab() | Enables use of the 'all' tab |
EMCO:disableAllTab() | Disables use of the 'all' tab |
EMCO:enableMapTab() | Enables tying the Mudlet Mapper to one of the tabs. |
EMCO:disableMapTab() | disables binding the Mudlet Mapper to one of the tabs. |
EMCO:setMapTabName(mapTabName) | sets the name of the tab to bind the Mudlet Map. |
EMCO:enableBlinkFromAll() | Enables tab blinking even if you're on the 'all' tab |
EMCO:disableBlinkFromAll() | Disables tab blinking when you're on the 'all' tab |
EMCO:enableGag() | Enables gagging of the line passed in to :append(tabName) |
EMCO:disableGag() | Disables gagging of the line passed in to :append(tabName) |
EMCO:enableBlink() | Enables tab blinking when new information comes in to an inactive tab |
EMCO:disableBlink() | Disables tab blinking when new information comes in to an inactive tab |
EMCO:enablePreserveBackground() | Enables preserving the chat's background over the background of an incoming :append() |
EMCO:disablePreserveBackground() | Enables preserving the chat's background over the background of an incoming :append() |
EMCO:setBlinkTime(blinkTime) | Sets how long in seconds to wait between blinks |
EMCO:setFontSize(fontSize) | Sets the font size of the attached consoles |
EMCO:setActiveTabFGColor(color) | Sets the FG color for the active tab |
EMCO:setInactiveTabFGColor(color) | Sets the FG color for the inactive tab |
EMCO:setActiveTabBGColor(color) | Sets the BG color for the active tab. |
EMCO:setInactiveTabBGColor(color) | Sets the BG color for the inactive tab. |
EMCO:setConsoleColor(color) | Sets the BG color for the consoles attached to this object |
EMCO:setTabBoxCSS(css) | Sets the CSS to use for the tab box which contains the tabs for the object |
EMCO:setTabBoxColor(color) | Sets the color to use for the tab box background |
EMCO:setConsoleContainerColor(color) | Sets the color for the container which holds the consoles attached to this object. |
EMCO:setConsoleContainerCSS(css) | Sets the CSS to use for the container which holds the consoles attached to this object |
EMCO:setGap(gap) | Sets the amount of space to use between the tabs and the consoles |
EMCO:setTabHeight(tabHeight) | Sets the height of the tabs in pixels |
EMCO:enableAutoWrap() | Enables autowrap for the object, and by extension all attached consoles. |
EMCO:disableAutoWrap() | Disables autowrap for the object, and by extension all attached consoles. |
EMCO:setWrap(wrapAt) | Sets the number of characters to wordwrap the attached consoles at. |
EMCO:append(tabName, excludeAll) | Appends the current line from the MUD to a tab. |
EMCO:cecho(tabName, message, excludeAll) | cecho to a tab, maintaining functionality |
EMCO:decho(tabName, message, excludeAll) | decho to a tab, maintaining functionality |
EMCO:hecho(tabName, message, excludeAll) | hecho to a tab, maintaining functionality |
EMCO:echo(tabName, message, excludeAll) | echo to a tab, maintaining functionality |
EMCO:cechoLink(tabName, text, command, hint, excludeAll) | cechoLink to a tab |
EMCO:dechoLink(tabName, text, command, hint, excludeAll) | dechoLink to a tab |
EMCO:hechoLink(tabName, text, command, hint, excludeAll) | hechoLink to a tab |
EMCO:echoLink(tabName, text, command, hint, useCurrentFormat, excludeAll) | echoLink to a tab |
EMCO:cechoPopup(tabName, text, commands, hints, excludeAll) | cechoPopup to a tab |
EMCO:dechoPopup(tabName, text, commands, hints, excludeAll) | dechoPopup to a tab |
EMCO:hechoPopup(tabName, text, commands, hints, excludeAll) | hechoPopup to a tab |
EMCO:echoPopup(tabName, text, commands, hints, useCurrentFormat, excludeAll) | echoPopup to a tab |
EMCO:addAllTabExclusion(tabName) | adds a tab to the exclusion list for echoing to the allTab |
EMCO:removeAllTabExclusion(tabName) | removess a tab from the exclusion list for echoing to the allTab |
EMCO:enableBlankLine() | Enable placing a blank line between all messages. |
EMCO:disableBlankLine() | Enable placing a blank line between all messages. |
EMCO:enableScrollbars() | Enable scrollbars for the miniconsoles |
EMCO:disableScrollbars() | Disable scrollbars for the miniconsoles |
EMCO:save() | Save an EMCO's configuration for reloading later. |
EMCO:load() | Load and apply a saved config for this EMCO |
Methods
- EMCO:new(cons, container)
-
Creates a new Embeddable Multi Console Object.
see https://github.com/demonnic/EMCO/wiki for information on valid constraints and defaultsParameters:
- cons
table
table of constraints which configures the EMCO.
option name description default timeStamp display timestamps on the miniconsoles? false blankLine put a blank line between appends/echos? false scrollbars enable scrollbars for the miniconsoles? false customTimestampColor if showing timestamps, use a custom color? false mapTab should we attach the Mudlet Mapper to this EMCO? false mapTabName Which tab should we attach the map to?
If mapTab is true and you do not set this, it will throw an errorblinkFromAll should tabs still blink, even if you're on the 'all' tab? false preserveBackground preserve the miniconsole background color during append()? false gag when running :append(), should we also gag the line? false 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" timestampFGColor Custom FG color to use for timestamps. Any valid Geyser.Color works "red" allTab Should we send everything to an 'all' tab? false 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 blinkTime How long to wait between blinks, in seconds? 3 fontSize What font size to use for the miniconsoles? 9 font What font to use for the miniconsoles? tabFont What font to use for the tabs? activeTabCss What css to use for the active tab? "" 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" 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>" 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" 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" 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" 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" } 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 autoWrap Use autoWrap for the miniconsoles? true 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 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 topMargin Number of pixels to put between the top edge of the miniconsole container, and the miniconsole? This is in addition to gap 0 - container GeyserObject The container to use as the parent for the EMCO
Returns:
-
the newly created EMCO
- cons
table
table of constraints which configures the EMCO.
- EMCO:miniConvertYATCO()
- Scans for the old YATCO configuration values and prints out a set of constraints to use. with EMCO to achieve the same effect. Is just the invocation
- EMCO:convertYATCO()
- Echos to the main console a script object you can add which will fully convert YATCO to EMCO. This replaces the demonnic.chat variable with a newly created EMCO object, so that the main functions used to place information on the consoles (append(), cecho(), etc) should continue to work in the user's triggers and events.
- EMCO:display(tabName, item[, item2[, item_n]])
-
Display the contents of one or more variables to an EMCO tab. like display() but targets the miniconsole
Parameters:
- tabName string the name of the tab you want to display to
- item The thing to display()
- item2 another thing to display() (optional)
- item_n and so on and so on (optional)
- EMCO:removeTab(tabName)
-
Remove a tab from the EMCO
Parameters:
- tabName string the name of the tab you want to remove from the EMCO
- EMCO:addTab(tabName[, position])
-
Adds a tab to the EMCO object
Parameters:
- tabName string the name of the tab to add
- position number position in the tab switcher to put this tab (optional)
- EMCO:reset()
- resets the object, redrawing everything
- EMCO:fuzzyBoolean(bool)
-
Expands boolean definitions to be more flexible.
True values are "true", "yes", "0", 0, and true
False values are "false", "no", "1", 1, false, and nilParameters:
- bool item to test for truthiness
- EMCO:clear(tabName)
-
clears a specific tab
Parameters:
- tabName string the name of the tab to clear
- EMCO:clearAll()
- clears all the tabs
- EMCO:setTabFont(font)
-
sets the font for all tabs
Parameters:
- font string the font to use.
- EMCO:setSingleTabFont(tabName, font)
-
sets the font for a single tab. If you use setTabFont this will be overridden
Parameters:
- EMCO:setFont(font)
-
sets the font for all the miniconsoles
Parameters:
- font string the name of the font to use
- EMCO:setSingleWindowFont(tabName, font)
-
sets the font for a specific miniconsole. If setFont is called this will be overridden
Parameters:
- EMCO:enableCustomTimestampColor()
- enables custom colors for the timestamp, if displayed
- EMCO:disableCustomTimestampColor()
- disables custom colors for the timestamp, if displayed
- EMCO:enableTimestamp()
- enables the display of timestamps
- EMCO:disableTimestamp()
- disables the display of timestamps
- EMCO:setTimestampFormat(format)
-
Sets the formatting for the timestamp, if enabled
Parameters:
- format string Format string which describes the display of the timestamp. See: https://wiki.mudlet.org/w/Manual:Lua_Functions#getTime
- EMCO:setTimestampBGColor(color)
-
Sets the background color for the timestamp, if customTimestampColor is enabled.
Parameters:
- color Color string suitable for decho or hecho, or color name eg "purple", or table of colors {r,g,b}
- EMCO:setTimestampFGColor(color)
-
Sets the foreground color for the timestamp, if customTimestampColor is enabled.
Parameters:
- color Color string suitable for decho or hecho, or color name eg "purple", or table of colors {r,g,b}
- EMCO:setAllTabName(allTabName)
-
Sets the 'all' tab name.
This is the name of the tab itselfParameters:
- allTabName string name of the tab to use as the all tab. Must be a tab which exists in the object.
- EMCO:enableAllTab()
- Enables use of the 'all' tab
- EMCO:disableAllTab()
- Disables use of the 'all' tab
- EMCO:enableMapTab()
-
Enables tying the Mudlet Mapper to one of the tabs.
mapTabName must be set, or this will error. Forces a redraw of the entire object - EMCO:disableMapTab()
-
disables binding the Mudlet Mapper to one of the tabs.
CAUTION: this may have unexpected behaviour, as you can only open one Mapper console per profile so you can't really unbind it. Binding of the Mudlet Mapper is best decided at instantiation. - EMCO:setMapTabName(mapTabName)
-
sets the name of the tab to bind the Mudlet Map.
Forces a redraw of the object
CAUTION: Mudlet only allows one Map object to be open at one time, so if you are going to attach the map to an object you should probably do it at instantiation.Parameters:
- mapTabName string name of the tab to connect the Mudlet Map to.
- EMCO:enableBlinkFromAll()
- Enables tab blinking even if you're on the 'all' tab
- EMCO:disableBlinkFromAll()
- Disables tab blinking when you're on the 'all' tab
- EMCO:enableGag()
- Enables gagging of the line passed in to :append(tabName)
- EMCO:disableGag()
- Disables gagging of the line passed in to :append(tabName)
- EMCO:enableBlink()
- Enables tab blinking when new information comes in to an inactive tab
- EMCO:disableBlink()
- Disables tab blinking when new information comes in to an inactive tab
- EMCO:enablePreserveBackground()
- Enables preserving the chat's background over the background of an incoming :append()
- EMCO:disablePreserveBackground()
- Enables preserving the chat's background over the background of an incoming :append()
- EMCO:setBlinkTime(blinkTime)
-
Sets how long in seconds to wait between blinks
Parameters:
- blinkTime number time in seconds to wait between blinks
- EMCO:setFontSize(fontSize)
-
Sets the font size of the attached consoles
Parameters:
- fontSize number font size for attached consoles
- EMCO:setActiveTabFGColor(color)
-
Sets the FG color for the active tab
Parameters:
- color Color string suitable for decho or hecho, or color name eg "purple", or table of colors {r,g,b}
- EMCO:setInactiveTabFGColor(color)
-
Sets the FG color for the inactive tab
Parameters:
- color Color string suitable for decho or hecho, or color name eg "purple", or table of colors {r,g,b}
- EMCO:setActiveTabBGColor(color)
-
Sets the BG color for the active tab.
NOTE: If you set CSS for the active tab, it will override this setting.Parameters:
- color Color string suitable for decho or hecho, or color name eg "purple", or table of colors {r,g,b}
- EMCO:setInactiveTabBGColor(color)
-
Sets the BG color for the inactive tab.
NOTE: If you set CSS for the inactive tab, it will override this setting.Parameters:
- color Color string suitable for decho or hecho, or color name eg "purple", or table of colors {r,g,b}
- EMCO:setConsoleColor(color)
-
Sets the BG color for the consoles attached to this object
Parameters:
- color Color string suitable for decho or hecho, or color name eg "purple", or table of colors {r,g,b}
- EMCO:setTabBoxCSS(css)
-
Sets the CSS to use for the tab box which contains the tabs for the object
Parameters:
- css string The css styling to use for the tab box
- EMCO:setTabBoxColor(color)
-
Sets the color to use for the tab box background
Parameters:
- color Color string suitable for decho or hecho, or color name eg "purple", or table of colors {r,g,b}
- EMCO:setConsoleContainerColor(color)
-
Sets the color for the container which holds the consoles attached to this object.
Parameters:
- color Color string suitable for decho or hecho, or color name eg "purple", or table of colors {r,g,b}
- EMCO:setConsoleContainerCSS(css)
-
Sets the CSS to use for the container which holds the consoles attached to this object
Parameters:
- css string CSS to use for the container
- EMCO:setGap(gap)
-
Sets the amount of space to use between the tabs and the consoles
Parameters:
- gap number Number of pixels to keep between the tabs and consoles
- EMCO:setTabHeight(tabHeight)
-
Sets the height of the tabs in pixels
Parameters:
- tabHeight number the height of the tabs for the object, in pixels
- EMCO:enableAutoWrap()
-
Enables autowrap for the object, and by extension all attached consoles.
To enable autoWrap for a specific miniconsole only, call myEMCO.windows[tabName]:enableAutoWrap() but be warned if you do this it may be overwritten by future calls to EMCO:enableAutoWrap() or :disableAutoWrap() - EMCO:disableAutoWrap()
-
Disables autowrap for the object, and by extension all attached consoles.
To disable autoWrap for a specific miniconsole only, call myEMCO.windows[tabName]:disableAutoWrap() but be warned if you do this it may be overwritten by future calls to EMCO:enableAutoWrap() or :disableAutoWrap() - EMCO:setWrap(wrapAt)
-
Sets the number of characters to wordwrap the attached consoles at.
it is generally recommended to make use of autoWrap unless you need a specific width for some reasonParameters:
- wrapAt
- EMCO:append(tabName, excludeAll)
-
Appends the current line from the MUD to a tab.
depending on this object's configuration, may gag the line
depending on this object's configuration, may gag the next promptParameters:
- tabName string The name of the tab to append the line to
- excludeAll boolean if true, will exclude this from being mirrored to the allTab
- EMCO:cecho(tabName, message, excludeAll)
-
cecho to a tab, maintaining functionality
Parameters:
- EMCO:decho(tabName, message, excludeAll)
-
decho to a tab, maintaining functionality
Parameters:
- EMCO:hecho(tabName, message, excludeAll)
-
hecho to a tab, maintaining functionality
Parameters:
- EMCO:echo(tabName, message, excludeAll)
-
echo to a tab, maintaining functionality
Parameters:
- EMCO:cechoLink(tabName, text, command, hint, excludeAll)
-
cechoLink to a tab
Parameters:
- EMCO:dechoLink(tabName, text, command, hint, excludeAll)
-
dechoLink to a tab
Parameters:
- EMCO:hechoLink(tabName, text, command, hint, excludeAll)
-
hechoLink to a tab
Parameters:
- EMCO:echoLink(tabName, text, command, hint, useCurrentFormat, excludeAll)
-
echoLink to a tab
Parameters:
- tabName string the name of the tab to echoLink to
- text string the text underlying the link
- command string the lua code to run in string format
- hint string the tooltip hint to use for the link
- useCurrentFormat boolean use the format for the window or blue on black (hyperlink colors)
- excludeAll boolean if true, will exclude this from being mirrored to the allTab
- EMCO:cechoPopup(tabName, text, commands, hints, excludeAll)
-
cechoPopup to a tab
Parameters:
- EMCO:dechoPopup(tabName, text, commands, hints, excludeAll)
-
dechoPopup to a tab
Parameters:
- EMCO:hechoPopup(tabName, text, commands, hints, excludeAll)
-
hechoPopup to a tab
Parameters:
- EMCO:echoPopup(tabName, text, commands, hints, useCurrentFormat, excludeAll)
-
echoPopup to a tab
Parameters:
- tabName string the name of the tab to echoPopup to
- text string the text underlying the link
- commands table the lua code to run in string format
- hints table the tooltip hint to use for the link
- useCurrentFormat boolean use the format for the window or blue on black (hyperlink colors)
- excludeAll boolean if true, will exclude this from being mirrored to the allTab
- EMCO:addAllTabExclusion(tabName)
-
adds a tab to the exclusion list for echoing to the allTab
Parameters:
- tabName string the name of the tab to add to the exclusion list
- EMCO:removeAllTabExclusion(tabName)
-
removess a tab from the exclusion list for echoing to the allTab
Parameters:
- tabName string the name of the tab to remove from the exclusion list
- EMCO:enableBlankLine()
- Enable placing a blank line between all messages.
- EMCO:disableBlankLine()
- Enable placing a blank line between all messages.
- EMCO:enableScrollbars()
- Enable scrollbars for the miniconsoles
- EMCO:disableScrollbars()
- Disable scrollbars for the miniconsoles
- EMCO:save()
- Save an EMCO's configuration for reloading later. Filename is based on the EMCO's name property.
- EMCO:load()
- Load and apply a saved config for this EMCO