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
| Variable | Type | Notes |
|---|---|---|
user | text | The user's name, or the impersonated name. |
user_description | text | The 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.
| Variable | Type | Notes |
|---|---|---|
char | text | Their name. |
char_description | text | Their appearance. |
char_personality | text | Their personality. |
char_profile | text | Their profile. |
char_message_examples | text | Their message examples. |
character | object | The same, as an object: id, name, tags, description, personality, profile. |
lang | text | Two-letter language code from the character's culture. |
Everyone in the chat
| Variable | Type | Notes |
|---|---|---|
chars | text[] | Every character's name. |
characters | object[] | Every character object. |
other_chars | text[] | Every name except the current character's. |
other_characters | object[] | Every object except the current character's. |
The scenario
| Variable | Type | Notes |
|---|---|---|
scenario | text | The rendered scenario text. |
scenario_chars | map | Names by role: scenario_chars.main. |
scenario_characters | map | Objects by role: scenario_characters.main.id. |
chat_flow | text | Chat or Story. |
chat_style | text | Companion, Roleplay, Storytelling, Assistant. |
explicit | boolean | True when explicit content is allowed or encouraged. |
explicitLevel | text | Prohibited, NotSpecified, Allowed or Encouraged. |
State
| Variable | Type | Notes |
|---|---|---|
flags | text[] | Every flag currently set. |
variables.name | any | A chat variable set from a script or a control. |
context | text[] | The contexts resolved for this turn. |
vision | text | What the vision service last described, if any. |
now | text | Date and time in the character's culture. Empty unless the character is time aware. |
last_function | object | The 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
| Function | Returns | Notes |
|---|---|---|
has_flag "name" | boolean | Whether that flag is set. |
char_has_tag "name" | boolean | Whether 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.