manual:automations:triggers-and-hotkeys

Create triggers and hotkeys

Triggers react to MUD text. Hotkeys react to the keyboard. Both can send plain commands without a script.

Create a trigger

This trigger sends eat bread when the MUD prints exactly You are hungry.

  1. Open Automations and choose Create trigger.
  2. Set Name to eat-when-hungry.
  3. Leave the first pattern type on Match.
  4. Enter ^You are hungry\.$ as the pattern. The backslash makes the period literal.
  5. Enter You are hungry. in Test against a line. The pattern's status dot should show a match.
  6. Leave Behavior on Send as text and enter eat bread in Script.
  7. Choose Create trigger.

A trigger with a precise hunger pattern, successful test line, and eat bread action

Test while watching the session. Disable the trigger if the MUD uses the same sentence in room descriptions, help text, or player messages.

Use several pattern rows

Add a Match row when another pattern may start the same trigger. Add an Anti-match row to prevent firing on a line that also contains an unwanted form. Raw regex matches the unprocessed incoming line, including escape codes and control bytes. Color and text-attribute requirements belong in a normal Match or Anti-match row.

A prompt may arrive without a newline. Saved triggers created in the window match completed lines; a script author can opt a script-created trigger into prompt matching. Use that option only for a pattern deliberately written for prompts, because it can run more often than a line trigger.

Captured text works in a plain action just as it does for an alias. For ^You receive (\d+) gold\.$, an action can refer to the amount as $1.

Require a color or attribute

Each Match or Anti-match row can require terminal formatting as well as text:

  1. Turn on Match color beneath the row.
  2. Select Foreground or Background. Choose Any when that channel should not restrict the row.
  3. Choose ANSI, Xterm 256, Truecolor, or Color Range, then select or enter the color.
  4. Select every Required attribute the text must carry. Foreground, background, and all selected attributes must qualify together.

The color is checked at the first displayed character of each matching occurrence. For example, a row for ^Warning: checks the color of the W. If a later occurrence of the same text has the required color, that later occurrence can qualify.

Leaving the row's text blank makes it color-only: any nonempty run with the selected color and attributes qualifies. A blank row with no color requirement remains inactive.

Expand Try it on a line the game sent to test formatting. In this field, \e stands for the escape byte. \e[31mWarning: simulates normal ANSI red; \e[91mWarning: simulates bright ANSI red. The row's status dot reports whether both its text and formatting qualify.

For Color Range, enter six-digit hexadecimal colors under From and To. The range includes colors whose hue, vividness, and brightness all fall within the endpoint limits. Hue moves forward around the color wheel from From to To and crosses 0° when To has the lower hue. Reversing the endpoints can select a different arc. A range checks truecolor and xterm palette slots 16 through 255; use ANSI for one of the 16 ANSI slots.

The equivalent scripting forms are covered in Match colors in scripted triggers.

Create a hotkey

  1. Choose Create hotkey.
  2. Give it a name such as move-north.
  3. Click Shortcut, then press the key combination.
  4. Leave Behavior on Send as text.
  5. Enter north in Script, then choose Create hotkey.

A text hotkey named move-north with its shortcut and north action

Choose combinations that do not conflict with text editing, operating-system shortcuts, or accessibility tools. A hotkey belongs to its session; it fires when an input owned by that session has focus.

Stop an automation quickly

Open Automations and turn off the item's enabled switch. If a trigger is sending too quickly to work safely, disconnect first, open the profile offline, and disable or repair it there.