Skip to Content
Editor GuideVariables

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 — text
    • int — whole numbers
    • float — decimal numbers
    • bool — 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:

TypeStarts at
int0
float0
boolfalse
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:

BlockWhat it does with variables
TextCan display a variable’s value inside its text — see below.
User InputSaves the player’s typed answer into a variable (save_to); can also display variables in its prompt/hint.
Set Variable ValueSets a variable to a fixed value.
Change Variable ValueAdds/subtracts a number from an int/float variable.
Variable RouterBranches 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:

  1. Create an int variable named trust.
  2. Whenever the player makes a kind choice, connect it to a Change Variable Value block with variable_name = trust and delta = 1.
  3. Later in the story, add a Variable Router on trust with a > 5 branch (friendly ending) and an Otherwise branch (neutral ending, catch-all) to send the player down a different path based on how they played.
  4. Anywhere else in the story, write Your trust level is {{trust}}. to show the player their current score.

Variables — Skaz Docs