Most dynamic fields, such as a character’s profile or a scenario, can contain replacements and conditions. The syntax uses Scriban, a templating language that allows you to create complex expressions and conditions.
Here is an example of what you can do:
{{ user }} and {{ char }} finally arrive to the designated location.
{{~ if has_flag "night" ~}}
It was dark, they had no idea where the box was.
{{~ else ~}}
It was day, they could clearly see the box.
{{~ end ~}}
No all fields are supported in all contexts.
Template | Type | Description |
---|---|---|
user |
text |
The user’s name |
user_description |
text |
The user’s description |
char |
text |
The main character’s name |
char_description |
text |
The main character’s appearance |
char_personality |
text |
The main character’s personality |
char_profile |
text |
The main character’s profile |
char_has_tag "tag_name" |
function |
Check whether the character has a given tag on it |
explicit |
boolean |
If the scenario or one character is marked as explicit |
now |
text |
The date and time (if the character is time aware and the scenario is not roleplay) formatted in the character’s culture |
last_function_call |
ActionInvocation |
The last action that was invoked. Has name , signature , short and timestamp (relative) properties. |
character |
Character |
The main character. Has id , name , tags , description , personality and profile . |
chars |
string[] |
All character names in the scenario. |
characters |
Character[] |
All characters in the scenario. |
other_chars |
string[] |
All character names in the scenario except the main one. |
other_characters |
Character[] |
All characters in the scenario except the main one. |
scenario |
string |
The scenario text. |
scenario_chars |
{ [role: string]: string } |
Character names by role. For example, scenario_chars.main . |
scenario_characters |
{ [role: string]: Character } |
Characters by role. For example, scenario_characters.main.id . |
has_flag "flag_name" |
function |
Check whether the chat has a given flag on it |
variables.variable_name |
function |
Get a chat variable for printing or conditions, see scripting |
context |
string[] |
The list of all resolved contexts |
chat_flow |
string |
The chat flow, e.g. Story or Chat . |
chat_style |
string |
The style of chat, e.g. Companion , Storytelling , Roleplay , Assistant . |