Variables
Variables are named values that your story remembers as the player plays through it — they’re the “memory” of your story, used to track state and steer the player down different paths.
Creating variables
Open the Variables tab in the right-hand panel. Click + Create variable to add a new one, then set its:
- Name — used to reference the variable from blocks.
- Type — one of:
string— textint— whole numbersfloat— decimal numbersbool— true/false
Click the trash icon next to a variable to delete it.
Starting values
You don’t set a starting value when you create a variable — every variable begins each playthrough at its type’s default, so it’s always safe to read or change one even before you’ve explicitly set it:
| Type | Starts at |
|---|---|
int | 0 |
float | 0 |
bool | false |
string | "" (empty text) |
So a score counter starts at 0 and you can add to it right away; a bool
flag like has_key starts false until something sets it true. If you want
a different starting value, put a Set Variable Value
block right after your starting block to initialize it.
Every player who starts your story gets their own private copy of these variables. They all begin at the defaults above and change independently as each person plays — one reader’s choices never affect another’s.
Reading and writing variables
Variables are used by all of the blocks:
| Block | What it does with variables |
|---|---|
| Text | Can display a variable’s value inside its text — see below. |
| User Input | Saves the player’s typed answer into a variable (save_to); can also display variables in its prompt/hint. |
| Set Variable Value | Sets a variable to a fixed value. |
| Change Variable Value | Adds/subtracts a number from an int/float variable. |
| Variable Router | Branches the story based on a variable’s current value. See Variable Router conditions. |
Displaying variables in text
To show a variable’s current value to the player, wrap its name in double
curly braces: {{variable_name}}. You can use this inside a
Text block’s text, or a
User Input block’s prompt/hint.
For example, if a string variable named name holds "Alex", the text:
Hello, {{name}}!is shown to the player as:
Hello, Alex!While editing, the placeholder is highlighted blue if the variable exists, or
red if it doesn’t (likely a typo). If the variable doesn’t exist at all when
the story is played, the placeholder is replaced with
[variable name is not found].
Example
A simple “trust” system:
- Create an
intvariable namedtrust. - Whenever the player makes a kind choice, connect it to a
Change Variable Value block with
variable_name = trustanddelta = 1. - Later in the story, add a Variable Router
on
trustwith a> 5branch (friendly ending) and an Otherwise branch (neutral ending, catch-all) to send the player down a different path based on how they played. - Anywhere else in the story, write
Your trust level is {{trust}}.to show the player their current score.