Guest Mode Play NowSign In
Documentation

Scripting, Packages & GMCP

Build triggers, aliases, timers, keybinds, and sandboxed JavaScript automations—or split chat cleanly into the Channels sidebar using GMCP or regex triggers.

1. Triggers, Aliases & Templates

Packages bundle your Triggers, Aliases, Timers, Keybinds, and Variables. Any send, speak, or chatChannel field supports template expansion:

$1 .. $9

Inserts regex capture groups from the matched trigger or alias pattern.

{{varName}}

Expands a package or session variable set manually or via setVar().

cmd1; cmd2

Semicolons in send templates split into sequential MUD commands.

2. Sandboxed JavaScript API

Scripts execute inside an isolated Web Worker with no DOM, cookie, or network access and a strict 250 ms timeout per run so infinite loops never freeze your terminal.

line / matchesMatched plain-text line and RegExp match array (matches[1] = first capture group).
send(cmd)Sends a command to the MUD (max 25 per script run).
echo(text, color?)Prints a local system line in the terminal (default #a78bfa).
chat(channel, text, talker?)Routes a structured message into the Chat & Channels sidebar.
playSound(preset?)Plays Web Audio alert: chime, bell, alert, sword, coin, or ping.
speak(text)Speaks text aloud via browser TTS (when enabled in settings).
getVar(name) / setVar(name, val)Reads and persists string variables on the active session & package.
gag() / highlight(hex)Flags the line as gagged or highlighted in the script result.

3. Example: DartMUD Improvement Counter

Tracks every skill improvement in DartMUD, echoes your running count, and adds #imps and #imps reset commands.

0 installs (0 unique)
Trigger Script — ^You think your (.+?) skill has improved\.
const skill = (matches[1] || 'unknown').trim().toLowerCase();
const total = (Number(getVar('imp_total')) || 0) + 1;
setVar('imp_total', String(total));

let counts = {};
try { counts = JSON.parse(getVar('imp_counts') || '{}'); } catch {}
counts[skill] = (counts[skill] || 0) + 1;
setVar('imp_counts', JSON.stringify(counts));

echo(`[Imp #${total}] ${skill}: ${counts[skill]}`, '#34d399');
Alias Script — ^#imps$
const total = Number(getVar('imp_total')) || 0;
let counts = {};
try { counts = JSON.parse(getVar('imp_counts') || '{}'); } catch {}
const entries = Object.entries(counts).sort((a, b) => b[1] - a[1]);

if (!entries.length) {
  echo('[Imps] No skill improvements recorded yet.', '#94a3b8');
} else {
  echo(`[Imps] Total: ${total}`, '#34d399');
  for (const [skill, n] of entries) {
    echo(`  - ${skill}: ${n}`, '#e2e8f0');
  }
}

4. Separating Chat from Main Content (GMCP & Triggers)

Click Chat in the /play toolbar to open the Channels sidebar—or install the starter pack in one click.

0 installs (0 unique)
Option A — Native GMCP (Comm.Channel.Text) Zero Config

mud-with-us advertises Comm 1 automatically. If your MUD emits Comm.Channel.Text, messages stream straight into the Chat panel while legacy telnet clients remain untouched:

Comm.Channel.Text {
  "channel": "ooc",
  "talker": "Karl",
  "text": "Anyone up for a run?"
}
Option B — Trigger / Script Routing Any MUD

Set Route to Chat channel on any trigger (and optionally check Gag to hide it from main scrollback), or call chat(channel, text, talker) in a script:

// Trigger regex: ^([A-Z][a-zA-Z]+) tells you: (.+)$
// Tip: check "Gag" to remove from main scrollback
chat('tells', matches[2], matches[1]);
playSound('ping');

5. Supported GMCP Packages

Char.Vitals / Char.Statshp, maxhp, mp/mana, maxmp/maxmana, moves, maxmovesStatus HUD bars
Char.Base / Char.Statusname, levelCharacter badge
Room.Infonum/id/vnum, name, zone/area, exitsAuto-Mapper
Comm.Channel.Textchannel, talker, textChat & Channels panel
mud-with-us • © 2026