P

PlayMUD.online

Triggers

Triggers

React to MUD output with commands and highlights.

Triggers are automation items that scan incoming text after ANSI codes are stripped. They can match simple text, exact lines, or regular expressions.

Where To Find Them

Open Automation and click Add Trigger. You can keep triggers at the root or move them into folders with drag and drop or the Move to selector.

If a parent folder is disabled, the trigger is effectively disabled even if the trigger's own checkbox is still on.

Trigger Fields

  • Enabled controls whether the trigger runs.
  • Name is used in test results and the Activity tab.
  • Pattern is the text or regex to match.
  • Kind can be contains, exact, or regex.
  • Command is submitted when the trigger fires.
  • Cooldown prevents repeated firing within the configured milliseconds.
  • Text and Bg color controls highlight matching terminal lines.

Regex Captures

Regex triggers can insert capture groups into commands.

Pattern: ^You receive (\d+) gold
Command: say I received $1 gold

Supported substitutions are $1, $2, and so on. $0 and $& mean the full match. $$ inserts a literal dollar sign.

Variables In Trigger Commands

Trigger commands are passed through the normal command expansion path, so they can use variables.

Command: kill {target}

The Activity tab shows the final expanded command sent to the active MUD server.

Pattern Performance

Regex patterns run in your browser. A complex pattern can take a long time on particular MUD output and make the client unresponsive, including when the pattern is used only for highlighting. Use contains or exact when those match types fit what you need.

Cooldown controls how often a trigger can fire; it does not limit the time spent matching its pattern. Lua script timeouts also do not cover regex matching in Lua triggers or Lua aliases.

Testing

The trigger tester lets you paste a sample MUD line and see which triggers match, what command would be produced, capture values, cooldown status, and invalid regex errors.

For Lua scripts, use Lua Triggers. For live debugging, use the Activity tab.