Variables
A variable is a named value that the game remembers: how many marks an actor holds, how healthy they are, whether a scheme’s guard was bribed. Nodes read and change variables, texts print them, and conditions compare them.
The demo game has a variable called Marks, an Integer. Each actor holds their own, it starts at 0, and it is limited to 0 and 100000. Its description reads Silver marks an actor holds.
Who holds a value
Section titled “Who holds a value”Every variable has a Belongs To setting, which says who holds a value of that variable.
| Belongs To | Who holds the value |
|---|---|
| World | One value for the whole game. |
| Each Actor | Each actor holds its own value. |
| Each Clan | Each clan holds its own value. |
| Each Family | Each family holds its own value. |
| Each Relationship | Each actor holds a value toward every other actor, such as trust. |
| This Scheme | One value for each run of a scheme. The variable belongs to its scheme. |
The first five are variables of the world, kept in the database. This Scheme variables are kept in the settings of one scheme. A new world variable starts as Each Actor.
A scheme variable holds one value for each run of the scheme, and every flow of that run reads the same value. Two runs of the same scheme have their own.
Every scheme also has one variable you do not make: Accomplices, a list of the actors who help the conspirator in that run. See Schemes.
What kind of value
Section titled “What kind of value”| Type | What it holds |
|---|---|
| Text | Text. |
| Integer | A whole number. |
| Float | A number with decimals. |
| Bool | True or false. |
| Enum | One of a list of named options. |
| Actor | An actor. |
| Clan | A clan. |
| Family | A family. |
| Actor List | Actors in order, each one once, such as Accomplices, Lookouts or Friends. |
| Asset | A Unity asset: a sprite, an audio clip, a prefab. |
An Actor List always starts empty. Nodes and code fill it. It can belong to the world, to each actor, clan or family, and to a scheme, but not to Each Relationship.
An Actor variable of a scheme is how a scheme remembers a person it found. See Who a node acts on.
Where a value starts
Section titled “Where a value starts”A variable has a start value that every holder begins with. Text and Actor, Clan and Family variables start with the text or the entry you chose. Integer and Float start with a number, a Bool with true or false, an Enum with one of its options.
You can limit a number to a lowest and a highest value, and a write is kept within them. The demo variable Health is limited to 0 and 100, and starts at 80.
An Enum starts with one of its options. A relationship value that was never written reads the default. An actor can start with another value than the variable’s default; those start values are used for a new game, and a loaded save does not apply them again.
Named levels
Section titled “Named levels”An Integer or Float can have named levels. Each level has a name and the lowest value that belongs to it. A value at or above that number, and below the next level, is at this level. Health in the demo has four: Dying from 0, Poor from 20, Good from 50 and Hale from 80. Conditions can test the level, and texts can print its name.
A mark for personality
Section titled “A mark for personality”A number that belongs to each actor can be marked as a personality value. The Studio then shows it as a bar with two end words, such as Generous and Greedy. This is only a display mark: traits, ties and ambitions can change any number of an actor, marked or not, and nothing at run time treats a marked variable differently. See Characters that think.
Using a variable
Section titled “Using a variable”Nodes pick a variable from a list: Set Variable changes one or several, one after another, Compare Variable compares one with a value or with another variable, and Branch By Value takes a different way for each value of one text, whole number, yes/no or named choice. A dialogue choice can change any variable too, with Change any variable. Texts read values with tokens such as {target.Gold}. See Texts, tokens and pacing.
Game code reads a value by name too.
Who sees a value
Section titled “Who sees a value”The Who Sees It setting matters only in a multiplayer game. Everyone, the default, lets every player see the values. Owner only shows a value only to the players whose actors hold it: that actor, or the members of that clan or family. A World value set so is seen by nobody. Host only keeps it for game logic. A player who may not see a value reads it as its default. In a single-player game nothing changes.
Try it with Claude
Section titled “Try it with Claude”Add an Integer variable called Marks that each actor holds. It starts at 0 and stays between 0 and 100000.
Where to go next
Section titled “Where to go next”Variables are listed in the Library of the Schemes page, in the tabs Scheme and World. See The Schemes page and Library. The actors that hold most variables are in Actors. For how nodes change them while a scheme runs, see How a scheme runs.