Repository navigation
Trigger Watcher Settings
Runs your Lich triggers: when the game shows a line you've defined, it sends the responses you've defined. Responses can be plain game commands, or trigger commands that run scripts, set UserVars, log to a file or window, pause, run Ruby, or branch with if/else.
This page covers trigger-watcher's settings and behavior. For a walkthrough of writing triggers, with more examples, see Lich Triggers.
Put a lich_triggers: block in Charname-setup.yaml, or in a separate Charname-triggers.yaml. It can also go in an include file.
Use one place only. The lich_triggers block doesn't combine across files. The triggers file's block replaces the one in your setup file, and your setup file's replaces one in an include.
lich_triggers:
wave_hello:
triggers:
- Bobafett just arrived
- Hansolo just arrived
responses:
- wave
use_with_scripts:
- afk
no_use_scripts:
- combat-trainer| Setting | Purpose |
|---|---|
| trigger name | Any name you like (wave_hello above). |
| triggers | Lines of game output to watch for. Any one of them fires the trigger. |
| responses | What to do, in order. A plain line is sent to the game as a command; a line starting with = is a trigger command (below). A trigger with no responses does nothing. |
| use_with_scripts | Optional. Only fire while at least one of these scripts is running. |
| no_use_scripts | Optional. Never fire while any of these scripts is running. This wins over use_with_scripts. |
Each triggers line is a case-insensitive regular expression, matched anywhere in the line. Bobafett just arrived also matches "bobafett just arrived" and longer lines that contain it. Characters like . ? ( ) [ * and + have special meanings, so put a \ before them when you mean the character itself. Wrap the line in single quotes if YAML complains.
Wrap everything after a trigger command in curly braces, with one space after the command: =exec {buff}. A command line without its braces stops trigger-watcher completely when that trigger fires. Only =reload takes no braces.
| Command | Example | What it does |
|---|---|---|
=exec |
=exec {buff combat} |
Starts a script, with arguments, and carries straight on. |
=execw |
=execw {buff combat} |
Starts a script and waits for it to finish before the next response. |
=eval |
=eval {DRC.message("hello")} |
Runs the text as Lich/Ruby code. |
=uvar |
=uvar {set MyVar 22}=uvar {delete MyVar}
|
Sets or deletes a UserVar. Put Ruby in an inner pair of braces to set the result, for example =uvar {set Count {UserVars.Count.to_i + 1}}. |
=logf |
=logf {mylog Saw $1} |
Appends a timestamped line to mylog.txt. Ruby in inner braces is run first. |
=logw |
=logw {mywindow Saw $1} |
Writes a bold line to a window with that name, creating the window if needed. Ruby in inner braces is run first. |
=pause |
=pause {10} |
Waits that many seconds before the next response. Decimals such as 2.5 work. |
=if / =elsif / =else
|
=if {3 > 2} {DRC.message("yes")} =else {DRC.message("no")} |
Checks the Ruby condition in the first braces and runs the Ruby in the braces after it. You can have several =elsifs, and several actions for each. They can't be nested. |
=reload |
=reload |
Re-reads your lich_triggers without restarting the script, and lists what changed. |
-
=pauseneeds a plain number of seconds. Anything else, such as=pause {5 seconds}or a UserVar that isn't set, is skipped with a message, and the next response runs straight away. -
=logfand=logwstop trigger-watcher if the text contains}}. Only simple code, in a single pair of inner braces, is supported. -
=logfwrites the text inside brackets and quotes, for example2026-10-04 01:23pm ["Saw a thing"]. The file is created relative to the folder Lich runs from. -
=execand=execwsplit the arguments on spaces, so an argument can't contain a space.
Before the responses run, it fills these in:
-
$1to$9: the matching capture group from yourtriggersregex, for exampleYou are (.*) years oldwithsay I am $1.$0is the whole matched text. If the group doesn't exist, it warns you and leaves$1as it is. -
$name: the value of the UserVarname. The name must start with a letter and be at least two characters long. If the UserVar isn't set, it warns you and leaves the text alone.
Every $word in a response is treated as a UserVar, including inside =eval code. If a UserVar happens to share the name of a Ruby $global you use, its value is put in instead.
There are no settings for these; this is what to expect.
- Checks
use_with_scriptsandno_use_scripts. If they rule the trigger out, it does nothing. - Fills in substitutions and works through the responses in order. Plain commands wait for roundtime after each one.
- Resets the trigger, ready for the next time. That happens even if the scripts check ruled it out.
| Argument | Purpose |
|---|---|
| debug | Show detailed messages about every trigger and response. |
You can also turn on debug output with ;e UserVars.trigger_watcher_debug = true.
;trigger-watcher
;trigger-watcher debug
Leave it running. To have it start every time you log in, add it to your Lich autostart. After editing your triggers, fire a trigger that uses =reload, or restart the script.