trigger
ARES System Manual: Triggers

Triggers allow the unit to react to specific verbal commands issued in local chat by automatically executing system commands. Each trigger must be defined separately in the trigger database section.

In Companion and Clockwork, triggers were called reactions.


Creating Triggers

To create a trigger, use the db command:

db set trigger.<name> <action>

Trigger actions are fully preset: they do not accept arguments. However, the syntax exec <...> can be used to allow other forms of environment variable substitution (see input), for example:

    db set trigger.greet_me exec say Hello, \$user!

...will cause the unit to say 'Hello, <name>!' when triggered. (Be mindful of the backslash before the $ sign: otherwise variable substitution will occur immediately when creating the trigger, substituting *your* name instead.)

Underscores in <name> correspond to spaces in the verbal command. Triggers must be defined with lower-case names.


Triggering Triggers

First, make sure the trigger subservice is started:

(input) @service baseband start trigger

Thereafter, anyone other than the unit may speak:

    <prefix>: <action>

For example, 'dolly: go home' will instruct a unit named 'Dolly' to run the command stored in trigger.go_home, if it is defined. The colon in the example above may be replaced with a comma or omitted entirely.

When invoking a trigger, the command is case-insensitive.

Only users with the 'local' permission (see rules) may activate triggers.

The trigger prefix is specified by the baseband.trigger-prefix database setting. If undefined, the unit's name (id.name) will be cached. In case of a name change, you must restart the trigger subservice manually to update the trigger prefix.


Example Triggers

    db set trigger.greet_me exec say Hello, \$user!
    db set trigger.go_home nav tp home (make sure you create a 'home' bookmark first)
    db set trigger.sleep power off
    db set trigger.be_normal persona default
    db set trigger.initiate_self_destruct exec detonate (device commands must be routed through exec in this manner)