Difference between revisions of "Area 51"

From Mudlet
Jump to navigation Jump to search
Line 4,054: Line 4,054:
 
! Category !! Full Name !! Shorthand
 
! Category !! Full Name !! Shorthand
 
|-
 
|-
| rowspan="5" | '''Top-level''' || style || s
+
| rowspan="7" | '''Top-level''' || style || s
 
|-
 
|-
 
| menu || m
 
| menu || m
Line 4,063: Line 4,063:
 
|-
 
|-
 
| selection || sel
 
| selection || sel
 +
|-
 +
| disabled || d
 +
|-
 +
| spoiler || sp
 
|-
 
|-
 
| rowspan="8" | '''Style''' || color || c
 
| rowspan="8" | '''Style''' || color || c
Line 4,078: Line 4,082:
 
| strikethrough || st
 
| strikethrough || st
 
|-
 
|-
| text-decoration-color || dc
+
| text-decoration-color || tdc
 
|-
 
|-
 
| rowspan="10" | '''Pseudo-class''' || hover || h
 
| rowspan="10" | '''Pseudo-class''' || hover || h
Line 4,084: Line 4,088:
 
| active || a
 
| active || a
 
|-
 
|-
| visited || d
+
| visited || vi
 
|-
 
|-
 
| focus || f
 
| focus || f
Line 4,097: Line 4,101:
 
|-
 
|-
 
| disabled || ds
 
| disabled || ds
|-
 
| spoiler || sp
 
 
|}
 
|}
  

Revision as of 21:21, 23 December 2025

This page is for the development of documentation for Lua API functions that are currently being worked on. Ideally the entries here can be created in the same format as will be eventually used in Lua Functions and its sub-sites.

Note Note: Please use the Area_51/Template to add new entries in the sections below.

Note Note: Links to other functions need to include the wiki page name before the '#' character in the link identifier on the left side of the '|' divider between the identifier and the display text. e.g.

[[Manual:Lua_Functions#getCustomLines|getCustomLines()]]

rather than:

[[#getCustomLines|getCustomLines()]]

which would refer to a link within the current (in this case Area 51) section.

Note Note: The following headings reflect those present in the main Wiki area of the Lua API functions. It is suggested that new entries are added so as to maintain a sorted alphabetical order under the appropriate heading.


Basic Essential Functions

These functions are generic functions used in normal scripting. These deal with mainly everyday things, like sending stuff and echoing to the screen.

sendCmdLine, PR #7828

sendCmdLine(command) – Sets the text of the main command line or a custom command line to the specified string, but does not send it to the server. This is useful for scripting command previews, suggestion systems, or autofill behavior in Mudlet.

Syntax

sendCmdLine(command)

Parameters

Parameter Type Description
command string The text to set in the command line.

Return value

Returns `true` if the command line was successfully updated, `false` otherwise.

Example

sendCmdLine("cast fireball at goblin")

This will place the command `cast fireball at goblin` into the active command line without sending it. The user can edit or press enter to send it.

Notes

  • This function is primarily intended for scripting support tools, such as suggestion completions or history cycling.
  • To send the command to the server, use the send() function instead.

See also

Database Functions

A collection of functions for helping deal with the database.

Date/Time Functions

A collection of functions for handling date & time.

File System Functions

A collection of functions for interacting with the file system.

saveProfile, PR #7982 open

saveProfile([location, [filename]])
Saves the current Mudlet profile to disk, which is equivalent to pressing the "Save Profile" button.
Parameters
  • location:
(optional) folder to save the profile to. If not given, the profile will go into the default location.
  • filename:
(optional) save the profile as the filename. If the filename doesn't end with .xml this function will automatically save it as filename.xml. If not given, the profile will be saved with the default DATE#TIME.xml filename format.
Example
-- save profile to the .../mudlet/profiles/profileName/current folder
saveProfile()

-- save to the desktop on Windows:
saveProfile([[C:\Users\yourusername\Desktop]])

-- alternately, save to the desktop with the name system.xml:
saveProfile([[C:\Users\yourusername\Desktop]],"system")

Mapper Functions

A collection of functions that manipulate the mapper and its related features.

exportAreaImage PR#8156

exportAreaImage(areaID, filePath[, zLevel])
Exports an area from the mapper as an image file. This function allows you to save a visual representation of a specific area (or a specific Z level within that area) to disk as an image. The exported image will show rooms, exits, and other map elements as they appear in the 2D mapper.
The image is rendered at a fixed 2.0x zoom level to provide good quality output while maintaining reasonable file sizes.
See also
createMapImageLabel(), createMapLabel()
Mudlet VersionAvailable in Mudlet4.20+

Note Note: This function requires the mapper to be open and a valid map to be loaded. It will return an error if no map is present or if the specified area ID doesn't exist.

Parameters
  • areaID:
Area ID number of the area to export as an image.
  • filePath:
File path where the image should be saved. Should include the desired file extension (e.g., ".png", ".jpg"). When exporting all Z levels, this will be used as a template for generating individual filenames.
  • zLevel:
(optional) Can be one of the following:
integer - exports only the specific Z level within the area
true - exports all Z levels in the area as separate image files
nil/omitted - exports the current player's Z level
Returns
  • success: boolean - true if the export was successful, false if it failed
  • errorMessage: string - only returned when success is false, contains the error message describing what went wrong
Example
-- Export the current player's Z level of area 1 to a PNG file
exportAreaImage(1, "/home/user/mymap.png")

-- Export only Z level 0 of area 5 to a JPG file
exportAreaImage(5, "/home/user/level0.jpg", 0)

-- Export area 10, Z level -1 (basement level)
exportAreaImage(10, "basement_map.png", -1)

-- Export ALL Z levels in area 12 as separate images
-- This will create files like: mymap_level_0.png, mymap_level_1.png, mymap_level_-1.png, etc.
local success, error = exportAreaImage(12, "mymap.png", true)
if success then
  echo("All Z levels exported successfully!")
else
  echo("Export failed: " .. error)
end

-- Export all Z levels in multiple areas
for areaID, areaName in pairs(getAreaTable()) do
  local filename = string.format("%s_area_%d.png", areaName, areaID)
  local success, error = exportAreaImage(areaID, filename, true)
  if success then
    echo("Exported all Z levels for area: " .. areaName)
  else
    echo("Failed to export area " .. areaName .. ": " .. error)
  end
end

-- Get a list of all Z levels in an area and export them individually
local areaID = 5
local area = getAreaTable()[areaID]
if area then
  -- Get all Z levels by examining rooms in the area
  local zLevels = {}
  for roomID in pairs(getAreaRooms(areaID)) do
    local x, y, z = getRoomCoordinates(roomID)
    if z and not zLevels[z] then
      zLevels[z] = true
    end
  end

  -- Export each Z level individually with custom naming
  for zLevel in pairs(zLevels) do
    local filename = string.format("area_%s_floor_%d.png", area, zLevel)
    exportAreaImage(areaID, filename, zLevel)
    echo("Exported Z level " .. zLevel .. " to " .. filename)
  end
end

createMapLabel, merged #7598

labelID = createMapLabel(areaID, text, posX, posY, posZ, fgRed, fgGreen, fgBlue, bgRed, bgGreen, bgBlue[, zoom, fontSize, showOnTop, noScaling, fontName, foregroundTransparency, backgroundTransparency, temporary, outlineRed, outlineGreen, outlineBlue])
Creates a text label on the map at given coordinates, with the given background and foreground colors. It can go above or below the rooms, scale with zoom or stay a static size. From Mudlet 4.17.0 an additional parameter (assumed to be false if not given from then) makes the label NOT be saved in the map file which, if the image can be regenerated on future loading from a script can reduce the size of the saved map somewhat. It returns a label ID that you can use later for deleting it.
The coordinates 0,0 are in the middle of the map, and are in sync with the room coordinates - so using the x,y values of getRoomCoordinates() will place the label near that room.
See also: getMapLabel(), getMapLabels(), deleteMapLabel, createMapImageLabel()
Historical Version Note

Note Note: Some changes were done prior to 4.13 (which exactly? function existed before!) - see corresponding PR and update here!

Parameters
  • areaID:
Area ID where to put the label.
  • text:
The text to put into the label. To get a multiline text label add a '\n' between the lines.
  • posX, posY, posZ:
Position of the label in (floating point numbers) room coordinates.
  • fgRed, fgGreen, fgBlue:
Foreground color or text color of the label.
  • bgRed, bgGreen, bgBlue:
Background color of the label.
  • zoom:
(optional) Zoom factor of the label if noScaling is false. Higher zoom will give higher resolution of the text and smaller size of the label. Default is 30.0.
  • fontSize:
(optional, but needed if zoom is provided) Size of the font of the text. Default is 50.
  • showOnTop:
(optional) If true the label will be drawn on top of the rooms and if it is false the label will be drawn as a background, defaults to true if not given.
  • noScaling:
(optional) If true the label will have the same size when you zoom in and out in the mapper, If it is false the label will scale when you zoom the mapper, defaults to true if not given.
  • fontName:
(optional) font name to use.
  • foregroundTransparency
(optional) transparency of the text on the label, defaults to 255 (in range of 0 to 255) or fully opaque if not given.
  • backgroundTransparency
(optional) transparency of the label background itself, defaults to 50 (in range of 0 to 255) or significantly transparent if not given.
  • temporary
(optional) if true does not save the image that the label makes in map save files, defaults to false if not given, or for prior versions of Mudlet.
  • outlineRed, outlineGreen, outlineBlue
(optional) the outline colour of the displayed text
Example
-- the first 50 is some area id, the next three 0,0,0 are coordinates - middle of the area
-- 255,0,0 would be the foreground in RGB, 23,0,0 would be the background RGB
-- zoom is only relevant when when you're using a label of a static size, so we use 0
-- and we use a font size of 20 for our label, which is a small medium compared to the map
local labelid = createMapLabel( 50, "my map label", 0,0,0, 255,0,0, 23,0,0, 0,20)

-- to create a multi line text label add '\n' between lines
-- the position is placed somewhat to the northeast of the center of the map
-- this label will be scaled as you zoom the map.
local labelid = createMapLabel( 50, "1. Row One\n2. Row 2", .5,5.5,0, 255,0,0, 23,0,0, 30,50, true, false)

local x,y,z = getRoomCoordinates(getPlayerRoom())
createMapLabel(getRoomArea(getPlayerRoom()), "my map label", x,y,z, 255,0,0, 23,0,0, 0,20, false, true, "Ubuntu", 255, 100)

-- create a temporary, multiline label with purple text and a white outline
lua createMapLabel(1, "This is a really long text\nwith multiple lines.", 0, 0, 0, 125, 0, 125, 0, 0, 0, 50, 48, true, false, "Noto Sans", 255, 0, true, 255, 255, 255)

getRoomsByPosition1, PR #8619

roomTable = getRoomsByPosition1(areaID, x,y,z)
Returns an indexed table of all rooms at the given coordinates in the given area, or an empty table if there are none. This function can be useful for checking if a room exists at certain coordinates, or whenever you have rooms overlapping. This returns exactly the same thing as getRoomsByPosition() except the table is indexed at 1, not zero.
See also: getRoomsByPosition(), getRoomCoordinates()

mapSymbolFontInfo, PR #4038 closed

mapSymbolFontInfo()
See also: setupMapSymbolFont()

Note Note: pending, not yet available. See https://github.com/Mudlet/Mudlet/pull/4038

returns
  • either a table of information about the configuration of the font used for symbols in the (2D) map, the elements are:
  • fontName - a string of the family name of the font specified
  • onlyUseThisFont - a boolean indicating whether glyphs from just the fontName font are to be used or if there is not a glyph for the required grapheme (character) then a glyph from the most suitable different font will be substituted instead. Should this be true and the specified font does not have the required glyph then the replacement character (typically something like ) could be used instead. Note that this may not affect the use of Color Emoji glyphs that are automatically used in some OSes but that behavior does vary across the range of operating systems that Mudlet can be run on.
  • scalingFactor - a floating point number between 0.50 and 2.00 which modifies the size of the symbols somewhat though the extremes are likely to be unsatisfactory because some of the particular symbols may be too small (and be less visible at smaller zoom levels) or too large (and be clipped by the edges of the room rectangle or circle).
  • or nil and an error message on failure.
As the symbol font details are stored in the (binary) map file rather than the profile then this function will not work until a map is loaded (or initialized, by activating a map window).

moveMapLabel, PR #6014 open

moveMapLabel(areaID/Name, labeID/Text, coordX/deltaX, coordY/deltaY[, coordZ/deltaZ][, absoluteNotRelativeMove])

Re-positions a map label within an area in the 2D mapper, in a similar manner as the moveRoom() function does for rooms and their custom exit lines. When moving a label to given coordinates this is the position that the top-left corner of the label will be positioned at; since the space allocated to a particular room on the map is ± 0.5 around the integer value of its x and y coordinates this means for a label which has a size of 1.0 x 1,0 (w x h) to position it centrally in the space for a single room at the coordinates (x, y, z) it should be positioned at (x - 0.5, y + 0.5, z).

See also: getMapLabels(), getMapLabel().
Mudlet VersionAvailable in Mudlet ?.??+

Note Note: pending, not yet available. See https://github.com/Mudlet/Mudlet/pull/6014

Parameters
  • areaID/Name:
Area ID as number or AreaName as string containing the map label.
  • labelID/Text:
Label ID as number (which will be 0 or greater) or the LabelText on a text label. All labels will have a unique ID number but there may be more than one text labels with a non-empty text string; only the first matching one will be moved by this function and image labels also have no text and will match the empty string. with mo or AreaName as string containing the map label.
  • coordX/deltaX:
A floating point number for the absolute coordinate to use or the relative amount to move the label in "room coordinates" along the X-axis.
  • coordY/deltaY:
A floating point number for the absolute coordinate to use or the relative amount to move the label in "room coordinates" along the Y-axis.
  • coordZ/deltaZ:
(Optional) A floating point number for the absolute coordinate to use or the relative amount to move the label in "room coordinates" along the Z-axis, if omitted the label is not moved in the z-axis at all.
  • absoluteNotRelativeMove:
(Optional) a boolean value (defaults to false if omitted) as to whether to move the label to the absolute coordinates (true) or to move it the relative amount from its current location (false).
Returns
true on success or nil and an error message on failure, if successful it will also refresh the map display to show the result.
Example
-- move the first label in the area with the ID number of 2, three spaces to the east and four spaces to the north
moveMapLabel(0, 2, 3.0, 4.0)

-- move the first label in the area with the ID number of 2, one space to the west, note the final boolean argument is unneeded
moveMapLabel(0, 2, -1.0, 0.0, false)

-- move the second label in the area with the ID number of 2, three and a half spaces to the west, and two south **of the center of the current level it is on in the map**:
moveRoom(1, 2, -3.5, -2.0, true)

-- move the second label in the area with the ID number of 2, up three levels
moveRoom(1, 2, 0.0, 0.0, 3.0)

-- move the second label in the "Test 1" area one space to the west, note the last two arguments are unneeded
moveRoom("Test 1", 1, -1.0, 0.0, 0.0, false)

-- move the (top-left corner of the first) label with the text "Home" in the area with ID number 5 to the **center of the whole map**, note the last two arguments are required in this case:
moveRoom(5, "Home", 0.0, 0.0, 0.0, true)

-- all of the above will return the 'true'  boolean value assuming there are the indicated labels and areas

moveRoom, PR #6010 open

moveRoom(roomID, coordX/deltaX, coordY/deltaY[, coordZ/deltaZ][, absoluteNotRelativeMove])

Re-positions a room within an area, in the same manner as the "move to" context menu item for one or more rooms in the 2D mapper. Like that method this will also shift the entirety of any custom exit lines defined for the room concerned. This contrasts with the behavior of the setRoomCoordinates() which only moves the starting point of such custom exit lines so that they still emerge from the room to which they belong but otherwise remain pointing to the original place.

See also: setRoomCoordinates()
Mudlet VersionAvailable in Mudlet ?.??+

Note Note: pending, not yet available. See https://github.com/Mudlet/Mudlet/pull/6010

Parameters
  • roomID:
Room ID number to move.
  • coordX/deltaX:
The absolute coordinate or the relative amount as a number to move the room in "room coordinates" along the X-axis.
  • coordY/deltaY:
The absolute coordinate or the relative amount as a number to move the room in "room coordinates" along the Y-axis.
  • coordZ/deltaZ:
(Optional) the absolute coordinate or the relative amount as a number to move the room in "room coordinates" along the Z-axis, if omitted the room is not moved in the z-axis at all.
  • absoluteNotRelativeMove:
(Optional) a boolean value (defaults to false if omitted) as to whether to move the room to the absolute coordinates (true) or the relative amount from its current location (false).
Returns
true on success or nil and an error message on failure, if successful it will also refresh the map display to show the result.
Example
-- move the first room one space to the east and two spaces to the north
moveRoom(1, 1, 2)

-- move the first room one space to the west, note the final boolean argument is unneeded
moveRoom(1, -1, 0, false)

-- move the first room three spaces to the west, and two south **of the center of the current level it is on in the map**:
moveRoom(1, -3, -2, true)

-- move the second room up three levels
moveRoom(2, 0, 0, 3)

-- move the second room one space to the west, note the last two arguments are unneeded
moveRoom(2, -1, 0, 0, false)

-- move the second room to the **center of the whole map**, note the last two arguments are required in this case:
moveRoom(2, 0, 0, 0, true)

-- all of the above will return the 'true'  boolean value assuming there are rooms with 1 and 2 as ID numbers

setExitWeightFilter, PR #8487 open

setExitWeightFilter(callback)
installs a custom filter that lets you adjust or block exits while Mudlet computes routes.
Use setExitWeightFilter(nil) to remove the filter and restore stored exit weights.


Note Note: setExitWeightFilter Each call clears the cached routing graph so Mudlet rebuilds it using the new logic. If your callback input is changed it might be worth setting new filter once again.


Parameters

callback one of:

  • a Lua function function(roomId, exitCommand) that Mudlet calls during pathfinding;
  • nil to clear the currently installed filter.
The callback receives:
roomId — numeric id of the room the exit begins in;
  • exitCommand — command string to take that exit (e.g. "north" or a custom command).
The callback may return:
a number to override the exit weight (lower weights are preferred);
  • false or the string "block" to prevent Mudlet from considering the exit;
  • nil to keep Mudlet’s original weight.
Returns

true on success;

nil and an error message if the pathfinding data cannot be updated (e.g. no map loaded).

Example
discourage mountain travel if your char is not dwarf, and totally avoid for elves
local race = getCharacterRaceFromFancyScript()
local mountainsEnv = 100
setExitWeightFilter(function(roomId, exitCommand)
    -- Block entirely for elves
    if race == "elf" then
       return "block" -- or false
    end
    
    -- Look up the current weight so we can base adjustments on it.
    local currentWeight = getRoomWeight(roomID) or 0
    -- Add a penalty to room for not dwarfs
    if race ~= "dwarf" and mountainsEnv == getRoomEnv(roomID) then
       return currentWeight + 25
    end
    
    -- No change: keep Mudlet's original weight.
    return nil
end)
Clearing the filter

Remove the custom logic and restore default weighting:

 setExitWeightFilter(nil)

setupMapSymbolFont, PR #4038 closed

setupMapSymbolFont(fontName[, onlyUseThisFont[, scalingFactor]])
configures the font used for symbols in the (2D) map.
See also: mapSymbolFontInfo()

Note Note: pending, not yet available. See https://github.com/Mudlet/Mudlet/pull/4038

Parameters
  • fontName one of:
  • - a string that is the family name of the font to use;
  • - the empty string "" to reset to the default {which is "Bitstream Vera Sans Mono"};
  • - a Lua nil as a placeholder to not change this parameter but still allow a following one to be modified.
  • onlyUseThisFont (optional) one of:
  • - a Lua boolean true to require Mudlet to use graphemes (character) only from the selected font. Should a requested grapheme not be included in the selected font then the font replacement character (�) might be used instead; note that under some circumstances it is possible that the OS (or Mudlet) provided color Emoji Font may still be used but that cannot be guaranteed across all OS platforms that Mudlet might be run on;
  • - a Lua boolean false to allow Mudlet to get a different glyph for a particular grapheme from the most suitable other font found in the system should there not be a glyph for it in the requested font. This is the default unless previously changed by this function or by the corresponding checkbox in the Profile Preferences window for the profile concerned;
  • - a Lua nil as a placeholder to not change this parameter but still allow the following one to be modified.
  • scalingFactor (optional): a floating point value in the range 0.5 to 2.0 (default 1.0) that can be used to tweak the rectangular space that each different room symbol is scaled to fit inside; this might be useful should the range of characters used to make the room symbols be consistently under- or over-sized.
Returns
  • true on success
  • nil and an error message on failure. As the symbol font details are stored in the (binary) map file rather than the profile then this function will not work until a map is loaded (or initialised, by activating a map window).

getMapBackgroundColor, PR #8071 open

getMapBackgroundColor()
Gets the color and transparency of the map background.

See also: setMapBackgroundColor()

Returns
  • 4 integers - red, green, blue, transparency. Colors are 0 to 255 (0 being black), and transparency is 0 to 255 (0 being completely transparent).
Example
local r, g, b, a = getMapBackgroundColor()

setMapBackgroundColor, PR #8071 open

setMapBackgroundColor(r, g, b, [transparency])
Sets the color (and optionally transparency) for the map background. Colors are 0 to 255 (0 being black), and transparency is 0 to 255 (0 being completely transparent).

See also: getMapBackgroundColor()

Parameters
  • r:
Amount of red to use, 0 (none) to 255 (full).
  • g:
Amount of green to use, 0 (none) to 255 (full).
  • b:
Amount of red to use, 0 (none) to 255 (full).
  • transparency:
(optional) amount of transparency to use, 0 (fully transparent) to 255 (fully opaque). Defaults to 255 if omitted.
Example
-- make the map have a somewhat transparent red background
setMapBackgroundColor(255,0,0,200)

-- make the map have an opaque black background
setMapBackgroundColor(0,0,0)

setMapPerspective, PR #8147 open

setMapPerspective(distance, polarAngle, azimuthalAngle)
Sets the camera's position for the 3d map. See the wiki page on spherical coordinates for more clarification on the polar and azimuthal angles.

See also: shiftMapPerspective()

Parameters
  • distance:
Distance of the camera from the focal point. 1 distance is equivalent to the distance between 10 rooms on the 3d map.
  • polarAngle:
Angle of the camera from the z-axis, e.g. 0 (looking straight down from above), 90 (looking along the x/y plane) 180 (looking straight up from below).
  • azimuthalAngle:
Angle of the camera rotating counter-clockwise from the x-axis, e.g. 0 (looking west from the east), -90 or 270 (looking north from the south) etc.
Example
-- make the map perspective looking down from above at a 45 degree angle, with north facing forward (up) on the map, 5 rooms' distance from the focus point.
setMapPerspective(0.5, 45, 270)

shiftMapPerspective, PR #8147 open

shiftMapPerspective(verticalAngle, horizontalAngle, cameraRotation)
Shifts the camera's relative position for the 3d map. All arguments are expected in degrees. Each shift of the camera occurs in the order of the arguments, i.e. first vertical shift, then horizontal, and finally the camera is rotated.

See also: setMapPerspective()

Parameters
  • verticalAngle:
How many degrees to shift the camera vertically, with positive values moving the camera up.
  • horizontalAngle:
How many degrees to shift the camera horizontally, with positive values moving the camera to the right.
  • cameraRotation:
How many degrees to rotate the camera, with positive values rotating it clockwise.
Example
-- Move the camera 10 degrees down, 20 degrees to the right, and invert the map.
shiftMapPerspective(-10, 20, 180)

Miscellaneous Functions

Miscellaneous functions.

setLinkStyle, PR #8527

setLinkStyle(labelName, linkColor, linkVisitedColor, [underline])
Sets the color styling for clickable HTML hyperlinks within a label. This allows customization of how links appear before and after being clicked.
Mudlet VersionAvailable in Mudlet4.20++

See also: resetLinkStyle, clearVisitedLinks, createLabel, echo

Parameters
  • labelName:
The name of the label to apply link styling to.
  • linkColor:
The color for unvisited links. Can be a color name (e.g., "cyan"), hex code (e.g., "#00ffff"), or RGB string (e.g., "rgb(0,255,255)"). Pass an empty string "" to not change the unvisited link color.
  • linkVisitedColor:
The color for visited links (links that have been clicked). Can be a color name, hex code, or RGB string. Pass an empty string "" to not change the visited link color.
  • underline:
(optional) Whether links should be underlined. Defaults to true if omitted.

Note Note: Links must be in HTML format using <a href="...">text</a>. The label will track which links have been clicked and automatically change their color to the visited color.

Example
-- Create a label with clickable links
createLabel("navigationLabel", 10, 10, 400, 100, 1)
setLinkStyle("navigationLabel", "cyan", "purple")

-- Echo some HTML links to the label
echo("navigationLabel", [[
  <a href="send:north">Go North</a> | 
  <a href="send:south">Go South</a> | 
  <a href="https://mudlet.org">Mudlet Website</a>
]])

-- Links will appear cyan, and turn purple after being clicked

-- You can disable underlining
setLinkStyle("navigationLabel", "#00ff00", "#ff00ff", false)

Note Note: Link URL schemes supported:

  • send:command - Sends the command to the game immediately
  • prompt:text - Puts text in the command line for editing
  • http:// or https:// - Opens URL in external browser
  • No scheme - Executes as Lua code


resetLinkStyle, PR #8527

resetLinkStyle(labelName)
Resets the hyperlink styling on a label to the default Qt colors (typically blue links).
Mudlet VersionAvailable in Mudlet4.20++

See also: setLinkStyle, clearVisitedLinks

Parameters
  • labelName:
The name of the label to reset link styling for.
Example
-- Set custom link colors
setLinkStyle("myLabel", "red", "darkred")

-- Later, reset to defaults
resetLinkStyle("myLabel")


clearVisitedLinks, PR #8527

clearVisitedLinks(labelName)
Clears the visited link history for a label, causing all links to display in the unvisited link color again.
Mudlet VersionAvailable in Mudlet4.20++

See also: setLinkStyle, resetLinkStyle

Parameters
  • labelName:
The name of the label to clear the visited link history for.

Note Note: This does not change the link colors - it only resets which links are considered "visited". Links will revert to the unvisited color until clicked again.

Example
-- Clear the visited links history
clearVisitedLinks("navigationLabel")

-- All links in the label will now show in the unvisited color again,
-- even if they were previously clicked

playSpatialSound, PR #8452

  • playSpatialSound(settings table)

Plays spatial audio files with 3D positioning using Qt6's SpatialAudio framework. Allows precise positioning, occlusion effects, room acoustics, and environmental audio for immersive gameplay experiences.

Required Key Purpose Default Description
Yes key <unique identifier> Unique key to identify this spatial sound source for later updates or removal.
Yes name <file name> Name of the audio file. May contain directory information (i.e. ambient/forest.ogg). May be part of the profile (i.e. getMudletHomeDir().. "/spatial/wind.wav") or on the local device (i.e. "C:/Users/YourName/Documents/sound.mp3").
No url <url> Resource location where the audio file may be downloaded. Only required if file is to be downloaded remotely.
No position {azimuth, elevation, distance} {0, 0, 1} 3D position as a table: azimuth (horizontal angle in degrees, 0-360), elevation (vertical angle in degrees, -90 to 90), distance (in meters, > 0).
No volume 1 to 100 50 Volume level relative to master spatial audio volume.
No occlusion 0.0 to 1.0 0.0 Occlusion factor simulating objects blocking the sound path.
No loops -1 or >= 1 1 Number of times to loop. -1 for infinite looping.
No room {dimensions, reverb, reflection, material} Room acoustics configuration table.

See also: updateSpatialSound(), stopSpatialSound(), removeSpatialSound(), getSpatialSounds()

Mudlet VersionAvailable in Mudlet4.20+
  • Example
-- Play forest ambience behind the player
playSpatialSound({
    key = "forest_ambience",
    name = "ambient/forest_birds.ogg",
    position = {180, 0, 5}, -- behind player, 5 meters away  
    volume = 30,
    loops = -1 -- infinite loop
})

-- Play footsteps with room acoustics
playSpatialSound({
    key = "footsteps",
    name = "effects/footstep_stone.wav",
    position = {45, -10, 2}, -- front-right, slightly below, 2 meters
    volume = 60,
    room = {
        dimensions = {10, 3, 8}, -- 10m wide, 3m high, 8m deep
        reverb = 0.3,
        reflection = 0.7,
        material = "sheetrock"
    }
})

-- Download and play remote spatial sound
playSpatialSound({
    key = "wind_howl",
    name = "wind.ogg",
    url = "https://example.com/sounds/",
    position = {270, 45, 10}, -- left side, elevated, distant
    volume = 40,
    occlusion = 0.2 -- partially blocked
})

updateSpatialSound, PR #8452

  • updateSpatialSound(key, settings table)

Updates properties of an existing spatial audio source without stopping playback.

  • Parameters

• key: Unique identifier of the spatial sound source to update • settings table: Table containing properties to update (same format as playSpatialSound)

See also: playSpatialSound()

Mudlet VersionAvailable in Mudlet4.20+
  • Example
-- Move sound to new position
updateSpatialSound("forest_ambience", {
    position = {90, 0, 3} -- move to right side, closer
})

-- Update volume and add occlusion
updateSpatialSound("footsteps", {
    volume = 80,
    occlusion = 0.5
})

-- Update multiple properties
updateSpatialSound("wind_howl", {
    position = {315, 30, 15},
    volume = 25,
    occlusion = 0.8
})

stopSpatialSound, PR #8452

  • stopSpatialSound(key)

Stops playback of a spatial audio source but keeps the source available for later use.

  • Parameters

• key: Unique identifier of the spatial sound source to stop

  • Returns

• boolean: true on success, false if source not found

See also: playSpatialSound(), removeSpatialSound()

Mudlet VersionAvailable in Mudlet4.20+
  • Example
-- Stop the forest ambience
stopSpatialSound("forest_ambience")

-- Stop footsteps when player stops walking  
if not moving then
    stopSpatialSound("footsteps")
end

pauseSpatialSound, PR #8452

  • pauseSpatialSound(key)

Pauses playback of a spatial audio source, allowing it to be resumed later from the same position.

  • Parameters

• key: Unique identifier of the spatial sound source to pause

  • Returns

• boolean: true on success, false if source not found

See also: playSpatialSound(), stopSpatialSound()

Mudlet VersionAvailable in Mudlet4.20+
  • Example
-- Pause ambient sound temporarily
pauseSpatialSound("forest_ambience")

-- Resume by playing again (will continue from pause position)
playSpatialSound({
    key = "forest_ambience",
    name = "ambient/forest_birds.ogg",
    position = {180, 0, 5}
})

removeSpatialSound, PR #8452

  • removeSpatialSound(key)

Completely removes a spatial audio source, stopping playback and freeing resources.

  • Parameters

• key: Unique identifier of the spatial sound source to remove

  • Returns

• boolean: true on success, false if source not found

See also: stopSpatialSound(), getSpatialSounds()

Mudlet VersionAvailable in Mudlet4.20+
  • Example
-- Remove completed sound effect
removeSpatialSound("door_slam")

-- Clean up old ambient sounds
for _, key in ipairs({"old_wind", "old_rain", "old_birds"}) do
    removeSpatialSound(key)
end

getSpatialSounds, PR #8452

  • getSpatialSounds()

Returns a list of all currently active spatial audio sources.

  • Returns

• table: Indexed table containing the keys of all active spatial sound sources

See also: playSpatialSound(), removeSpatialSound()

Mudlet VersionAvailable in Mudlet4.20+
  • Example
-- List all active spatial sounds
local activeSounds = getSpatialSounds()
for i, soundKey in ipairs(activeSounds) do
    echo("Active spatial sound: " .. soundKey .. "\n")
end

-- Stop all spatial sounds
for _, soundKey in ipairs(getSpatialSounds()) do
    stopSpatialSound(soundKey)
end

-- Check if specific sound is playing
local activeSounds = getSpatialSounds()
local isPlaying = table.contains(activeSounds, "forest_ambience")

setSpatialListener, PR #8452

  • setSpatialListener(settings table)

Sets the position and orientation of the spatial audio listener (the player's ears).

Required Key Purpose Default Description
No position {x, y, z} {0, 0, 0} 3D position of the listener in world coordinates.
No rotation {yaw, pitch, roll} {0, 0, 0} Orientation of the listener's head: yaw (left/right), pitch (up/down), roll (tilt).

See also: playSpatialSound()

Mudlet VersionAvailable in Mudlet4.20+
  • Example
-- Set listener at origin, facing north
setSpatialListener({
    position = {0, 0, 0},
    rotation = {0, 0, 0}
})

-- Player moved to new room and is facing east  
setSpatialListener({
    position = {10, 0, 5},
    rotation = {90, 0, 0} -- 90 degrees yaw = facing east
})

-- Looking up at the sky
setSpatialListener({
    rotation = {0, 45, 0} -- 45 degrees pitch up
})

setSpatialMasterVolume, PR #8452

  • setSpatialMasterVolume(volume)

Sets the master volume for all spatial audio sources.

  • Parameters

• volume: Master volume level (0-100)

  • Returns

• boolean: true on success

See also: playSpatialSound()

Mudlet VersionAvailable in Mudlet4.20+
  • Example
-- Set moderate spatial audio volume
setSpatialMasterVolume(60)

-- Mute all spatial audio
setSpatialMasterVolume(0)

-- Maximum spatial audio volume
setSpatialMasterVolume(100)

playSpatialTestTone, PR #8452

  • playSpatialTestTone(settings table)

Plays a generated test tone at a specific spatial position for testing and calibration purposes.

Required Key Purpose Default Description
Yes key <unique identifier> Unique key to identify this test tone source.
Yes type "white", "pink", or "sine" Type of test tone to generate.
Yes duration <seconds> Duration of the test tone in seconds.
Yes azimuth <degrees> Horizontal angle (0-360 degrees).
Yes elevation <degrees> Vertical angle (-90 to 90 degrees).
Yes distance <meters> Distance from listener in meters.
No frequency <Hz> 440 Frequency for sine wave test tones.
No volume 1 to 100 50 Volume of the test tone.
No loops -1 or >= 1 1 Number of loops (-1 for infinite).

See also: playSpatialSound(), stopSpatialSound()

Mudlet VersionAvailable in Mudlet4.20+
  • Example
-- Test speaker positions with white noise
playSpatialTestTone({
    key = "test_left",
    type = "white",
    duration = 2,
    azimuth = 270,   -- left side
    elevation = 0,
    distance = 2,
    volume = 70
})

-- Test frequency response with sine wave
playSpatialTestTone({
    key = "test_1khz", 
    type = "sine",
    frequency = 1000,
    duration = 3,
    azimuth = 0,     -- front center
    elevation = 0,
    distance = 1,
    volume = 50
})

-- Test distance with pink noise
playSpatialTestTone({
    key = "test_distant",
    type = "pink", 
    duration = 5,
    azimuth = 180,   -- behind
    elevation = 0,
    distance = 10,   -- far away
    volume = 80,
    loops = 2
})

deleteMiniConsole, PR #8387

deleteMiniConsole(miniConsoleName)
Deletes a miniconsole with the given name. This performs complete cleanup, removing the miniconsole from memory and all tracking structures.

Note Note: If you are using the Geyser layout manager, use myMiniConsole:delete() instead. This will handle proper cleanup from Geyser's internal structures.

Note Note: While hiding a miniconsole with hideWindow() keeps it in memory for later use, deleting it completely removes it. Deleted miniconsoles cannot be shown again - you would need to create a new one. It's more efficient to hide/show miniconsoles than to delete and recreate them if you'll need them again.

Note Note: The "main" console cannot be deleted.

See also
createMiniConsole(), createConsole(), hideWindow(), showWindow()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • miniConsoleName: The name of the miniconsole to delete.
Returns
  • true on success
  • false and an error message if the miniconsole doesn't exist
Example
-- Create a miniconsole
createMiniConsole("myConsole", 10, 10, 300, 200)
echo("myConsole", "Hello, World!")

-- Later, delete it completely
local success, err = deleteMiniConsole("myConsole")
if not success then
  cecho(f"<red>Error: {err}\n")
end

-- With Geyser:
local myConsole = Geyser.MiniConsole:new({
  name = "myGeyserConsole",
  x = 100, y = 100,
  width = 300, height = 200,
})

-- Delete it (handles all cleanup automatically)
myConsole:delete()

deleteCommandLine, PR #8387

deleteCommandLine(commandLineName)
Deletes a command line with the given name. This performs complete cleanup, removing the command line from memory and all tracking structures.

Note Note: If you are using the Geyser layout manager, use myCommandLine:delete() instead. This will handle proper cleanup from Geyser's internal structures.

Note Note: While disabling a command line with disableCommandLine() keeps it in memory but hidden, deleting it completely removes it. Deleted command lines cannot be shown again - you would need to create a new one. It's more efficient to enable/disable command lines than to delete and recreate them if you'll need them again.

Note Note: The main command line ("main") cannot be deleted - attempting to do so will return false with an error message.

See also
createCommandLine(), enableCommandLine(), disableCommandLine()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • commandLineName: The name of the command line to delete. Cannot be "main".
Returns
  • true on success
  • false and an error message if the command line doesn't exist or is "main"
Example
-- Create a custom command line
createCommandLine("myCommandLine", 10, 400, 300, 30)

-- Later, delete it completely
local success, err = deleteCommandLine("myCommandLine")
if not success then
  cecho(f"<red>Error: {err}\n")
end

-- This will fail - cannot delete main command line
local success, err = deleteCommandLine("main")
-- success = false, err = "the main command line cannot be deleted"

-- With Geyser:
local myCommandLine = Geyser.CommandLine:new({
  name = "myGeyserCommandLine",
  x = 100, y = 400,
  width = 300, height = 30,
})

-- Delete it (handles all cleanup automatically)
myCommandLine:delete()

deleteScrollBox, PR #8387

deleteScrollBox(scrollBoxName)
Deletes a scrollbox with the given name. This performs complete cleanup, removing the scrollbox and all its contents from memory and tracking structures.

Note Note: If you are using the Geyser layout manager, use myScrollBox:delete() instead. This will handle proper cleanup from Geyser's internal structures.

Note Note: While hiding a scrollbox with hideWindow() keeps it in memory for later use, deleting it completely removes it. Deleted scrollboxes cannot be shown again - you would need to create a new one. It's more efficient to hide/show scrollboxes than to delete and recreate them if you'll need them again.

See also
createScrollBox()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • scrollBoxName: The name of the scrollbox to delete.
Returns
  • true on success
  • false and an error message if the scrollbox doesn't exist
Example
-- Create a scrollbox
createScrollBox("myScrollBox", 10, 10, 300, 400)

-- Later, delete it completely
local success, err = deleteScrollBox("myScrollBox")
if not success then
  cecho(f"<red>Error: {err}\n")
end

-- With Geyser:
local myScrollBox = Geyser.ScrollBox:new({
  name = "myGeyserScrollBox",
  x = 100, y = 100,
  width = 300, height = 400,
})

-- Delete it (handles all cleanup automatically)
myScrollBox:delete()

Geyser Object Deletion, PR #8387

myGeyserObject
delete()
Deletes a Geyser object and all of its children. This method is available on all Geyser container types including Label, Gauge, MiniConsole, CommandLine, ScrollBox, and Mapper. It performs complete cleanup including:
  • Recursively deleting all children
  • Removing the object from parent containers
  • Removing references from Geyser's tracking structures
  • Calling the underlying C++ delete function where applicable

Note Note: This is the recommended way to delete Geyser objects as it handles all necessary cleanup automatically.

Note Note: After calling delete(), the Lua variable still exists but the object it referenced is gone. You should set it to nil: myLabel = nil

See also
deleteLabel(), deleteMiniConsole(), deleteCommandLine(), deleteScrollBox()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • None
Returns
  • Nothing
Example
-- Create a container with nested labels
local container = Geyser.Container:new({
  name = "myContainer",
  x = 100, y = 100,
  width = 400, height = 300,
})

local label1 = Geyser.Label:new({
  name = "label1",
  x = 10, y = 10,
  width = 100, height = 30,
}, container)

local label2 = Geyser.Label:new({
  name = "label2",
  x = 10, y = 50,
  width = 100, height = 30,
}, container)

-- Delete the entire container - automatically deletes label1 and label2 too
container:delete()
container = nil

-- Delete individual elements
local myGauge = Geyser.Gauge:new({
  name = "healthGauge",
  x = 10, y = 10,
  width = 200, height = 20,
})

-- Later when you don't need it anymore
myGauge:delete()
myGauge = nil

setConsoleBufferSize PR #8222

setConsoleBufferSize([consoleName], linesLimit, sizeOfBatchDeletion, [max])
Sets the maximum number of lines a buffer (main window or a miniconsole) can hold. Default is 100,000.
Returns nothing on success (up to Mudlet 4.16) or true (from Mudlet 4.17); nil and an error message on failure.
Parameters
  • consoleName:
(optional) The name of the window. If omitted, uses the main console.
  • linesLimit:
Sets the amount of lines the buffer should have.

Note Note: Mudlet performs extremely efficiently with even huge numbers, but there is of course a limit to your computer's memory. As of Mudlet 4.7+, this amount will be capped to that limit on macOS and Linux (on Windows, it's capped lower as Mudlet on Windows is 32bit).

  • sizeOfBatchDeletion:
Specifies how many lines should Mudlet delete at once when you go over the limit - it does it in bulk because it's efficient to do so.
  • max:
Set to true if you'd like to set the linesLimit to the maximum allowed. This is only supported for the main console.
Example
-- sets the main windows size to 1 million lines maximum - which is more than enough!
setConsoleBufferSize("main", 1000000, 1000)


loadVideoFile, PR #7721 closed

loadVideoFile(settings table) or loadVideoFile(name, [url])
Loads video files from the Internet or the local file system to the "media" folder of the profile for later use with playVideoFile() and stopVideos(). Although files could be loaded or streamed directly at playing time from playVideoFile(), loadVideoFile() provides the advantage of loading files in advance.

Note Note: Video files consume drive space on your device. Consider using the streaming feature of playVideoFile() for large files.

Required Key Value Purpose
Yes name <file name>
  • Name of the media file.
  • May contain directory information (i.e. weather/maelstrom.mp4).
  • May be part of the profile (i.e. getMudletHomeDir().. "/congratulations.mp4")
  • May be on the local device (i.e. "C:/Users/YourNameHere/Movies/nevergoingtogiveyouup.mp4")
Maybe url <url>
  • Resource location where the media file may be downloaded.
  • Only required if file to load is not part of the profile or on the local file system.

See also: getPausedMusic(), getPausedSounds(), getPausedVideos(), getPlayingMusic(), getPlayingSounds(), getPausedVideos(), loadMusicFile(), loadSoundFile(), pauseMusic(), pauseSounds(), pauseVideos(), playMusicFile(), playSoundFile(), playVideoFile(), purgeMediaCache(), receiveMSP(), stopMusic(), stopSounds(), stopVideos(), Mud Client Media Protocol

Mudlet VersionAvailable in Mudlet4.??+
Example
---- Table Parameter Syntax ----

-- Download from the Internet
loadVideoFile({
    name = "TextInMotion-VideoSample-1080p.mp4"
    , url = "https://d2qguwbxlx1sbt.cloudfront.net/"
})

-- OR download from the profile
loadVideoFile({name = getMudletHomeDir().. "/TextInMotion-VideoSample-1080p.mp4"})

-- OR download from the local file system
loadVideoFile({name = "C:/Users/Tamarindo/Movies/TextInMotion-VideoSample-1080p.mp4"})

playVideoFile, PR #7721 closed

playVideoFile(settings table)
Plays video files from the Internet or the local file system for later use with stopVideos(). Video files may be downloaded to the device and played, or streamed from the Internet when the value of the stream parameter is true.
Required Key Value Default Purpose
Yes name <file name>  
  • Name of the media file.
  • May contain directory information (i.e. weather/maelstrom.mp4).
  • May be part of the profile (i.e. getMudletHomeDir().. "/cow.mp4")
  • May be on the local device (i.e. "C:/Users/YourNameHere/Documents/nevergoingtogiveyouup.mp4")
  • Wildcards * and ? may be used within the name to randomize media files selection.
No volume 1 to 100 50
  • Relative to the volume set on the player's client.
No start <msec> 0
  • Begin play at the specified position in milliseconds.
No finish <msec> 0
  • Finish play at the specified position in milliseconds.
No loops -1, or >= 1 1
  • Number of iterations that the media plays.
  • A value of -1 allows the media to loop indefinitely.
Yes key <key>  
  • Identifies the label or window the video will appear on the user interface.
  • Uniquely identifies media files with a "key" that is bound to their "name" or "url".
  • Halts the play of current media files with the same "key" that have a different "name" or "url" while this media plays.
No tag <tag>  
  • Helps categorize media.
No continue true or false true
  • Continues playing matching new video files when true.
  • Restarts matching new video files when false.
No close true or false false
  • Closes the label or window when playback is complete.
Maybe url <url>  
  • Resource location where the media file may be downloaded.
  • Only required if the file is to be downloaded remotely or for streaming from the Internet.
Maybe stream true or false false
  • Streams files from the Internet when true.
  • Download files when false (default).
  • Used in combination with the `url` key.

See also: getPausedMusic(), getPausedSounds(), getPausedVideos(), getPlayingMusic(), getPlayingSounds(), getPausedVideos(), loadMusicFile(), loadSoundFile(), loadVideoFile(), pauseMusic(), pauseSounds(), pauseVideos(), playMusicFile(), playSoundFile(), purgeMediaCache(), receiveMSP(), stopMusic(), stopSounds(), stopVideos(), Mud Client Media Protocol

Mudlet VersionAvailable in Mudlet4.??+
Example
---- Table Parameter Syntax ----

-- Stream a video file from the Internet and play it.
playVideoFile({
    name = "TextInMotion-VideoSample-1080p.mp4"
    , key = "textinmotion" -- label or window to target playback
    , url = "https://d2qguwbxlx1sbt.cloudfront.net/"
    , stream = true
})

-- Play a video file from the Internet, storing it in the profile's media directory (i.e. /Users/Tamarindo/mudlet-data/profiles/StickMUD/media) so you don't need to download it over and over.  You could add ", stream = false" below, but that is the default and is not needed.

playVideoFile({
    name = "TextInMotion-VideoSample-1080p.mp4"
    , key = "textinmotion" -- label or window to target playback
    , url = "https://d2qguwbxlx1sbt.cloudfront.net/"
})

-- Play a video file stored in the profile's media directory (i.e. /Users/Tamarindo/mudlet-data/profiles/StickMUD/media)
playVideoFile({
    name = "TextInMotion-VideoSample-1080p.mp4"
    , key = "textinmotion" -- label or window to target playback
})

-- OR copy once from the game's profile, and play a video file stored in the profile's media directory
---- [volume] of 75 (1 to 100)
playVideoFile({
    name = getMudletHomeDir().. "/TextInMotion-VideoSample-1080p.mp4"
    , key = "textinmotion" -- label or window to target playback
    , volume = 75
})

-- OR copy once from the local file system, and play a video file stored in the profile's media directory
---- [volume] of 75 (1 to 100)
playVideoFile({
    name = "C:/Users/Tamarindo/Movies/TextInMotion-VideoSample-1080p.mp4"
    , key = "textinmotion" -- label or window to target playback
    , volume = 75
})

-- OR download once from the Internet, and play a video stored in the profile's media directory
---- [fadein] and increase the volume from 1 at the start position to default volume up until the position of 10 seconds
---- [fadeout] and decrease the volume from default volume to one, 15 seconds from the end of the video
---- [start] 5 seconds after position 0 (fadein scales its volume increase over a shorter duration, too)
---- [key] reference of "textinmotion" for targeting label or window playback
---- [tag] reference of "ambience" to stop any video later with the same tag
---- [continue] playing this video if another request for the same video comes in (false restarts it) 
---- [url] resource location where the file may be accessed on the Internet
---- [stream] download once from the Internet if the video does not exist in the profile's media directory when false (true streams from the Internet and will not download to the device) 
playVideoFile({
    name = "TextInMotion-VideoSample-1080p.mp4"
    , volume = nil -- nil lines are optional, no need to use
    , start = 10000
    , finish = 20000
    , loops = nil -- nil lines are optional, no need to use
    , key = "textinmotion" -- label or window where this will play
    , tag = "ambience"
    , continue = true
    , close = true -- close the label or window when playback completes
    , url = "https://d2qguwbxlx1sbt.cloudfront.net/"
    , stream = false
})

stopVideos, PR #7721 closed

stopVideos(settings table)
Stop all videos (no filter), or videos that meet a combination of filters (name, key, and tag) intended to be paired with playVideoFile().
Required Key Value Purpose
No name <file name>
  • Name of the media file.
No key <key>
  • Uniquely identifies media files with a "key" that is bound to their "name" or "url".
  • Halts the play of current media files with the same "key" that have a different "name" or "url" while this media plays.
No tag <tag>
  • Helps categorize media.

See also: getPausedMusic(), getPausedSounds(), getPausedVideos(), getPlayingMusic(), getPlayingSounds(), getPausedVideos(), loadMusicFile(), loadSoundFile(), loadVideoFile(), pauseMusic(), pauseSounds(), pauseVideos(), playMusicFile(), playSoundFile(), playVideoFile(), purgeMediaCache(), receiveMSP(), stopMusic(), stopSounds(), Mud Client Media Protocol

Mudlet VersionAvailable in Mudlet4.??+
Example
---- Table Parameter Syntax ----

-- Stop all playing video files for this profile associated with the API
stopVideos()

-- Stop playing the text mp4 by name
stopVideos({name = "TextInMotion-VideoSample-1080p.mp4"})

-- Stop playing the unique sound identified as "text"
stopVideos({
    name = nil  -- nil lines are optional, no need to use
    , key = "text" -- key
    , tag = nil  -- nil lines are optional, no need to use
})

getPausedMusic, PR #7721 closed

getPausedMusic(settings table)
List all paused music (no filter), or paused music that meets a combination of filters (name, key, and tag) intended to be paired with playMusicFile().
Required Key Value Default Purpose
No name <file name>
  • Name of the media file.
No key <key>
  • Uniquely identifies media files with a "key" that is bound to their "name" or "url".
No tag <tag>
  • Helps categorize media.

See also: getPausedSounds(), getPausedVideos(), getPlayingMusic(), getPlayingSounds(), getPausedVideos(), loadMusicFile(), loadSoundFile(), loadVideoFile(), pauseMusic(), pauseSounds(), pauseVideos(), playMusicFile(), playSoundFile(), playVideoFile(), purgeMediaCache(), receiveMSP(), stopMusic(), stopSounds(), stopVideos(), Mud Client Media Protocol

Mudlet VersionAvailable in Mudlet4.??+
Example
---- Table Parameter Syntax ----

-- List all paused music files for this profile associated with the API
getPausedMusic()

-- List all paused music matching the rugby mp3 name
getPausedMusic({name = "167124__patricia-mcmillen__rugby-club-in-spain.mp3"})

-- List all paused music matching the unique key of "rugby"
getPausedMusic({
    name = nil  -- nil lines are optional, no need to use
    , key = "rugby" -- key
    , tag = nil  -- nil lines are optional, no need to use
})

getPausedSounds, PR #7721 closed

getPausedSounds(settings table)
List all paused sounds (no filter), or paused sounds that meets a combination of filters (name, key, tag, and priority) intended to be paired with playSoundFile().
Required Key Value Default Purpose
No name <file name>
  • Name of the media file.
No key <key>
  • Uniquely identifies media files with a "key" that is bound to their "name" or "url".
No tag <tag>
  • Helps categorize media.

See also: getPausedMusic(), getPausedVideos(), getPlayingMusic(), getPlayingSounds(), getPausedVideos(), loadMusicFile(), loadSoundFile(), loadVideoFile(), pauseMusic(), pauseSounds(), pauseVideos(), playMusicFile(), playSoundFile(), playVideoFile(), purgeMediaCache(), receiveMSP(), stopMusic(), stopSounds(), stopVideos(), Mud Client Media Protocol

Mudlet VersionAvailable in Mudlet4.??+
Example
---- Table Parameter Syntax ----

-- List all paused sounds for this profile associated with the API
getPausedSounds()

-- List all paused sounds matching the rugby mp3 name
getPausedSounds({name = "167124__patricia-mcmillen__rugby-club-in-spain.mp3"})

-- List the paused sound matching the unique key of "rugby"
getPausedSounds({
    name = nil  -- nil lines are optional, no need to use
    , key = "rugby" -- key
    , tag = nil  -- nil lines are optional, no need to use
})

getPausedVideos, PR #7721 closed

getPausedVideos(settings table)
List all paused videos (no filter), or playing videos that meets a combination of filters (name, key, and tag) intended to be paired with playVideoFile().
Required Key Value Default Purpose
No name <file name>
  • Name of the media file.
No key <key>
  • Uniquely identifies media files with a "key" that is bound to their "name" or "url".
No tag <tag>
  • Helps categorize media.

See also: getPausedMusic(), getPausedSounds(), getPlayingMusic(), getPlayingSounds(), getPlayingVideos(), loadMusicFile(), loadSoundFile(), loadVideoFile(), pauseMusic(), pauseSounds(), pauseVideos(), playMusicFile(), playSoundFile(), playVideoFile(), purgeMediaCache(), receiveMSP(), stopMusic(), stopSounds(), stopVideos(), Mud Client Media Protocol

Mudlet VersionAvailable in Mudlet4.??+
Example
---- Table Parameter Syntax ----

-- List all paused videos files for this profile associated with the API
getPausedVideos()

-- List all paused videos matching the unique textinmotion key name
getPausedVideos({name = "textinmotion"})

-- List all paused videos matching the textinmotion mp4 name
getPausedVideos({name = "TextInMotion-VideoSample-1080p.mp4"})

-- List all paused videos matching the unique key of "textinmotion"
getPausedVideos({
    name = nil  -- nil lines are optional, no need to use
    , key = "textinmotion" -- key
    , tag = nil  -- nil lines are optional, no need to use
})

getPlayingVideos, PR #7721 closed

getPlayingVideos(settings table)
List all playing videos (no filter), or playing videos that meets a combination of filters (name, key, and tag) intended to be paired with playVideoFile().
Required Key Value Default Purpose
No name <file name>
  • Name of the media file.
No key <key>
  • Uniquely identifies media files with a "key" that is bound to their "name" or "url".
No tag <tag>
  • Helps categorize media.

See also: getPausedMusic(), getPausedSounds(), getPausedVideos(), getPlayingMusic(), getPlayingSounds(), loadMusicFile(), loadSoundFile(), loadVideoFile(), pauseMusic(), pauseSounds(), pauseVideos(), playMusicFile(), playSoundFile(), playVideoFile(), purgeMediaCache(), receiveMSP(), stopMusic(), stopSounds(), stopVideos(), Mud Client Media Protocol

Mudlet VersionAvailable in Mudlet4.??+
Example
---- Table Parameter Syntax ----

-- List all playing videos files for this profile associated with the API
getPlayingVideos()

-- List all playing videos matching the unique textinmotion key name
getPlayingVideos({name = "textinmotion"})

-- List all playing videos matching the textinmotion mp4 name
getPlayingVideos({name = "TextInMotion-VideoSample-1080p.mp4"})

-- List all playing videos matching the unique key of "textinmotion"
getPlayingVideos({
    name = nil  -- nil lines are optional, no need to use
    , key = "textinmotion" -- key
    , tag = nil  -- nil lines are optional, no need to use
})

pauseMusic, PR #7721 closed

pauseMusic(settings table)
Pause all music (no filter), or music that meet a combination of filters (name, key, and tag) intended to be paired with playMusicFile().
Required Key Value Purpose
No name <file name>
  • Name of the media file.
No key <key>
  • Uniquely identifies media files with a "key" that is bound to their "name" or "url".
  • Pauses the play of current media files with the same "key" that have a different "name" or "url" while this media plays.
No tag <tag>
  • Helps categorize media.

See also: getPausedMusic(), getPausedSounds(), getPausedVideos(), getPlayingMusic(), getPlayingSounds(), getPausedVideos(), loadMusicFile(), loadSoundFile(), loadVideoFile(), pauseSounds(), pauseVideos(), playMusicFile(), playSoundFile(), playVideoFile(), purgeMediaCache(), receiveMSP(), stopMusic(), stopSounds(), stopVideos(), Mud Client Media Protocol

Mudlet VersionAvailable in Mudlet4.??+
Example
---- Table Parameter Syntax ----

-- Pause all playing music files for this profile associated with the API
pauseMusic()

-- Pause playing the music matching the rugby mp3 name
pauseMusic({name = "167124__patricia-mcmillen__rugby-club-in-spain.mp3"})

-- Pause playing the unique music identified as "rugby"
pauseMusic({
    name = nil  -- nil lines are optional, no need to use
    , key = "rugby" -- key
    , tag = nil  -- nil lines are optional, no need to use
})

pauseSounds, PR #7721 closed

pauseSounds(settings table)
Pause all sounds (no filter), or sounds that meet a combination of filters (name, key, and tag) intended to be paired with playSoundFile().
Required Key Value Purpose
No name <file name>
  • Name of the media file.
No key <key>
  • Uniquely identifies media files with a "key" that is bound to their "name" or "url".
  • Pauses the play of current media files with the same "key" that have a different "name" or "url" while this media plays.
No tag <tag>
  • Helps categorize media.

See also: getPausedMusic(), getPausedSounds(), getPausedVideos(), getPlayingMusic(), getPlayingSounds(), getPausedVideos(), loadMusicFile(), loadSoundFile(), loadVideoFile(), pauseMusic(), pauseVideos(), playMusicFile(), playSoundFile(), playVideoFile(), purgeMediaCache(), receiveMSP(), stopMusic(), stopSounds(), stopVideos(), Mud Client Media Protocol

Mudlet VersionAvailable in Mudlet4.??+
Example
---- Table Parameter Syntax ----

-- Pause all playing sound files for this profile associated with the API
pauseSounds()

-- Pause all playing sounds matching the rugby mp3 name
getPlayingSounds({name = "167124__patricia-mcmillen__rugby-club-in-spain.mp3"})

-- Pause all playing sound matching the unique key of "rugby"
getPlayingSounds({
    name = nil  -- nil lines are optional, no need to use
    , key = "rugby" -- key
    , tag = nil  -- nil lines are optional, no need to use
})

pauseVideos, PR #7721 closed

pauseVideos(settings table)
Pause all videos (no filter), or videos that meet a combination of filters (name, key, and tag) intended to be paired with playVideoFile().
Required Key Value Purpose
No name <file name>
  • Name of the media file.
No key <key>
  • Uniquely identifies media files with a "key" that is bound to their "name" or "url".
  • Pauses the play of current media files with the same "key" that have a different "name" or "url" while this media plays.
No tag <tag>
  • Helps categorize media.

See also: getPausedMusic(), getPausedSounds(), getPausedVideos(), getPlayingMusic(), getPlayingSounds(), getPausedVideos(), loadMusicFile(), loadSoundFile(), loadVideoFile(), pauseMusic(), pauseSounds(), playMusicFile(), playSoundFile(), playVideoFile(), purgeMediaCache(), receiveMSP(), stopMusic(), stopSounds(), stopVideos(), Mud Client Media Protocol

Mudlet VersionAvailable in Mudlet4.??+
Example
---- Table Parameter Syntax ----

-- Pause all playing video files for this profile associated with the API
pauseVideos()

-- Pause playing the text mp4 by name
pauseVideos({name = "TextInMotion-VideoSample-1080p.mp4"})

-- Pause playing the unique video identified as "text"
pauseVideos({
    name = nil  -- nil lines are optional, no need to use
    , key = "text" -- key
    , tag = nil  -- nil lines are optional, no need to use
})

getCustomLoginTextId, PR #3952 open

getCustomLoginTextId()

Returns the Id number of the custom login text setting from the profile's preferences. Returns 0 if the option is disabled or a number greater than that for the item in the table; note it is possible if using an old saved profile in the future that the number might be higher than expected. As a design policy decision it is not permitted for a script to change the setting, this function is intended to allow a script or package to check that the setting is what it expects.

Introduced along with four other functions to enable game server log-in to be scripted with the simultaneous movement of that functionality from the Mudlet application core code to a predefined doLogin() function, a replacement for which is shown below.

See also: getCharacterName(), sendCharacterName(), sendCustomLoginText(), sendPassword().

Note Note: Not available yet. See https://github.com/Mudlet/Mudlet/pull/3952

Only one custom login text has been defined initially:

Predefined custom login texts
Id Custom text Introduced in Mudlet version
1 "connect {character name} {password}" TBD

The addition of further texts would be subject to negotiation with the Mudlet Makers.

Example
-- A replacement for the default function placed into LuaGlobal.lua to reproduce the previous behavior of the Mudlet application:
function doLogin()
  if getCustomLoginTextId() ~= 1 then
    -- We need this particular option but it is not permitted for a script to change the setting, it can only check what it is
    echo("\nUnable to login - please select the 'connect {character name} {password}` custom login option in the profile preferences.\n")
  else
    tempTime(2.0, [[sendCustomLoginText()]], 1)
  end
end

sendCharacterName, PR #3952 open

sendCharacterName()

Sends the name entered into the "Character name" field on the Connection Preferences form directly to the game server. Returns true unless there is nothing set in that entry in which case a nil and an error message will be returned instead.

Introduced along with four other functions to enable game server log-in to be scripted with the simultaneous movement of that functionality from the Mudlet application core code to a predefined doLogin() function that may be replaced for more sophisticated requirements.

See also: getCharacterName(), sendCharacterPassword(), sendCustomLoginText(), getCustomLoginTextId().

Note Note: Not available yet. See https://github.com/Mudlet/Mudlet/pull/3952

sendCharacterPassword, PR #3952 open

sendCharacterPassword()

Sends the password entered into the "Password" field on the Connection Preferences form directly to the game server. Returns true unless there is nothing set in that entry or it is too long after (or before) a connection was successfully made in which case a nil and an error message will be returned instead.

Introduced along with four other functions to enable game server log-in to be scripted with the simultaneous movement of that functionality from the Mudlet application core code to a predefined doLogin() function, reproduced below, that may be replaced for more sophisticated requirements.

See also: getCharacterName(), sendCustomLoginText(), getCustomLoginTextId(), sendCharacterName().

Note Note: Not available yet. See https://github.com/Mudlet/Mudlet/pull/3952

Example
-- The default function placed into LuaGlobal.lua to reproduce the previous behavior of the Mudlet application:
function doLogin()
  if getCharacterName() ~= "" then
    tempTime(2.0, [[sendCharacterName()]], 1)
    tempTime(3.0, [[sendCharacterPassword()]], 1)
  end
end

sendCustomLoginText, PR #3952 open

sendCustomLoginText()

Sends the custom login text (which does NOT depend on the user's choice of GUI language) selected in the preferences for this profile. The {password} (and {character name} if present) fields will be replaced with the values entered into the "Password" and "Character name" fields on the Connection Preferences form and then sent directly to the game server. Returns true unless there is nothing set in either of those entries (though only if required for the character name) or it is too long after (or before) a connection was successfully made or if the custom login feature is disabled, in which case a nil and an error message will be returned instead.

Introduced along with four other functions to enable game server log-in to be scripted with the simultaneous movement of that functionality from the Mudlet application core code to a predefined doLogin() function, a replacement for which is shown below.

See also: getCharacterName(), sendCharacterName(), sendPassword(), getCustomLoginTextId().

Note Note: Not available yet. See https://github.com/Mudlet/Mudlet/pull/3952

Only one custom login text has been defined initially:

Predefined custom login texts
Id Custom text Introduced in Mudlet version
1 "connect {character name} {password}" TBD

The addition of further texts would be subject to negotiation with the Mudlet Makers.

Example
-- A replacement for the default function placed into LuaGlobal.lua to reproduce the previous behavior of the Mudlet application:
function doLogin()
  if getCustomLoginTextId() ~= 1 then
    -- We need this particular option but it is not permitted for a script to change the setting, it can only check what it is
    echo("\nUnable to login - please select the 'connect {character name} {password}` custom login option in the profile preferences.\n")
  else
    tempTime(2.0, [[sendCustomLoginText()]], 1)
  end
end


openMudletHomeDir, PR 8026, merged

openMudletHomeDir()
Opens the current home directory of the current profile in your local system's file browser. This can be used to review or modify data stored there.
See also
getMudletHomeDir()
Example
openMudletHomeDir()

Mudlet Object Functions

A collection of functions that manipulate Mudlet's scripting objects - triggers, aliases, and so forth.

createComposer PR #8114

ok = createComposer(title, text, callbackFunction)

Creates a Composer dialog window with the given title and initial text, and registers a Lua function to handle the result. When the user clicks **Save** or **Cancel**, the Composer closes and your callback function is invoked with two arguments: the resulting text and a boolean indicating whether the user saved (true) or canceled editing (false).

See also
getComposerText(), setComposerText(), getComposerTitle(), setComposerTitle()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • title:
The title of the Composer window.
  • text:
The initial text content in the Composer. You can use \n to start a new line, \t for tabulators, etc.
  • callbackFunction:
A Lua function to call when the Composer closes. It will receive two parameters:
  • A string with the text the user entered.
  • A boolean value – `true` if the user clicked **Save**, `false` if they clicked **Cancel**.
Returns
  • Boolean `true` if the Composer was successfully created, otherwise nil + error (for example, if another Composer is already open).
Example
-- Create a Composer window for editing a note
createComposer("Edit Note", "Default text", function(editedText, isSaved)
    if isSaved then
        echo(f"Saved text: {editedText}\n")
    else
        echo("Edit was canceled.\n")
    end
end)

deleteAllNamedTriggers PR#7767

deleteAllNamedTriggers(userName)
Deletes all named triggers and prevents them from matching. Information is deleted and cannot be retrieved.
See also
registerNamedTrigger(), stopNamedTrigger()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • userName:
The user name the trigger was registered under.
Example
deleteAllNamedTriggers("Zooka") -- emergency stop or debugging situation, most likely.

deleteNamedTrigger PR#7767

success = deleteNamedTrigger(userName, triggerName)
Deletes a named trigger with name triggerName and prevents it from matching any more. Information is deleted and cannot be retrieved.
See also
registerNamedTrigger(), stopNamedTrigger()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • userName:
The user name the trigger was registered under.
  • triggerName:
The name of the trigger to stop. Same used as when you called registerNamedTrigger()
Returns
  • true if successful, false if it didn't exist
Example
local deleted = deleteNamedTrigger("Zooka", "automatic drinking trigger")
if deleted then
  cecho("Drinking trigger deleted forever!")
else
  cecho("Drinking trigger doesn't exist and so could not be deleted.")
end


getComposerText PR #8114

text = getComposerText()

Returns the current text from the Composer window, if it is open.

See also
createComposer(), setComposerText()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • (none)
Returns
  • The text currently displayed in the Composer, or nil + error if the Composer is not open.
Example
-- Retrieve and print the current text from the Composer
local currentText = getComposerText()
if currentText then
    echo(f"Current text in Composer: {currentText}\n")
else
    echo("No Composer is open.\n")
end


getComposerTitle PR #8114

title = getComposerTitle()

Returns the current title from the Composer window, if it is open.

See also
createComposer(), setComposerTitle()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • (none)
Returns
  • The current title of the Composer, or nil + error if the Composer is not open.
Example
-- Print the Composer title
local currentTitle = getComposerTitle()
if currentTitle then
    echo(f"Composer title: {currentTitle}\n")
else
    echo("No Composer is open.\n")
end


getNamedTriggers PR#7767

triggers = getNamedTriggers(userName)
Returns a list of all the named triggers names as a table.
See also
registerNamedTrigger()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • userName:
The user name the triggers were registered under.
Returns
  • a table of trigger names. { "automatic drinking trigger", "autoheal trigger" } for example. {} if none are registered
Example
  local triggers = getNamedTriggers("Zooka")
  display(triggers)
  -- {}
  registerNamedTriggers("Zooka", "Test1", "test string", "testFunction")
  triggers = getNamedTriggers("Zooka")
  display(triggers)
  -- { "Test1" }


registerNamedTrigger PR#7767

success = registerNamedTrigger(userName, triggerName, substring, functionReference, [expireAfter])
Registers a named substring trigger with name triggerName. Named triggers are protected from duplication and can be stopped and resumed, unlike normal tempTriggers. A separate list is kept for each userName, to enforce name spacing and avoid collisions
See also
tempTrigger(), stopNamedTrigger(), resumeNamedTrigger(), deleteNamedTrigger()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • userName:
The user name the trigger was registered under.
  • triggerName:
The name of the trigger. Used to reference the trigger in other functions and prevent duplicates. Recommended to use descriptive names, "hp" is likely to collide with something else, "automatic drinking trigger" less so.
  • substring:
The substring text to match.
  • functionReference:
The function reference to run when the trigger matches. Can be the name of a function, "handlerFunction", or the lua function itself.
  • expireAfter:
(optional) Delete trigger after a specified number of matches
Returns
  • true if successful, otherwise errors.
Example
-- establish a named trigger called "automatic drinking trigger" which sends 'drink canteen' when thirsty
registerNamedTrigger("Zooka", "automatic drinking trigger", "You are thirsty.", function() send("drink canteen") end)

resumeNamedTrigger PR#7767

success = resumeNamedTrigger(userName, triggerName)
Resumes a named trigger with name triggerName and allows it to match again.
See also
registerNamedTrigger(), stopNamedTrigger()
Mudlet VersionAvailable in Mudlet4.20+
Parameter
  • userName:
The user name the trigger was registered under.s
  • triggerName:
The name of the trigger to resume. Same as used when you called registerNamedTrigger()
Returns
  • true if successful, false if it didn't exist.
Example
local resumed = resumeNamedTrigger("Zooka", "automatic drinking trigger")
if resumed then
  echo("Starting to automatically drink again.")
else
  echo("Drink trigger doesn't exist so cannot resume it.")
end

setComposerText PR #8114

setComposerText(newText)

Sets the text content of the Composer window, if it is open.

See also
createComposer(), getComposerText()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • newText:
The text to display in the Composer. You can use \n to start a new line, \t for tabulators, etc.
Returns
  • Boolean `true` if the Title was successfully set, or nil + error if no Composer is open.
Example
-- Change the Composer text dynamically
setComposerText("Updated text for the Composer")

setComposerTitle PR #8114

setComposerTitle(newTitle)

Sets the title of the Composer window, if it is open.

See also
createComposer(), getComposerTitle()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • newTitle:
The title to display in the Composer.
Returns
  • Boolean `true` if the Title was successfully set, or nil + error if no Composer is open.
Example
-- Change the Composer title dynamically
setComposerTitle("Declaration of Independence")


stopAllNamedTrigger PR#7767

stopAllNamedTrigger(userName)
Stops all named triggers for userName and prevents them from firing any more. Information is retained and triggers can be resumed.
See also
registerNamedTrigger(), stopNamedTrigger(), resumeNamedTrigger()
Mudlet VersionAvailable in Mudlet4.20+
Example
stopAllNamedTriggers("Zooka") -- emergency stop situation, most likely.

stopNamedTrigger PR#7767

success = stopNamedTrigger(userName, triggerName)
Stops a named trigger with name triggerName and prevents it from firing any more. Information is stored so it can be resumed later if desired.
See also
registerNamedTrigger(), resumeNamedTrigger()
Mudlet VersionAvailable in Mudlet4.20+
Parameters
  • userName:
The user name the event handler was registered under.
  • triggerName:
The name of the trigger to stop. Same as used when you called registerNamedTrigger()
Returns
  • true if successful, false if it didn't exist or was already stopped
Example
local stopped = stopNamedTrigger("Zooka", "automatic drinking trigger")
if stopped then
  echo("No longer drinking automatically.")
else
  echo("Drinking trigger doesn't exist or already stopped; either way it won't fire any more.")
end

Networking Functions

A collection of functions for managing networking.

String Functions

These functions are used to manipulate strings.

Table Functions

These functions are used to manipulate tables. Through them you can add to tables, remove values, check if a value is present in the table, check the size of a table, and more.

Text to Speech Functions

These functions are used to create sound from written words. Check out our Text-To-Speech Manual for more detail on how this all works together.

UI Functions

These functions are used to construct custom user GUIs. They deal mainly with miniconsole/label/gauge creation and manipulation as well as displaying or formatting information on the screen.

insertPopup, revised in PR #6925

insertPopup([windowName], text, {commands}, {hints}[{, tool-tips}][, useCurrentFormatElseDefault])
Creates text with a left-clickable link, and a right-click menu for more options at the end of the current line, like echo. The added text, upon being left-clicked, will do the first command in the list. Upon being right-clicked, it'll display a menu with all possible commands. The menu will be populated with hints, one for each line; if a tool-tips table is not provided the same hints will also be listed one-per-line as a tool-tip but if a matching number of tool-tips are provided they will be concatenated to provide a tool-tip when the text is hovered over by the pointer - these tool-tips can be rich-text to produce information formatted with additional content in the same manner as labels.
Parameters
  • windowName:
(optional) name of the window as a string to echo to. Use either main or omit for the main window, or the miniconsole's or user-window's name otherwise.
  • text:
the text string to display.
  • {commands}:
a table of lua code to do, in text strings or as functions (since Mudlet 4.11), i.e. {[[send("hello")]], function() echo("hi!") end}.
  • {hints}:
a table of strings which will be shown on the right-click menu (and popup if no {tool-tips} table is provided). If a particular position in both the commands and hints table are both the empty string "" but there is something in the tool-tips table, no entry for that position will be made in the context menu but the tool-tip can still display something which can include images or text.
  • {tool-tips}:
(optional) a table of possibly rich-text strings which will be shown on the popup if provided.
  • useCurrentFormatElseDefault:
(optional) a boolean value for using either the current formatting options (color, underline, italic and other effects) if true or the link default (blue underline) if false, if omitted the default format is used.

Note Note: Mudlet will distinguish between the optional tool-tips and the flag to switch between the standard link and the current text format by examining the type of the argument, as such this pair of arguments can be in either order.

Example
-- Create some text as a clickable with a popup menu, a left click will ''send "sleep"'':
insertPopup("activities to do", {function() send "sleep" end, function() send "sit" end, function() send "stand" end}, {"sleep", "sit", "stand"})

-- alternatively, put commands as text (in [[ and ]] to use quotation marks inside)
insertPopup("activities to do", {[[send "sleep"]], [[send "sit"]], [[send "stand"]]}, {"sleep", "sit", "stand"})

-- one can also provide helpful information

-- todo: an example with rich-text in the tool-tips(s)

setWindowWrapHangingIndent, merged PR #7714

setWindowWrapHangingIndent(windowName, indentSize)
Sets how many spaces the second and all subsequent line(s) of text from a wrapped line will be indented.
See also
setWindowWrap(), setWindowWrapIndent()
Parameters
  • windowName:
Name of the "main" console or user-created miniconsole which you want to be wrapped differently. If you want to wrap the main window, use windowName "main".
  • indentSize:
Number of spaces which hanging wrapped lines are prefixed with.
Example
-- |Make wrapped text indent
-- |  like this. (Keep going
-- |  until a linebreak.)

setWindowWrap("main", 25)
setWindowWrapIndent("main", 0)          -- First line indent
setWindowWrapHangingIndent("main", 2)   -- subsequent line(s)

setWindowWrapIndent, merged PR #7714

setWindowWrapIndent(windowName, indentSize)
Sets how many spaces the first line of text from a wrapped line will be indented.
See also
setWindowWrap(), setWindowWrapHangingIndent()
Parameters
  • windowName:
Name of the "main" console or user-created miniconsole which you want to be wrapped differently. If you want to wrap the main window, use windowName "main".
  • indentSize:
Number of spaces which wrapped lines are prefixed with.
Example
-- |  Make wrapped text indent
-- |indent like this. (Only
-- |first line indented.)

setWindowWrap("main", 25)
setWindowWrapIndent("main", 2)          -- First line indent
setWindowWrapHangingIndent("main", 0)   -- subsequent line(s)

Discord Functions

All functions to customize the information Mudlet displays in Discord's rich presence interface. For an overview on how all of these functions tie in together, see our Discord scripting overview.

Mud Client Media Protocol

All GMCP functions to send sound and music events. For an overview on how all of these functions tie in together, see our MUD Client Media Protocol scripting overview.

Client.Media.Spatial, PR #8452

The Client.Media.Spatial family of GMCP packages extends the Client.Media protocol to provide 3D positional audio capabilities. These packages allow games to create immersive spatial soundscapes with positioned audio sources and listener orientation.

Mudlet VersionAvailable in Mudlet4.20+

Enabling Spatial Audio

Spatial audio requires the same settings as regular Client.Media:

  1. The "Enable GMCP" box in the Miscellaneous section must be checked.
  2. The "Allow server to download and play media" box in the Game protocols section must be checked.

Coordinate System

The spatial audio system uses a 3D coordinate system where:

  • Azimuth: Horizontal angle in degrees (0° = front, 90° = right, 180° = back, 270° = left)
  • Elevation: Vertical angle in degrees (-90° = below, 0° = level, 90° = above)
  • Distance: Distance from listener in arbitrary units (1.0 = close, higher values = farther)

For listener positioning, a Cartesian coordinate system is used:

  • X: Left/right position
  • Y: Forward/back position
  • Z: Up/down position

Playing Spatial Media

Send Client.Media.Spatial.Play GMCP events to play positioned sound sources in 3D space.

Required Parameter Value Default Description
Yes "key" <string> Unique identifier for this spatial audio source. Used for updates and stopping.
Yes "name" <file name> Name of the media file. May contain directory information (i.e. ambient/wind.wav).
Maybe "url" <url> Resource location where the media file may be downloaded. Only required if not using Client.Media.Default URL or if file is not cached.
No "volume" 1 to 100 80 Volume level relative to the master spatial audio volume.
No "loops" -1, or >= 1 1 Number of times to loop the sound. -1 for infinite looping.
No "position" <array or object> 3D position of the sound source. See position formats below.
No "occlusion" 0.0 to 1.0 0.0 Occlusion factor (0.0 = no occlusion, 1.0 = fully occluded/muffled).
No "room" <object> Room acoustics parameters. See room acoustics below.

Position Formats

Position can be specified as an array [azimuth, elevation, distance] or as an object:

// Array format
Client.Media.Spatial.Play {
  "key": "footsteps_player",
  "name": "footsteps.wav",
  "position": [45, 0, 2.5]
}

// Object format  
Client.Media.Spatial.Play {
  "key": "footsteps_player", 
  "name": "footsteps.wav",
  "position": {
    "azimuth": 45,
    "elevation": 0,
    "distance": 2.5
  }
}

Room Acoustics

Room acoustics can enhance spatial realism by simulating reverb and reflections:

Client.Media.Spatial.Play {
  "key": "cave_drip",
  "name": "water_drop.wav",
  "position": [0, -45, 8],
  "room": {
    "dimensions": [20, 30, 5],
    "reverb": 2.5,
    "reflection": 1.8,
    "material": "sheetrock"
  }
}

Updating Spatial Media

Send Client.Media.Spatial.Update GMCP events to modify properties of already playing spatial audio sources.

Required Parameter Value Description
Yes "key" <string> Unique identifier of the spatial audio source to update.
No "position" <array or object> New 3D position for the sound source.
No "volume" 1 to 100 New volume level.
No "occlusion" 0.0 to 1.0 New occlusion factor.

Example of moving a sound source:

Client.Media.Spatial.Update {
  "key": "footsteps_player",
  "position": [90, 0, 3.0],
  "volume": 60
}

Stopping Spatial Media

Send Client.Media.Spatial.Stop GMCP events to stop spatial audio sources.

Required Parameter Value Description
No "key" <string> Unique identifier of the spatial audio source to stop. If omitted, stops all spatial audio.

Stop a specific source:

Client.Media.Spatial.Stop {
  "key": "footsteps_player"
}

Stop all spatial audio:

Client.Media.Spatial.Stop {}

Listener Control

Send Client.Media.Spatial.Listener GMCP events to control the listener's position and orientation in 3D space.

Required Parameter Value Description
No "position" <array or object> Listener position in 3D space [x, y, z] or {x, y, z}.
No "rotation" <array or object> Listener rotation [yaw, pitch, roll] or {yaw, pitch, roll} in degrees.

Listener Position

Position uses Cartesian coordinates:

// Array format: [x, y, z]
Client.Media.Spatial.Listener {
  "position": [5.0, -2.0, 1.5]
}

// Object format
Client.Media.Spatial.Listener {
  "position": {
    "x": 5.0,
    "y": -2.0, 
    "z": 1.5
  }
}

Listener Rotation

Rotation controls where the listener is facing:

// Array format: [yaw, pitch, roll]
Client.Media.Spatial.Listener {
  "rotation": [180, -10, 0]
}

// Object format
Client.Media.Spatial.Listener {
  "rotation": {
    "yaw": 180,
    "pitch": -10,
    "roll": 0
  }
}

Usage Examples

Basic Positioned Sound

Client.Media.Spatial.Play {
  "key": "sword_clash",
  "name": "combat/sword_hit.wav",
  "position": [30, 0, 2],
  "volume": 85
}

Moving Ambient Sound

// Start a moving creature sound
Client.Media.Spatial.Play {
  "key": "wolf_howl",
  "name": "creatures/wolf_howl.wav", 
  "position": [-90, 10, 5],
  "loops": 3
}

// Update its position as it moves
Client.Media.Spatial.Update {
  "key": "wolf_howl",
  "position": [-45, 5, 3]
}

Environmental Audio with Room Acoustics

Client.Media.Spatial.Play {
  "key": "cathedral_organ",
  "name": "music/organ_chord.wav",
  "position": [0, 15, 20],
  "volume": 70,
  "room": {
    "dimensions": [40, 80, 15],
    "reverb": 3.0,
    "reflection": 2.2,
    "material": "sheetrock"
  }
}

Dynamic Listener Movement

// Player turns to face north and moves forward
Client.Media.Spatial.Listener {
  "position": [0, 5, 0],
  "rotation": [0, 0, 0]
}

// Player turns to look northeast and up slightly
Client.Media.Spatial.Listener {
  "rotation": [45, 15, 0]
}

Note Note: Spatial audio provides the most immersive experience when used with headphones or properly positioned stereo speakers. The 3D positioning effects may be less apparent with poor audio hardware.

GMCP Spatial Audio Capability Detection

Mudlet provides three GMCP messages for server developers to detect and query spatial audio capabilities. These allow servers to adapt their audio content based on the client's actual capabilities and current settings.

Client.Media.Spatial.Capabilities

Query the client's spatial audio capabilities to determine what features and formats are supported.

Server sends:

Client.Media.Spatial.Capabilities {}

Client responds with:

Client.Media.Spatial.Capabilities {
  "version": "1.0",
  "formats": ["wav", "mp3", "ogg", "flac", "aac", "m4a"],
  "output_modes": ["stereo", "surround", "headphone"],
  "room_materials": ["brick", "concrete", "wood", "metal", "glass", ...],
  "max_sources": 32,
  "distance_model": "inverse",
  "coordinate_system": "spherical",
  "features": {
    "positioning": true,
    "room_acoustics": true,
    "occlusion": true,
    "listener_control": true,
    "test_tones": true,
    "volume_control": true,
    "loops": true
  }
}

Response Fields:

  • version: Protocol version (currently "1.0")
  • formats: Array of supported audio file formats (detected at runtime based on Qt6 multimedia backend)
  • output_modes: Available audio output configurations
  • room_materials: Supported acoustic materials for room simulation
  • max_sources: Maximum number of simultaneous spatial audio sources
  • distance_model: Audio attenuation model used ("inverse")
  • coordinate_system: Position coordinate system ("spherical" with azimuth/elevation/distance)
  • features: Boolean flags indicating supported capabilities
Room Materials

The room materials are baed on this list from Qt QAudioRoom's Material enum. Mudlet is accepting the list of aliases as well.

Material Aliases Description
transparent air The side of the room is open and won't contribute to reflections or reverb.
acousticceilingtiles acoustictiles Acoustic tiles that suppress most reflections and reverb.
brickbare brick Bare brick wall.
brickpainted Painted brick wall.
concreteblockcoarse concrete Raw concrete wall
concreteblockpainted concretepainted Painted concrete wall
curtainheavy curtain, fabric Heavy curtain. Will mostly reflect low frequencies
fiberglassinsulation fiberglass, carpet Fiber glass insulation. Only reflects very low frequencies
glassthin glass Thin glass wall
glassthick Thick glass wall
grass Grass
linoleumonconcrete linoleum Linoleum floor
marble Marble floor
metal Metal
parquetonconcrete parquet, parquetonfiberboard Parquet wooden floor on concrete
plasterrough plaster Rough plaster
plastersmooth Smooth plaster
plywoodpanel plywood Plywood panel
polishedconcreteortile tile, polishedconcrete Polished concrete or tiles
sheetrock stone Rock
wateroricesurface water, ice, wateroriceereflector Water or ice
woodceiling Wooden ceiling
woodpanel wood Wooden panel
uniformmaterial uniform Artificial material giving uniform reflections on all frequencies

Client.Media.Spatial.Settings

Query the client's current spatial audio configuration and user settings.

Server sends:

Client.Media.Spatial.Settings {}

Client responds with:

Client.Media.Spatial.Settings {
  "master_volume": 80,
  "listener": {
    "position": [0, 0, 0],
    "rotation": [0, 0, 0]
  },
  "room": {
    "dimensions": [10, 10, 4],
    "reverb_gain": 0.3,
    "reflection_gain": 0.5,
    "reverb_time": 1.0,
    "reverb_brightness": 0.0
  }
}

Response Fields:

  • master_volume: Current master volume (0-100)
  • listener.position: 3D listener position [x, y, z] in Cartesian coordinates
  • listener.rotation: Listener orientation [yaw, pitch, roll] in degrees
  • room.dimensions: Room size [width, height, depth] in meters
  • room.reverb_gain: Reverberation intensity (0.0-5.0)
  • room.reflection_gain: Early reflection intensity (0.0-5.0)
  • room.reverb_time: Reverberation decay time in seconds (0.0-20.0)
  • room.reverb_brightness: Reverb frequency bias (-1.0 to 1.0)

Client.Media.Spatial.Status

Query the current status of active spatial audio sources managed by the server.

Server sends:

Client.Media.Spatial.Status {}

Client responds with:

Client.Media.Spatial.Status {
  "engine_initialized": true,
  "source_count": 2,
  "max_sources": 32,
  "active_sources": [
    {
      "key": "ambient_forest",
      "status": "playing",
      "position": [45, 0, 5],
      "volume": 60,
      "occlusion": 0.0,
      "size": 1.0,
      "loops": -1
    },
    {
      "key": "footsteps",
      "status": "paused",
      "position": [-90, -10, 2],
      "volume": 80,
      "occlusion": 0.5,
      "size": 0.5,
      "loops": 1
    }
  ]
}

Response Fields:

  • engine_initialized: Whether the spatial audio engine is ready
  • source_count: Number of currently active sources
  • max_sources: Maximum supported sources
  • active_sources: Array of source objects with current state
    • key: Server-assigned source identifier
    • status: Current playback state ("playing", "paused", "stopped")
    • position: Source position [azimuth, elevation, distance] in spherical coordinates
    • volume: Current volume level (0-100)
    • occlusion: Occlusion/obstruction level (0.0-4.0)
    • size: Source spatial size (0.0+, affects audio spread)
    • loops: Loop count (-1 for infinite, 0 for stopped, >0 for remaining loops)

Supported Protocols

MXP FRAME and DEST Tags, PR #8577

MXP FRAME and DEST tags allow MUD servers to create multi-window layouts, directing game output to separate panels within Mudlet. This enables rich interfaces with dedicated areas for chat, inventory, status, and more.

Mudlet VersionAvailable in Mudlet4.21+

Overview

FRAME creates a new window panel that can display game content.

DEST (destination) redirects subsequent text to a specific frame.

FRAME Tag

Creates a named frame where content can be directed.

Basic Syntax

<FRAME name="frameName" title="Frame Title" align="left" width="25%" height="100%">

Attributes

Attribute Required Description Default
NAME Yes Unique identifier for the frame -
TITLE No Display title shown in the frame's tab Same as NAME
INTERNAL No Frame appears inside the main window Yes (default)
EXTERNAL No Frame appears as a separate floating window No
FLOATING No Borderless frame without title bar No
ALIGN No Position: left, right, top, bottom left
LEFT No Absolute horizontal position (pixels, %, or 'c' suffix) -
TOP No Absolute vertical position (pixels, %, or 'c' suffix) -
WIDTH No Frame width (pixels, %, or characters with 'c' suffix) 25%
HEIGHT No Frame height (pixels, %, or characters with 'c' suffix) 25%
SCROLLING No Enable scrolling (YES/NO) YES
ACTION No open (show), close (hide), or focus open

Size Units

  • Pixels: 300px or 300
  • Percentage: 25% of available space
  • Characters: 40c for 40 characters width/height

CMUD Extension: DOCK

Note: The DOCK attribute is a CMUD extension, not part of the official MXP 1.0 specification.
<FRAME name="tab2" INTERNAL align="client" DOCK="parentFrame">

When used with align="client", the DOCK attribute creates a tabbed frame inside an existing frame.

Examples

Create a left-aligned chat panel:

<FRAME name="chat" title="Chat" align="left" width="30%">

Create a status bar at the bottom:

<FRAME name="status" align="bottom" height="50">

Create a borderless floating frame:

<FRAME name="minimap" FLOATING width="200" height="200" LEFT="10" TOP="10">

Show an existing frame:

<FRAME name="chat" action="open">

Close a frame:

<FRAME name="chat" action="close">

DEST Tag

Redirects text output to a named frame.

Syntax

<DEST name="frameName">Text goes here</DEST>

Or as a self-closing tag to set destination for all following text:

<DEST name="frameName">

Attributes

Attribute Required Description
NAME Yes Target frame name (empty string returns to main window)
EOF No If present, clears all content in the frame before writing
EOL No If present, clears the current line before writing

Examples

Send text to a chat frame:

<DEST name="chat">Player says: Hello!</DEST>

Clear frame and write new content:

<DEST name="status" EOF>HP: 100/100  MP: 50/50</DEST>

Return output to main window:

<DEST name="">

Complete Example

A typical MXP sequence to set up a multi-panel interface:

<!-- Create the frames -->
<FRAME name="chat" title="Chat" align="left" width="25%">
<FRAME name="status" title="Status" align="bottom" height="3c">

<!-- Send content to chat frame -->
<DEST name="chat">
[Guild] Bob: Anyone want to group?
[Guild] Alice: Sure!
</DEST>

<!-- Send content to status frame, clearing previous content -->
<DEST name="status" EOF>HP: 100/100 | MP: 75/100 | XP: 45%</DEST>

<!-- Return to main window for regular game output -->
<DEST name="">
You are standing in the town square.

Behavior Notes

  • Frames persist until explicitly closed with action="close"
  • Re-opening an existing frame shows it without changing its size or position (respects user customization)
  • Frame names are case-sensitive
  • Content sent via DEST inherits the formatting of the destination frame
  • Frames reset on reconnect (don't persist between sessions)

See Also

OSC 8: Hyperlink Protocol

OSC 8 is a standardized terminal escape sequence that enables clickable hyperlinks in terminal output. Mudlet extends the OSC 8 standard with enhanced styling and interactivity features, providing a safer and more powerful alternative to MXP.

Mudlet VersionAvailable in Mudlet4.20+

Quick Start

Want to try OSC 8 hyperlinks immediately? Send this command in Mudlet:

say !osc8-docs

sending !osc8-docs to mudlet

Feature Overview

Feature Description Version
Basic Links Send commands, pre-fill input, open URLs
Mudlet VersionAvailable in Mudlet4.20+
Visual Styling Colors, fonts, decorations
Mudlet VersionAvailable in Mudlet4.20+
Interactive States Hover, active, visited effects
Mudlet VersionAvailable in Mudlet4.20+
Tooltips Custom hover text
Mudlet VersionAvailable in Mudlet4.20+
Context Menus Right-click menus
Mudlet VersionAvailable in Mudlet4.20+
Visibility Auto-hide/reveal links
Mudlet VersionAvailable in Mudlet4.21+
Spoilers Click-to-reveal hidden text
Mudlet VersionAvailable in Mudlet4.21+
Disabled Links Non-clickable display links
Mudlet VersionAvailable in Mudlet4.21+
Selection Stateful toggle links
Mudlet VersionAvailable in Mudlet4.21+
Compact Syntax Shorthand property names
Mudlet VersionAvailable in Mudlet4.21+
Presets Reusable style templates
Mudlet VersionAvailable in Mudlet4.21+

Tier 1: Fundamentals

Understanding OSC Sequences

Purpose

OSC (Operating System Command) sequences are part of the ANSI escape sequence family. They allow terminals to receive structured commands from servers, including hyperlink definitions.

How It Works

  1. Server sends an escape sequence starting with ESC ] (escape + right bracket)
  2. The sequence contains command data (like a URL)
  3. The sequence ends with a String Terminator: ESC \ (escape + backslash)
  4. The terminal processes the command and renders the result

Key Characters

Character ASCII Hex Description
ESC 27 0x1B Escape character - starts all ANSI sequences
] 93 0x5D Right bracket - identifies OSC sequences
\ 92 0x5C Backslash - with ESC forms String Terminator
; 59 0x3B Semicolon - separates parameters

Note Note: Mudlet requires proper ST termination. Missing terminators cause text to buffer without displaying.

Basic Links

Purpose

Create clickable text that performs actions when clicked—sending commands to the game, pre-filling input, or opening web pages.

How It Works

OSC 8 hyperlinks work like HTML tags with opening and closing sequences:

  1. Opening sequence defines the link target: ESC ] 8 ; ; URI ESC \
  2. Link text appears between sequences (can include ANSI formatting)
  3. Closing sequence ends the clickable region: ESC ] 8 ; ; ESC \

Structure

ESC ] 8 ; params ; URI ESC \ visible text ESC ] 8 ; ; ESC \
      │    │       │                              │
      │    │       └── Link target (URL/command)  │
      │    └── Optional parameters (unused)       │
      └── OSC 8 identifier                        └── Empty = close link

URI Schemes

Scheme Action Example Capability Variable
send: Immediately sends command to game send:look OSC_HYPERLINKS_SEND
prompt: Places command in input line for editing prompt:cast fireball OSC_HYPERLINKS_PROMPT
http: / https: Opens in default web browser https://mudlet.org OSC_HYPERLINKS
ftp: Opens in default handler ftp://files.example.com OSC_HYPERLINKS

Examples

Send a command:

ESC ] 8 ; ; send:look ESC \ Look ESC ] 8 ; ; ESC \

Pre-fill input:

ESC ] 8 ; ; prompt:cast%20fireball ESC \ Cast Fireball ESC ] 8 ; ; ESC \

Open webpage:

ESC ] 8 ; ; https://www.mudlet.org ESC \ Visit Mudlet ESC ] 8 ; ; ESC \

Capability Detection

USERVAR OSC_HYPERLINKS = "1"
USERVAR OSC_HYPERLINKS_SEND = "1"
USERVAR OSC_HYPERLINKS_PROMPT = "1"

Percent Encoding

Purpose

JSON configuration is passed as a URL parameter, requiring special characters to be percent-encoded per RFC 3986.

How It Works

  1. Special characters are replaced with %XX where XX is the hex value
  2. The entire JSON config object must be encoded
  3. Spaces in commands use %20

Common Encodings

Character Encoded When to Encode
Space %20 In commands: cast%20fireball
" %22 In JSON strings
{ %7B JSON object start
} %7D JSON object end
: %3A JSON key-value separator
, %2C JSON element separator
& %26 In web URL query strings
# %23 In web URL fragments

What to Encode

Always encode:

  • The entire JSON object in the config parameter
  • Spaces in command URIs

Never encode:

  • URI scheme (send:, https://)
  • Parameter structure (?, =, & in URL structure)

Example

Human-readable:

{"style": {"color": "red"}}

Percent-encoded:

%7B%22style%22%3A%7B%22color%22%3A%22red%22%7D%7D

Complete URI:

send:attack?config=%7B%22style%22%3A%7B%22color%22%3A%22red%22%7D%7D

Encoding Tools

  • JavaScript: encodeURIComponent()
  • Python: urllib.parse.quote()
  • Lua: socket.url.escape() or custom implementation

Tier 2: Visual Styling

JSON Configuration

Purpose

Mudlet extends OSC 8 with JSON-based configuration for rich visual customization while maintaining standard protocol compatibility.

How It Works

  1. Append ?config= to your URI
  2. Follow with percent-encoded JSON
  3. Mudlet parses the JSON and applies styling/behavior

Structure

SCHEME:COMMAND?config=PERCENT_ENCODED_JSON

Configuration Object

{
  "style": { },      // Visual appearance
  "tooltip": "",     // Hover text
  "menu": [ ],       // Right-click options
  "visibility": { }, // Auto-hide/reveal
  "selection": { },  // Toggle state
  "spoiler": false,  // Hidden text
  "disabled": false  // Non-clickable
}

Style Properties

Purpose

Control the visual appearance of hyperlink text including colors, fonts, and decorations.

Properties

Property Type Description Example Values
color String Text foreground color "red", "#ff0000", "rgb(255,0,0)"
bg String Background color "blue", "#000080"
bold Boolean Bold weight true, false
italic Boolean Italic style true, false
underline Boolean/String Underline style true, "wavy", "dotted", "dashed"
overline Boolean/String Overline style true, "wavy", "dotted", "dashed"
strikethrough Boolean/String Strikethrough style true, "wavy", "dotted", "dashed"
text-decoration-color String Color for underline/overline/strikethrough "red", "#ff0000"

Note Note: OSC 8 links are not underlined by default (unlike traditional hyperlinks). Add "underline": true explicitly if desired.

Color Formats

Mudlet supports all standard color formats via Qt's QColor parser:

Named colors (147+ CSS3/X11 names):

"color": "red"
"color": "dodgerblue"
"color": "darkslategray"

Hexadecimal:

"color": "#ff0000"     // 6-digit
"color": "#f00"        // 3-digit shorthand

RGB function:

"color": "rgb(255, 0, 0)"      // Integer 0-255
"color": "rgb(100%, 0%, 0%)"   // Percentage

Examples

Red bold text:

{"style": {"color": "red", "bold": true}}

Blue background with white text:

{"style": {"color": "white", "bg": "blue"}}

Wavy green underline:

{"style": {"underline": "wavy", "text-decoration-color": "green"}}

Capability Detection

USERVAR OSC_HYPERLINKS_STYLE_BASIC = "1"

Interactive States

Purpose

Add dynamic visual feedback with pseudo-class states, similar to CSS hover effects in web browsers.

How It Works

  1. Define base style properties at the top level of style
  2. Add state-specific overrides as nested objects
  3. When a state activates, its properties override the base
  4. Multiple states can be active; higher priority wins

Available States

State Trigger Priority Use Case
active Mouse button pressed 1 (highest) Click feedback
hover Mouse cursor over link 2 Highlight on mouseover
focus-visible Keyboard focus indicator 3 Accessibility
focus Any focus (keyboard/mouse) 4 Focus ring
visited Link clicked previously 5 Show history
selected Selection state active 6 Toggle indicators
disabled Link is disabled 7 Unavailable options
link Unvisited link 8 Distinct unvisited style
any-link Always applies 9 (lowest) Universal styling

Note Note: The visited state resets when Mudlet restarts (session-scoped).

Examples

Hover color change:

{
  "style": {
    "color": "blue",
    "hover": {"color": "red"}
  }
}

Button-like press effect:

{
  "style": {
    "bg": "green",
    "color": "white",
    "hover": {"bg": "lightgreen"},
    "active": {"bg": "darkgreen"}
  }
}

Link vs visited states:

{
  "style": {
    "link": {"color": "blue", "underline": true},
    "visited": {"color": "purple", "strikethrough": true}
  }
}

Capability Detection

USERVAR OSC_HYPERLINKS_STYLE_STATES = "1"

Tier 3: Enhanced Interactivity

Tooltips

Purpose

Display custom hover text to provide guidance, hints, or additional information about a link.

How It Works

  1. Add "tooltip" property to JSON configuration
  2. Text appears when user hovers over the link
  3. Replaces default system tooltip

Configuration

Property Type Description Default
tooltip String Custom hover text Auto-generated based on link type

Examples

Simple tooltip:

{"tooltip": "Click to attack the enemy"}

Tooltip with styling:

{
  "style": {"color": "red", "bold": true},
  "tooltip": "Warning: This action cannot be undone!"
}

Capability Detection

USERVAR OSC_HYPERLINKS_TOOLTIP = "1"

Context Menus

Purpose

Provide multiple actions from a single link via right-click menus, enabling rich interaction without cluttering the display.

How It Works

  1. Left-click executes the primary URI action
  2. Right-click displays the context menu
  3. Each menu item can have its own command
  4. Use "-" to create visual separators

Configuration

Property Type Description
menu Array Array of menu items

Menu item format:

{"Label Text": "scheme:command"}

Separator:

"-"

Examples

Basic combat menu:

{
  "menu": [
    {"Attack": "send:attack"},
    {"Defend": "send:defend"},
    "-",
    {"Flee": "send:flee"}
  ]
}

Menu with tooltip:

{
  "menu": [
    {"Fireball": "send:cast fireball"},
    {"Ice Bolt": "send:cast ice bolt"},
    "-",
    {"Heal": "send:cast heal"}
  ],
  "tooltip": "Right-click for spell options"
}

Note Note: Links with menus automatically show "Right-click for menu" tooltip if no custom tooltip is provided.

Screenshot 2025-10-17 at 7.48.38 AM.png

Capability Detection

USERVAR OSC_HYPERLINKS_MENU = "1"

Tier 4: Dynamic Behavior

Visibility

Purpose

Automatically hide or reveal hyperlink text based on time delays or user triggers. Perfect for temporary hints, dismissible prompts, or progressive disclosure interfaces.

Mudlet VersionAvailable in Mudlet4.21+

How It Works

Conceal action:

  1. Link appears normally when printed
  2. User clicks the link (starts delay timer if set) OR expire trigger fires
  3. After delay/trigger, link text is replaced with spaces

Reveal action:

  1. Link text replaced with spaces when printed (starts hidden)
  2. Delay timer starts immediately OR expire trigger fires
  3. Link text becomes visible

Reveal-then-conceal:

  1. Link starts hidden
  2. Reveals via delay or expire trigger
  3. After revealed, clicking hides it

Configuration

Property Type Description Default
action String/Array Required. "conceal", "reveal", or ["reveal", "conceal"]
delay Number Milliseconds before action (1000 = 1 second)
expire Object Triggers that immediately perform the action
wholeline Boolean Conceal entire line, not just link text (primarily for deletion) false

Expire triggers:

Property Type Description Default
input Boolean Trigger when user sends any command false
prompt Boolean Trigger on GA/EOR prompt from server false
output Boolean Trigger when new output arrives after idle gap false
outputDelay Number Milliseconds of silence defining idle gap 500

Examples

Click to dismiss after delay:

{"visibility": {"action": "conceal", "delay": 500}}

Hide on next server prompt:

{"visibility": {"action": "conceal", "expire": {"prompt": true}}}

Hide when user sends a command:

{"visibility": {"action": "conceal", "expire": {"input": true}}}

Delayed hint (reveal after 5 seconds):

{"visibility": {"action": "reveal", "delay": 5000}}

Appear then click to dismiss:

{"visibility": {"action": ["reveal", "conceal"], "delay": 3000}}

Delete entire line on click:

{"visibility": {"action": "conceal", "delay": 0, "wholeline": true}}

Try "say !osc8-docs" to try this demo in Mudlet

Capability Detection

USERVAR OSC_HYPERLINKS_VISIBILITY = "1"

Spoilers

Purpose

Hide text content until clicked, with automatic styling and tooltip generation. A simpler alternative to visibility-based concealment for hints, secrets, and puzzle answers.

Mudlet VersionAvailable in Mudlet4.21+

How It Works

  1. Link appears with background color matching text (invisible)
  2. Automatic "Click to reveal" tooltip guides the user
  3. First click reveals the hidden text
  4. Subsequent clicks execute the link function (unless disabled)
  5. Tooltip clears after reveal

Configuration

Property Type Description Default
spoiler Boolean Enable spoiler behavior false
disabled Boolean Prevent function execution after reveal false

Automatic Styling

Spoiler background is automatically generated based on the original background's luminance:

Formula: Y = 0.2126×R + 0.7152×G + 0.0722×B

Luminance Background Generation
< 0.1 (very dark) Fixed rgb(40, 40, 40)
< 0.5 (dark) Original background lightened 140%
≥ 0.5 (light) Original background darkened 140%

Examples

Basic spoiler:

{"spoiler": true}

Reveal-only spoiler (no function execution):

{"spoiler": true, "disabled": true}

Spoiler with custom revealed styling:

{
  "spoiler": true,
  "style": {"color": "yellow", "italic": true}
}

Spoiler with menu:

{
  "spoiler": true,
  "menu": [
    {"Show Again": "send:hint"},
    {"Disable Hints": "send:hints off"}
  ]
}

Spoilers vs Visibility

Feature Spoilers Visibility
Automatic background Yes (color-matched) No (manual styling)
Automatic tooltip Yes ("Click to reveal") No (manual config)
First-click behavior Reveal only Execute function
State persistence Per-instance N/A
Best for Hints, answers, secrets Temporary UI elements

Capability Detection

USERVAR OSC_HYPERLINKS_SPOILER = "1"

Disabled Links

Purpose

Display links that cannot execute their function when clicked. Useful for locked content, unavailable options, or reveal-only spoilers.

Mudlet VersionAvailable in Mudlet4.21+

How It Works

1. Link displays with optional disabled styling 2. Left-click does nothing (no function execution) 3. Right-click menus are blocked (completely non-interactive) 4. Can combine with spoilers for reveal-only behavior

Note Note: Disabled state is permanent. To re-enable, the server must send a new link.

Configuration

Property Type Description Default
disabled Boolean Prevent link function execution false

Styling

Use the disabled pseudo-class for visual feedback:

{
  "disabled": true,
  "style": {
    "color": "gray",
    "disabled": {
      "color": "darkgray",
      "strikethrough": true
    }
  }
}

Examples

Basic disabled link:

{"disabled": true}

Disabled with menu defined (menu blocked):

{
  "disabled": true,
  "menu": [
    {"Why locked?": "send:help locked"},
    {"Requirements": "send:requirements"}
  ],
  "tooltip": "Requires level 10 - menu blocked"
}

Note Note: Even though a menu is defined, it will not appear because the link is disabled. Use this pattern when you want to prepare menu options for when the link becomes enabled.

Disabled spoiler (reveal-only):

{"spoiler": true, "disabled": true}

Common Use Cases

  • Locked content - Options requiring prerequisites (completely non-interactive)
  • Unavailable actions - Choices that can't be taken currently
  • Cooldowns - Temporarily disabled abilities
  • Information display - Show options without any interaction
  • Reveal-only spoilers - Allow text reveal without triggering commands
  • Future-proofing - Define menus that will work when link is re-enabled

Capability Detection

USERVAR OSC_HYPERLINKS_DISABLED = "1"

Tier 5: Stateful Links

Selection

Purpose

Create interactive, toggleable links that maintain state—like radio buttons, checkboxes, reaction buttons, or voting systems.

Mudlet VersionAvailable in Mudlet4.21+

How It Works

  1. Links are organized into named groups
  2. Clicking toggles the selection state
  3. Visual style updates immediately via selected pseudo-class
  4. Server receives callback with &selected=true or &selected=false
  5. In exclusive mode, selecting one deselects others in the group

Selection Modes

Radio Button Mode ("exclusive": true, default):

  • Only one link per group can be selected
  • Selecting a new link deselects others
  • Use for: difficulty settings, class selection, single-choice options

Checkbox Mode ("exclusive": false):

  • Multiple links per group can be selected
  • Each toggles independently
  • Use for: reactions, multi-select filters, feature toggles

Configuration

Property Type Description Default
group String Required. Group identifier for related links
value String Required. Unique identifier within group
toggle Boolean Allow deselecting by clicking again true
selected Boolean Initial selection state false
exclusive Boolean Radio (true) vs checkbox (false) mode true
disabled Boolean Prevent selection changes false

Note Note: Selection state is per-console. Different windows maintain independent states.

Server Callback

When clicked, the URI is modified to include selection state:

  • Selecting: send:react?type=like&selected=true
  • Deselecting: send:react?type=like&selected=false

Styling

Use selected and disabled pseudo-classes:

{
  "selection": {"group": "reactions", "value": "like"},
  "style": {
    "color": "gray",
    "selected": {"color": "blue", "bold": true},
    "disabled": {"color": "darkgray", "strikethrough": true},
    "hover": {"color": "lightblue"}
  }
}

Examples

Social reactions (checkbox mode):

{
  "selection": {
    "group": "post_123_reactions",
    "value": "thumbs_up",
    "exclusive": false
  },
  "style": {
    "color": "gray",
    "selected": {"color": "blue", "bold": true}
  }
}

Difficulty selection (radio mode):

{
  "selection": {
    "group": "difficulty",
    "value": "hard",
    "exclusive": true
  },
  "style": {
    "bg": "gray",
    "selected": {"bg": "red", "bold": true}
  }
}

Pre-selected option:

{
  "selection": {
    "group": "combat_mode",
    "value": "aggressive",
    "selected": true
  }
}

Non-toggleable (must select different option):

{
  "selection": {
    "group": "thread_following",
    "value": "thread_456",
    "toggle": false
  }
}

Disabled option:

{
  "selection": {
    "group": "poll",
    "value": "sold_out",
    "disabled": true
  },
  "style": {
    "disabled": {"strikethrough": true}
  }
}

link management example

Capability Detection

USERVAR OSC_HYPERLINKS_SELECTION = "1"

Tier 6: Optimization

Compact Syntax

Purpose

Reduce JSON size by 30-80% using single-letter property abbreviations. Especially valuable when generating many styled links.

Mudlet VersionAvailable in Mudlet4.21+

How It Works

  1. Replace verbose property names with abbreviations
  2. Mudlet recognizes both forms
  3. Can mix shorthand and full names in same config
  4. No functionality difference—purely size optimization

Shorthand Mappings

Category Full Name Shorthand
Top-level style s
menu m
tooltip t
visibility v
selection sel
disabled d
spoiler sp
Style color c
bg bg
bold b
italic i
underline u
overline o
strikethrough st
text-decoration-color tdc
Pseudo-class hover h
active a
visited vi
focus f
focus-visible fv
link l
any-link al
selected sl
disabled ds

Examples

Full syntax (91 characters):

{"style": {"color": "red", "bold": true, "hover": {"color": "yellow"}}}

Shorthand syntax (54 characters):

{"s": {"c": "red", "b": true, "h": {"c": "yellow"}}}

Mixing formats:

{"s": {"c": "red"}, "tooltip": "Full name works too"}

When to Use

Use shorthand when:

  • Generating 10+ links per line
  • Network bandwidth constrained
  • Links generated programmatically

Use full names when:

  • One-off custom links
  • Readability is priority
  • Debugging configurations

Capability Detection

USERVAR OSC_HYPERLINKS_COMPACT = "1"

Presets

Purpose

Define commonly-used styles once, then reference them by name. Reduces repetition and centralizes style management.

Mudlet VersionAvailable in Mudlet4.21+

How It Works

  1. Define preset at connection time using preset: URI scheme
  2. Reference preset in links with ?preset=NAME
  3. Override preset properties with additional &config=
  4. Presets are session-scoped (cleared on disconnect)

Defining Presets

ESC ] 8 ; ; preset:NAME?config=JSON ESC \ ESC ] 8 ; ; ESC \

Note Note: Preset definitions have empty text between sequences—they only register the style.

Example definitions:

ESC ] 8 ; ; preset:btn?config={"s":{"bg":"green","c":"white","b":true}} ESC \ ESC ] 8 ; ; ESC \
ESC ] 8 ; ; preset:danger?config={"s":{"c":"red","b":true}} ESC \ ESC ] 8 ; ; ESC \

Using Presets

Simple usage:

send:attack?preset=danger

With property overrides:

send:attack?preset=btn&config=%7B%22t%22%3A%22Attack%22%7D

Deep Merge Behavior

Override config is deep-merged with preset (override wins):

Preset Override Result
{"s":{"c":"red","b":true}} {"s":{"c":"blue"}} {"s":{"c":"blue","b":true}}
{"s":{"c":"red"}} {"t":"Tooltip"} {"s":{"c":"red"},"t":"Tooltip"}

Size Comparison

Format Example Encoded Size Reduction
Full JSON {"style":{"color":"red","bold":true}} ~141 chars Baseline
Shorthand {"s":{"c":"red","b":true}} ~88 chars 38%
Preset ?preset=danger ~17 chars 88%

Note Note: Presets require initial definition overhead but pay off after 2-3 uses.

Capability Detection

USERVAR OSC_HYPERLINKS_PRESETS = "1"

Reference

Quick Reference: JSON Structure

{
  "style": {
    "color": "value",
    "bg": "value",
    "bold": true,
    "italic": true,
    "underline": true,
    "overline": true,
    "strikethrough": true,
    "text-decoration-color": "value",
    "hover": { /* same properties */ },
    "active": { /* same properties */ },
    "visited": { /* same properties */ },
    "selected": { /* same properties */ },
    "disabled": { /* same properties */ }
  },
  "tooltip": "Hover text",
  "menu": [
    {"Label": "scheme:command"},
    "-",
    {"Label2": "scheme:command2"}
  ],
  "visibility": {
    "action": "conceal",
    "delay": 5000,
    "expire": {
      "input": true,
      "prompt": true,
      "output": true,
      "outputDelay": 500
    },
    "wholeline": false
  },
  "selection": {
    "group": "group_name",
    "value": "unique_value",
    "toggle": true,
    "selected": false,
    "exclusive": true,
    "disabled": false
  },
  "spoiler": false,
  "disabled": false
}

Quick Reference: NEW-ENVIRON Variables

Tier Variable Feature
1 OSC_HYPERLINKS Basic protocol support
OSC_HYPERLINKS_SEND send: scheme
OSC_HYPERLINKS_PROMPT prompt: scheme
2 OSC_HYPERLINKS_STYLE_BASIC Colors, bold, italic, decorations
OSC_HYPERLINKS_STYLE_STATES Hover, active, visited states
3 OSC_HYPERLINKS_TOOLTIP Custom tooltips
OSC_HYPERLINKS_MENU Context menus
4 OSC_HYPERLINKS_VISIBILITY Auto-hide/reveal
OSC_HYPERLINKS_SPOILER Spoiler text
OSC_HYPERLINKS_DISABLED Non-clickable links
5 OSC_HYPERLINKS_SELECTION Stateful selection
6 OSC_HYPERLINKS_COMPACT Shorthand syntax
OSC_HYPERLINKS_PRESETS Style presets

Quick Reference: Shorthand Mappings

Full Short Full Short Full Short
style s color c hover h
menu m bg bg active a
tooltip t bold b visited d
visibility v italic i focus f
selection sel underline u selected sl
spoiler sp strikethrough st disabled ds

Security & Limitations

Trusted URI Schemes

Only these schemes are supported (others are rejected):

  • send:, prompt:
  • http:, https:, ftp:
  • preset: (for definitions only)

Limits

  • URL length: Maximum 8196 characters
  • Invalid JSON: Silently ignored (link still works without styling)
  • Multi-line visibility: Only single-line links support visibility management

Reserved Parameters

config and preset are reserved for Mudlet's extensions.

Workaround for web URLs: Percent-encode the parameter names:

https://example.com/?%63%6F%6E%66%69%67=value

Implementation Guidance

For Game Servers

Progressive Enhancement Strategy

Level 1: Basic Links

  • Detect OSC_HYPERLINKS=1
  • Use simple send:/prompt: schemes
  • Provide plain text fallbacks

Level 2: Visual Enhancement

  • Check OSC_HYPERLINKS_STYLE_BASIC=1
  • Add colors, bold, italic formatting
  • Use full JSON property names

Level 3: Interactive Features

  • Verify OSC_HYPERLINKS_STYLE_STATES=1
  • Add hover, active, visited effects

Level 4: Advanced Interactions

  • Check for MENU, TOOLTIP, VISIBILITY, SELECTION support
  • Implement context menus and dynamic visibility

Level 5: Optimization

  • Verify COMPACT and PRESETS support
  • Define presets at connection time
  • Use shorthand syntax for high-volume links

Decision Tree

OSC_HYPERLINKS support?
├─ NO → Use MXP, ANSI, or plain text
└─ YES → Use OSC 8 with detected feature level
    ├─ PRESETS? → Define presets, use ?preset=name
    ├─ COMPACT? → Use shorthand (s, c, m, etc.)
    └─ Otherwise → Use full JSON property names

For Client Developers

Implementation Levels

Level 1: Parse OSC 8 sequences, support send:/prompt:/http: schemes

Level 2: Parse JSON config, implement basic styling

Level 3: Implement pseudo-class states with priority

Level 4: Add menus, tooltips, visibility, selection managers

Level 5: Add shorthand expansion table

Level 6: Implement preset storage and deep merge

Key Implementation Notes

  • Presets are session-scoped (clear on disconnect)
  • Selection state is per-console (independent windows)
  • Visibility only works on single-line links
  • Spoiler background uses luminance formula: Y = 0.2126R + 0.7152G + 0.0722B

See Also

References

Events

New or revised events that Mudlet can raise to inform a profile about changes. See Mudlet-raised events for the existing ones.

sysLabelDeleted, PR #8387

Raised when a label is successfully deleted via deleteLabel() or Geyser's Label:delete() method. The event provides the name of the deleted label as an argument.

Note Note: This event is raised after the label has been marked for deletion but before Qt's event loop has completed the deletion. The label should be considered gone for practical purposes.

Mudlet VersionAvailable in Mudlet4.20+
Event arguments
  • event: The event name: "sysLabelDeleted"
  • labelName: The name of the label that was deleted
Example
-- Register an event handler for label deletion
function onLabelDeleted(event, labelName)
  cecho(f"<green>Label '{labelName}' has been deleted.\n")
  
  -- Clean up any references or related data
  if myLabelReferences[labelName] then
    myLabelReferences[labelName] = nil
  end
end

registerAnonymousEventHandler("sysLabelDeleted", onLabelDeleted)

-- Now when you delete a label, the handler will be called
createLabel("tempLabel", 50, 50, 100, 30, 1)
deleteLabel("tempLabel")
-- Output: Label 'tempLabel' has been deleted.

sysMiniConsoleDeleted, PR #8387

Raised when a miniconsole is successfully deleted via deleteMiniConsole() or Geyser's MiniConsole:delete() method. The event provides the name of the deleted miniconsole as an argument.

Note Note: This event is raised after the miniconsole has been marked for deletion but before Qt's event loop has completed the deletion. The miniconsole should be considered gone for practical purposes.

Mudlet VersionAvailable in Mudlet4.20+
Event arguments
  • event: The event name: "sysMiniConsoleDeleted"
  • miniConsoleName: The name of the miniconsole that was deleted
Example
-- Register an event handler for miniconsole deletion
function onMiniConsoleDeleted(event, miniConsoleName)
  cecho(f"<green>MiniConsole '{miniConsoleName}' has been deleted.\n")
  
  -- Stop any timers or processes that were sending data to this console
  if chatTimers[miniConsoleName] then
    killTimer(chatTimers[miniConsoleName])
    chatTimers[miniConsoleName] = nil
  end
end

registerAnonymousEventHandler("sysMiniConsoleDeleted", onMiniConsoleDeleted)

-- Now when you delete a miniconsole, the handler will be called
createMiniConsole("chatWindow", 10, 10, 300, 200)
deleteMiniConsole("chatWindow")
-- Output: MiniConsole 'chatWindow' has been deleted.

sysCommandLineDeleted, PR #8387

Raised when a command line is successfully deleted via deleteCommandLine() or Geyser's CommandLine:delete() method. The event provides the name of the deleted command line as an argument.

Note Note: This event is raised after the command line has been marked for deletion but before Qt's event loop has completed the deletion. The command line should be considered gone for practical purposes.

Note Note: The main command line cannot be deleted, so this event will never be raised for it.

Mudlet VersionAvailable in Mudlet4.20+
Event arguments
  • event: The event name: "sysCommandLineDeleted"
  • commandLineName: The name of the command line that was deleted
Example
-- Register an event handler for command line deletion
function onCommandLineDeleted(event, commandLineName)
  cecho(f"<green>Command line '{commandLineName}' has been deleted.\n")
  
  -- Clean up any command history or aliases specific to this command line
  if commandLineHistory[commandLineName] then
    commandLineHistory[commandLineName] = nil
  end
end

registerAnonymousEventHandler("sysCommandLineDeleted", onCommandLineDeleted)

-- Now when you delete a command line, the handler will be called
createCommandLine("customInput", 10, 400, 300, 30)
deleteCommandLine("customInput")
-- Output: Command line 'customInput' has been deleted.

sysScrollBoxDeleted, PR #8387

Raised when a scrollbox is successfully deleted via deleteScrollBox() or Geyser's ScrollBox:delete() method. The event provides the name of the deleted scrollbox as an argument.

Note Note: This event is raised after the scrollbox has been marked for deletion but before Qt's event loop has completed the deletion. The scrollbox should be considered gone for practical purposes.

Mudlet VersionAvailable in Mudlet4.20+
Event arguments
  • event: The event name: "sysScrollBoxDeleted"
  • scrollBoxName: The name of the scrollbox that was deleted
Example
-- Register an event handler for scrollbox deletion
function onScrollBoxDeleted(event, scrollBoxName)
  cecho(f"<green>ScrollBox '{scrollBoxName}' has been deleted.\n")
  
  -- Clean up any content tables or buffers
  if scrollBoxContent[scrollBoxName] then
    scrollBoxContent[scrollBoxName] = nil
  end
end

registerAnonymousEventHandler("sysScrollBoxDeleted", onScrollBoxDeleted)

-- Now when you delete a scrollbox, the handler will be called
createScrollBox("messageBox", 10, 10, 300, 400)
deleteScrollBox("messageBox")
-- Output: ScrollBox 'messageBox' has been deleted.

sysConsoleSizeChanged, PR #7870

This event is raised when the (scrollable part of) the main or a sub-console or a user-window changes in size. After the event name as the first argument (as is "standard") additional arguments contain:

  • the name (string) of the console involved ("main" for the main console)
  • the number of characters (em-space equivalents) wide the new size is
  • the number of lines tall the new size is
  • the number of characters taken up by a visible time stamp (will be 0 if this detail is not visible).
Mudlet VersionAvailable in Mudlet 4.20+

Note Note: pending, not yet available. See https://github.com/Mudlet/Mudlet/pull/7870

sysLoadEvent, PR #7726

Raised after Mudlet is done loading the profile, after all of the scripts, packages, and modules are installed. Note that when it does so, it also compiles and runs all scripts - which could be a good idea to initialize everything at once, but beware - scripts are also run when saved. Hence, hooking only on the sysLoadEvent would prevent multiple re-loads as you’re editing the script.

In 4.20.0 an extra boolean argument was provided which indicates whether the event is from loading a new profile (true) or after a call of the resetProfile() function (false).

Note Note: pending, not yet available. See https://github.com/Mudlet/Mudlet/pull/7726

sysMapWindowMousePressEvent, PR #6962

Raised when the mouse is left-clicked on the mapper window.

Mudlet VersionAvailable in Mudlet ?.??+

Note Note: pending, not yet available. See https://github.com/Mudlet/Mudlet/pull/6962

sysSettingChanged, PR #7476

This event is raised when a Preferences or Mudlet setting has changed. The first argument contains the setting that was changed, further arguments detail the change.

Currently implemented sysSettingChanged events are;

  • "main window font" - raised when the main window/console font has changed via API or Preferences window. Returns two additional arguments, the font family and the font size. e.g. {"main window font", "Times New Roman", 12 }
Mudlet VersionAvailable in Mudlet ?.??+

Note Note: pending, not yet available. See https://github.com/Mudlet/Mudlet/pull/7476

MudMaster Chat Protocol (MMCP) PR #7765

MMCP is a peer-to-peer protocol enabling out of band data to be sent to connected peers in the form of public or private chats, or general data.
See MMCP protocol documentation at: https://tintin.mudhalla.net/protocols/mmcp/
See https://wiki.mudlet.org/w/Notes_on_MMCP
Mudlet VersionAvailable in Mudlet ?.??+

Note Note: pending, not yet available. See https://github.com/Mudlet/Mudlet/pull/7765

Lua functions

  • Note for all functions using target as an argument, the argument can be the client chatname or ID of the client as seen in mmcp.displayClientList()

accept

mmcp.accept(target)
Accepts an incoming connection request.
Parameters
  • target:
  • Incoming client name or ID.

Note Note: pending, not yet available in initial MMCP release.

allowSnoop

mmcp.allowSnoop(target)
Toggles the Allow Snoop flag for a client, allowing them to initiate a snoop request which will forward them text you see from your game.
Parameters
  • target:
  • Client name or ID.

call

mmcp.call(host[, port])
Initiate an outgoing connection to another client.
Parameters
  • host:
  • IPv4 address or fully qualified domain name.
  • port:
  • (optional) Port to connect to. Default 4050.
Example
local host = "1.2.3.4"
local port = 4050

mmcp.call(host, port)
You should see the following message
[ CHAT ]  - Connecting to 1.2.3.4:4050...
[ CHAT ]  - Waiting for response from 1.2.3.4:4050...
[ CHAT ]  - Connection to ChatClient at 1.2.3.4:4050 accepted.

chatAll

mmcp.chatAll(message)
Sends a message to all connected clients.
Parameters
  • message:
  • The message to send.

This message will have the format of: <Name> chats to everybody, '<message>'

You will see the message: You chat to everybody, '<message>'

chatGroup

mmcp.chatGroup(group, message)
Sends a message to all clients in the specified group.
Parameters
  • group:
  • The group to send the message to.
  • message:
  • The message to send.

The message will have the format of: <Name> chats to the group, '<message>'

You will see the message: You chat to <<group>>, '<message>'

chatName

mmcp.chatName([name])
Sets or gets your current chat name visible to other clients.
Parameters
  • name:
  • (optional) The new chat name to use.
Returns
  • If no name is specified, this function will return your current chat name.

chatTo

mmcp.chatTo(target, message)
Sends a message to a specific client.
Parameters
  • target:
  • Client name or ID.
  • message:
  • The message to send.

The target client will see the message: <Name> chats to you, '<message>'

You will see the message: You chat to <target>, '<message>'

deny

mmcp.deny(target)
Denies an incoming connection request.
Parameters
  • target:
  • Client name or ID.

Note Note: pending, not yet available in initial MMCP release.

disconnect

mmcp.disconnect(target)
Disconnects a connected client.
Parameters
  • target:
  • Client name or ID

displayClientList

mmcp.displayClientList()
Displays a table showing information about connected and pending clients.
Example
mmcp.displayClientList()
You should see the following table
Id   Name                 Address              Port  Group           Flags    ChatClient
==== ==================== ==================== ===== =============== ======== ================
   1 ChatClient           1.2.3.4              4050                           Mudlet
==== ==================== ==================== ===== =============== ======== ================
Color Key: Connected  Pending
Flags:  F - Firewall,       I - Ignored,  P - Private,  S - Serving
        n - Allow Snooping, N - Being Snooped
  • You may then use the mmcp lua commands referencing the client by their ID (1) or name (ChatClient)

emoteAll

mmcp.emoteAll(message)
Sends an emote message to all connected clients.
Parameters
  • message:
  • The message to send.

Clients will see the message: <Name> <message>

If you have enabled the "Prefix emote messages" option, you will see: You emote to everyone: '<Name> <message>'

Otherwise you will see: <Name> <message>

getClientFlags

mmcp.getClientFlags(target)
Returns a string containing the client flags of a connected client.
Parameters
  • target:
  • Client name or ID.
Returns

This string is an 8 character string where letters in the following positions have meaning: "12345678"

  • 1: Reserved, blank
  • 2: Reserved, blank
  • 3: P if the connection is Private, otherwise blank
  • 4: I if the connection is Ignored, otherwise blank
  • 5: S if the client is being served, otherwise blank
  • 6: F if the client is firewalled, otherwise blank
  • 7: N if the client is snooping us, n if the client can snoop us, otherwise blank
  • 8: Reserved, blank

getClientList

clientInfo = mmcp.getClientList()
Returns a lua table containing the following information for each connected client.
Returns
  • id: The ID of the client
  • name: The chat name of the client.
  • host: The hostname or IP address of the client.
  • port: The port the client (check if this is the reported port or port they connected from)
  • version: The MUD client and version of the client
Example
local clientList = mmcp.getClientList()
The variable clientList will then contain
{ {
    host = "1.2.3.4",
    id = 1,
    name = "ChatClient",
    port = 4050,
    version = "Mudlet"
  } }

ignore

mmcp.ignore(target)
Toggles ignoring a client. You will not see chat messages from an ignored client.
Parameters
  • target:
  • Client name or ID.

peek

mmcp.peek(target)
Sends a request to the target client to peek at their connection list.
Parameters
  • target:
  • Client name or ID.

ping

mmcp.ping(target)
Sends a ping request to a client.
Parameters
  • target:
  • Client name or ID.

request

mmcp.request(target)
Sends a request to the target client to request and connect to their public connections.
Mudlet will attempt to connect to each of the hosts returned by this command.
Parameters
  • target:
  • Client name or ID.

sendSideChannel

mmcp.sendSideChannel(channel, message)
Sends an OOB (Out of band) message to all connected clients.
Parameters
  • channel:
  • The channel to send the message on.
  • message:
  • The message to send.

Note Note: This will only send to other Mudlet clients. Upon receipt of this message Mudlet will raise a sysMMCPSideChannelMessage containing the channel and message data.

Example
-- myStats populated by prompt trigger
local outStr = string.format("%s,%d,%d,%d,%d,%s",
  mmcp.chatName(), myStats.hp, myStats.maxHp, myStats.mana, myStats.maxMana, myStats.buffs)

mmcp.sendSideChannel("stats", outStr)

serve

mmcp.serve(target)
Toggles the serve flag for a client, this clients chat messages will be sent to all other connected clients.
Parameters
  • target:
  • Client name or ID.

setDoNotDisturb

mmcp.setDoNotDisturb(target)
Toggles the Do Not Disturb flag, any incoming connections will be automatically denied.

Note Note: pending, not yet available in initial MMCP release.

setGroup

mmcp.setGroup(target, group)
Assigns a client to a chat group.
Parameters
  • target:
  • Client name or ID.
  • group:
  • The group name.

Note Note: The group name is only visible to you.

setPrivate

mmcp.setPrivate(target)
Toggles the private flag for a client. Any clients set as private will not be listed in peek or connection requests.
Parameters
  • target:
  • Client name or ID.

snoop

mmcp.snoop(target)
Starts snooping a client. The target may first need to enable snooping on their client.
Parameters
  • target:
  • Client name or ID.

startServer

mmcp.startServer([port])
Starts accepting connections from clients.
Parameters
  • port:
  • (optional) Port to listen for incoming connections. Default 4050.

Note Note: pending, not yet available in initial MMCP release.

stopServer

mmcp.stopServer()
Stops accepting connections from clients.

Note Note: pending, not yet available in initial MMCP release.

Events

sysMMCPChatMessage

Raised when Mudlet receives an MMCP chat message from a client
Arguments
  • peerName:
  • Peer Name of the client
  • message:
  • Message content
Example putting MMCP messages into an EMCO window
function mmcpEventHandler(event, ...)
    -- trim whitespace
    local trimmedStr = arg[1]:match("^%s*(.-)%s*$")

    myEmcoWindow:decho("MMCP", ansi2decho(trimmedStr) .. "\n", false)
end

registerNamedEventHandler(getProfileName(), "MMCP", "sysMMCPMessage", "mmcpEventHandler")

sysMMCPSideChannelMessage

Raised when an MMCP side channel message has been received
Arguments
  • peerName:
  • Peer Name of the client
  • channel:
  • Channel identifier string
  • message:
  • Message content
Example
function VFrame.eventHandler(event, ...)
  if event == "gmcp.Char.Vitals" then

    VFrame.updateVitals()

  elseif event == "sysMMCPSideChannelMessage" then
    --display("event: " .. event .. " from: " .. arg[1] .. " channel: " .. arg[2] .. " message: " .. arg[3])
    if arg[2] == "stats" and myVFrame then -- check if its actually for us
      myVFrame:playerData(arg[3])
    end
  end
   
end

VFrame.registeredEvents = {
  registerAnonymousEventHandler("gmcp.Char.Vitals", "VFrame.eventHandler"),
  registerAnonymousEventHandler("sysMMCPSideChannelMessage", "VFrame.eventHandler"),
}

sysMMCPIncomingSnoopMessage

Raised when an MMCP client whom you are snooping has sent new snoop data
Arguments
  • peerName:
  • Peer Name of the client
  • message
  • Snoop content

sysMMCPPeerUpdateEvent

Raised when an MMCP client has been connected or disconnected
Arguments
  • peerName:
  • Chat name of the client

Security

Password Management, PR #7956, #7882

Starting with Mudlet 4.20.0, passwords are stored securely using your operating system's built-in credential manager.

How It Works

When you save a password in Mudlet (such as your game character password), it is automatically encrypted and stored in the most secure location available:

  • macOS: Stored in your macOS Keychain
  • Windows: Stored in Windows Credential Manager
  • Linux: Stored in your system's Secret Service (like GNOME Keyring or KWallet)
  • Portable Mode: Encrypted files in your Mudlet profile folder

Security Features

Your passwords are protected by:

  • System-level encryption - Your operating system handles the encryption using industry-standard methods
  • Per-profile isolation - Each Mudlet profile's passwords are kept separate
  • Automatic fallback - If the system keychain is unavailable, Mudlet uses AES-256 encrypted files
  • No plaintext storage - Passwords are never stored in readable form

What This Means for You

You don't need to do anything special
Mudlet handles password security automatically. Just enter your password when creating or editing a profile, and Mudlet takes care of the rest.
Your passwords are more secure
By using your operating system's credential manager, your passwords benefit from the same security that protects your system passwords and other sensitive data.
Portable installations still work
If you use Mudlet in portable mode (running from a USB drive, for example), passwords are stored as encrypted files that travel with your installation.
Multiple profiles are supported
Each profile's passwords are kept separate and secure, even if you have multiple characters on the same game.

Managing Your Passwords

Your passwords are automatically retrieved when you connect to a game. You can view or change them in the Connection Profiles dialog:

  1. Click the Connect button on the main toolbar (or press Alt+C)
  2. Select your profile from the list
  3. Click the Options tab
  4. Your password will be securely loaded from storage and can be edited here

You can also create new profiles with passwords directly from this dialog.

Technical Details

For users interested in the technical implementation:

  • Passwords in system keychains use the native encryption provided by your OS
  • File-based storage uses AES-256 encryption with PBKDF2-SHA256 key derivation
  • Each profile has a unique encryption key stored in its profile directory
  • HMAC authentication ensures password integrity
  • All password operations include timeout protection and error handling

Privacy

Your passwords are stored locally on your computer and are never transmitted to Mudlet's servers or any third party. The only time a password is sent over the network is when you connect to your game server (using the connection method you've chosen).

Password Masking Feature

Mudlet automatically masks your password with asterisks when you connect to a game server that requests authentication. This protects your password from being visible on screen.

Disabling Password Masking

For users in trusted environments who prefer to see what they're typing, during password entry you can find an icon in the shape of an eye on the right side of the command line to unmask the password, or you can disable permanently disable password masking:

  1. Open the Profile Preferences dialog (Settings menu)
  2. Go to the Input Line tab
  3. Check the Disable password masking checkbox

Using Older Mudlet Versions (Before 4.20)

Starting with Mudlet 4.20, your saved passwords are stored securely using encryption. If you later use an older version of Mudlet (like 4.19.1 or earlier), here's what to expect:

  • Your saved password may not appear – Older versions cannot read the new encrypted passwords, so the password field might be empty or show an outdated password.
  • Simply re-enter your password – Just type your password again and continue playing normally.
  • Your 4.20 passwords stay safe – Any password changes you make in an older version won't affect your encrypted passwords in 4.20+.
  • No data loss occurs – When you return to Mudlet 4.20 or later, your securely stored passwords will still be there.

This design ensures that using an older Mudlet version temporarily won't corrupt or interfere with your modern encrypted password storage.