Logic » Variables
April 26, 2026

Variables

Work in Progress

This documentation is still being expanded and refined. Features, screenshots, and descriptions may change until Talescape's public release. If something is unclear or you need help, please ask on the official Talescape Discord. We're happy to clarify or update pages as needed.

Variables store information about what has happened in your story and what the player has done. They allow the game to remember choices, track progress, control how the world reacts and optionally show important player facing stats.

Variables are the foundation of logic in Talescape. They are commonly used to control dialogue options, trigger events, unlock items or determine which scenes become available.

Variables can belong to the whole story, a chapter or a single scene. This keeps local state close to the place where it is used, while still allowing important values to remain available everywhere.

1. Creating Variables

Variables are created in the Variables panel. Each variable includes the following settings:

  • Name: A descriptive label used to identify the variable in the editor.
  • Type: Determines what kind of value the variable stores.
  • Scope: Determines whether the variable belongs to the story, a chapter or a scene.
  • Starting Value: The value assigned when the story begins.
  • Stat Settings (optional): Determines whether the variable should be shown to the player as a visible stat.

The starting value is optional. If no value is provided, the variable starts empty or at its default value.

2. Variable Scopes

A variable scope determines where the variable belongs and where it should normally be used.

  • Story: Use this for values that matter across the whole story, such as health, sanity, affection or a major choice that affects later chapters.
  • Chapter: Use this for values that only matter inside one chapter, such as the number of documents collected in that chapter.
  • Scene: Use this for local state inside one scene, such as whether a TV has been switched on.

Story variables match the previous behaviour. Chapter and scene variables help keep large projects easier to read because temporary switches no longer need to sit next to core story state.

3. Choice Variables

3. Choice Variables

Choice variables store a simple true or false value. They are used for yes or no decisions and are the most common type of variable.

Typical uses include:

  • Tracking whether the player performed a specific action.
  • Recording decisions made during dialogue.
  • Unlocking events or dialogue options.

Example uses:

  • Has the player opened the chest?
  • Did the player help the fisherman?
  • Is the cave entrance guarded?

Choice variables can be switched between true and false through actions or events.

4. Number Variables

4. Number Variables

Number variables store numeric values. They are useful when you need to track counts, scores or progression values.

Typical uses include:

  • Tracking collected resources
  • Counting how many times something happened
  • Managing currencies or points

Example uses:

  • How many keys does the player have?
  • How much money has been collected?
  • How many clues were discovered?

Number variables can be increased, decreased or set to a specific value during gameplay.

5. Text Variables

5. Text Variables

Text variables store short pieces of text. They are useful when you need to remember names, codes or selections made by the player.

Typical uses include:

  • Storing the player's chosen name
  • Recording which option was selected
  • Saving codes or identifiers

Example uses:

  • Player name
  • Selected faction
  • Entered door code

Text variables can be updated whenever a new value needs to be stored.

6. Calculated Variables

Calculated variables derive their value from an expression instead of holding one fixed value. The expression can use plain numbers or placeholders for other variables.

Supported operators are *, +, /, %, - and parentheses.

Calculated variables are useful for values such as damage after armor, a score made from several counters or a progress value based on collected items. They keep derived logic in one place instead of requiring several separate variable updates.

7. Variable Stats

7. Variable Stats

Variables can stay hidden as internal story logic or they can be marked as stats when the player should understand the current value during play.

Stats are useful for values such as:

  • health or stamina
  • sanity, suspicion or danger
  • relationship values
  • collected resources
  • chapter progress or puzzle progress

A stat can be displayed in different formats:

  • Text: Shows the value directly. Useful for names, labels, counters or values where exact wording matters.
  • Bar: Shows progress as a filled bar. Useful for health, stamina, sanity or other values with a clear minimum and maximum.
  • Segments: Shows progress as separate chunks. Useful for hearts, charges, clue progress or limited resources.

Only mark variables as stats when the player benefits from seeing them. Variables that only control hidden conditions, branching or internal story state can remain regular variables.

8. Variable Placeholders

Variables can be inserted into supported text fields as placeholders. When a text field supports placeholders, the editor shows a picker so you do not need to remember exact variable names.

This is useful for player names, collected item counts, selected factions, remembered answers or any other value that should appear in text.

The same picker is also available wherever conditions and actions need a variable value. This keeps variable reuse consistent across writing and logic.

9. Using Variables

Variables are used throughout the editor to control how the story behaves.

They can be used to:

  • Show or hide dialogue options
  • Activate triggers and events
  • Control branching story paths
  • Unlock scenes, items or interactions
  • Fill supported text fields with stored values
  • Calculate values from other variables

Whenever a variable changes, the new value is stored immediately and remains active for the rest of the playthrough.

10. Testing Variables

10. Testing Variables

During testing, you can open the Debug Menu to inspect and modify variables in real time.

This allows you to:

  • view all variables currently used in the story
  • change values to test alternate paths
  • reset variables to their starting values
  • verify scoped variables in the relevant scene or chapter

This makes it easier to test complex branching logic without replaying the entire story.

11. Best Practices

  • Use Choice variables for simple yes or no decisions.
  • Use Number variables for counters, resources or progress tracking.
  • Use Text variables only when you need to store actual text values.
  • Use Calculated variables for values derived from other variables.
  • Keep temporary state in scene or chapter variables when it does not matter everywhere.
  • Mark variables as stats only when the player should see that value during play.
  • Keep variable names descriptive so they remain easy to understand later.
  • Remove unused variables to keep your project organized.

Variables allow Talescape to remember what happened and react accordingly. They form the backbone of conditions, actions and every branching path in your story.