-
Notifications
You must be signed in to change notification settings - Fork 177
Lich Triggers
The concept of triggers is that Lich will respond automatically to certain game output without the need to run a separate script. Historically, the ability to set triggers is a function of the Front End being used. Lich-based triggers are front-end agnostic and built within Lich itself. Thus, they can be used across and between front ends.
Lich's triggers are defined by the user in a yaml file along with the desired trigger responses. Triggers are then monitored for and acted upon with a persistent companion script called trigger-watcher
. Fundamentally, Lich's triggers use class Flags
which is defined in the events
script and at a basic level monitor for certain defined game output. In order for Lich triggers to work, triggers must be defined properly in the yaml, and both the events
and trigger-watcher
script must stay running.
The structure of each trigger is as follows:
- The name of this specific trigger. This is arbitrary -- name it what you want.
- Beneath that and indented, a section called
triggers:
. This represents the game output you want the trigger to look for and then take action. - Beneath that and indented, a section claled
response:
. When Lich sees the output you defined in thetriggers
section, it will process these trigger responses.
Let's look at an extremely simple trigger.
# LICH TRIGGERS
# Yaml for Lich-based triggers
wave_hello:
triggers:
- Bobafett just arrived
responses:
- wave Bobafett
This trigger recognizes when a character named Bobafett enters the room, and it waves to them. What's happening behind the scenes is that Lich is watching all game output lines for Bobafett just arrived
. When it sees that, it takes the action you've defined in responses
and it will send wave Bobafett
as a game input command.