App triggers in VAM
Drive Timeline animations and atom storables from Voxta scenarios using the chat.appTrigger API.
App triggers let your Voxta scenario reach into the VAM scene and call any action or storable param on any atom. This is the primary way the AI side controls what happens in VAM beyond speaking.
For background on actions and scenarios in general, see Studio → App triggers. This page covers the VAM-specific recipes.
Invoking an action trigger
The most common case: play a Timeline animation when the AI decides to.
import { chat } from "@voxta";
export function trigger(e) {
// Play a Timeline animation on the Person atom
chat.appTrigger(
'Action', // trigger kind
'Person', // atom name
'plugin#2_VamTimeline.AtomPlugin', // storable id
'Play sit_down' // action name
);
}The plugin#N_... prefix on the storable id depends on the order plugins were added to the atom. Find the exact id in VAM's Edit Mode → atom → Plugins → Custom UI of the target plugin, where the storable name is shown.
Setting a storable param
Use this for non-action params: exposing material alpha, toggling a bool, changing a float.
import { chat } from "@voxta";
export function trigger(e) {
chat.appTrigger(
'Float', // type: String | StringChooser | Bool | Float | Color
'Cube', // atom
'Mat', // storable
'Alpha', // param name
0.5 // value
);
}Types you can pass:
| Type | Use for |
|---|---|
Action | Buttons / actions on a plugin (e.g. Play <animation> on Timeline). |
String | Text params. |
StringChooser | Dropdown selections. |
Bool | Toggles. |
Float | Numeric sliders. |
Color | Color pickers. |
Common recipes
Play a Timeline animation on action
import { chat } from "@voxta";
export function trigger(e) {
chat.appTrigger('Action', 'Person', 'plugin#2_VamTimeline.AtomPlugin', 'Play wave_hello');
}Fade a light by changing a float param
import { chat } from "@voxta";
export function trigger(e) {
chat.appTrigger('Float', 'InvisibleLight', 'Light', 'intensity', 0.2);
}Toggle a bool storable
import { chat } from "@voxta";
export function trigger(e) {
chat.appTrigger('Bool', 'Person', 'geometry', 'useAdvancedColliders', true);
}Play a saved motion clip
The Voxta plugin can play motion clips you already made, with no new generation. Make them with an animation service in the Animations playground and Download them as .json files.
Put the files in:
Saves\PluginData\Voxta\Animation\That path is inside your VAM folder. Subfolders aren't read. The file name without .json is the clip's name, so wave_hello.json is wave_hello.
The clip plays on the atom that has the Voxta plugin. Each play needs two steps on that plugin's storable, in order:
- Set
Animation File(aStringChooser) to the clip's name. - Invoke
Animation Play File(anAction).
import { chat } from "@voxta";
export function trigger(e) {
chat.appTrigger('Bool', 'Person', 'plugin#0_Voxta', 'Animation Loop', false);
chat.appTrigger('StringChooser', 'Person', 'plugin#0_Voxta', 'Animation File', 'wave_hello');
chat.appTrigger('Action', 'Person', 'plugin#0_Voxta', 'Animation Play File');
}Animation Loop is on by default. Turn it off, as in the first line, if the clip should play once.
You can also set these up as regular VAM triggers, in the same order. The Animation File dropdown lists the clips found when the plugin loaded. If you add files while VAM is running, press Refresh files on the plugin's Animate tab.
Needs a Voxta plugin newer than 2.0.10. As with Timeline, check the exact plugin#N_ id in the atom's plugin list.
Sending events from VAM back to Voxta
App triggers go AI → VAM. To go VAM → AI, use the plugin's TriggerMessage storable to send chat commands:
/event {{ user }} touched {{ char }}'s shoulder: inject a narrative event the AI will respond to./trigger my_event_name: fire a specific event by name (must match an Event in your scenario).
This is how you make in-scene interactions (a button press, a collider trigger, an animation finishing) feed back into the conversation.