Voxta docs

Templates

The Scriban variables and functions available in character, scenario and prompt fields.

Most dynamic fields — character descriptions, scenario text, contexts, button labels, bootstrap messages — accept Scriban templates.

For the language itself, see the Scriban reference. This page covers the Voxta-specific variables and functions.

{{ user }} and {{ char }} finally arrive at the designated location.
{{~ if has_flag "night" ~}}
It is dark; they have no idea where the box is.
{{~ else ~}}
It is daylight; they can clearly see the box.
{{~ end ~}}

Not every field sees every variable. Character fields get the character ones; scenario fields see everything. The prompt preview shows what actually resolved.

The user

VariableTypeNotes
usertextThe user's name, or the impersonated name.
user_descriptiontextThe user's profile description. Empty when the user isn't in the chat.

The character

Refers to the character the prompt is being built for, not always the first role.

VariableTypeNotes
chartextTheir name.
char_descriptiontextTheir appearance.
char_personalitytextTheir personality.
char_profiletextTheir profile.
char_message_examplestextTheir message examples.
characterobjectThe same, as an object: id, name, tags, description, personality, profile.
langtextTwo-letter language code from the character's culture.

Everyone in the chat

VariableTypeNotes
charstext[]Every character's name.
charactersobject[]Every character object.
other_charstext[]Every name except the current character's.
other_charactersobject[]Every object except the current character's.

The scenario

VariableTypeNotes
scenariotextThe rendered scenario text.
scenario_charsmapNames by role: scenario_chars.main.
scenario_charactersmapObjects by role: scenario_characters.main.id.
chat_flowtextChat or Story.
chat_styletextCompanion, Roleplay, Storytelling, Assistant.
explicitbooleanTrue when explicit content is allowed or encouraged.
explicitLeveltextProhibited, NotSpecified, Allowed or Encouraged.

State

VariableTypeNotes
flagstext[]Every flag currently set.
variables.nameanyA chat variable set from a script or a control.
contexttext[]The contexts resolved for this turn.
visiontextWhat the vision service last described, if any.
nowtextDate and time in the character's culture. Empty unless the character is time aware.
last_functionobjectThe last action invoked: name, signature, short, timestamp. Only set when the action has a short description.

now is floored to 15-minute buckets on purpose. It sits above the whole conversation in the prompt, so a minute-accurate clock would invalidate prompt caching on every tick.

Functions

FunctionReturnsNotes
has_flag "name"booleanWhether that flag is set.
char_has_tag "name"booleanWhether the current character has that tag. Case-insensitive.

Patterns

Conditional description

{{ char }} is a tall woman in her late twenties.
{{~ if has_flag "is_drenched" ~}}
She is completely soaked from the rain.
{{~ end ~}}

Live values on a button

Bribe the guard ({{ variables.bribe_cost }}g)
{{ if variables.gold >= 50 }}Bribe{{ else }}Too poor{{ end }}

List the variables under Watched variables so the label re-renders when they change.

Tag-based branching

{{~ if char_has_tag "detective" ~}}
{{ char }} carries a worn notebook and a magnifying glass.
{{~ end ~}}

Multi-character introduction

Tonight, {{ char }} is meeting {{ scenario_chars.guest }} for the first time.

Whitespace

{{~ ... ~}} trims the whitespace around the directive, so a conditional block doesn't leave a blank line behind. Worth using on nearly every if / else / end.

What's next

On this page