Difference between revisions of "Variable"

From Castle Wiki
(remove old image)
(Change image order)
Line 1: Line 1:
[[File:Global variables.png|thumb|The global variables tab of the Tools panel]]
A variable is a method of saving a number value to be used later in an expression or as a parameter for a response. Variables can be used for accumulating player scores in a game, tracking player money and transactions, remembering properties of objects in a simulation deck, or can just be used as conveniently editable parameters which you can tweak later.
A variable is a method of saving a number value to be used later in an expression or as a parameter for a response. Variables can be used for accumulating player scores in a game, tracking player money and transactions, remembering properties of objects in a simulation deck, or can just be used as conveniently editable parameters which you can tweak later.


Line 8: Line 7:
Local variables are variables that are accessible by only the actor that owns it and its values cant be edited by other actors
Local variables are variables that are accessible by only the actor that owns it and its values cant be edited by other actors
====Global variables====
====Global variables====
[[File:Global variables.png|thumb|The global variables tab of the Tools panel]]
Global variables are variables that are accessed by all actors in all cards in the deck. Global variables have 2 possible lifetimes, 'deck play' and 'persistent per player'.
Global variables are variables that are accessed by all actors in all cards in the deck. Global variables have 2 possible lifetimes, 'deck play' and 'persistent per player'.



Revision as of 19:58, 10 May 2022

A variable is a method of saving a number value to be used later in an expression or as a parameter for a response. Variables can be used for accumulating player scores in a game, tracking player money and transactions, remembering properties of objects in a simulation deck, or can just be used as conveniently editable parameters which you can tweak later.

Variable types

Actor variables

The actor variables section of a blueprint

Local variables are variables that are accessible by only the actor that owns it and its values cant be edited by other actors

Global variables

The global variables tab of the Tools panel

Global variables are variables that are accessed by all actors in all cards in the deck. Global variables have 2 possible lifetimes, 'deck play' and 'persistent per player'.

Global variable lifetime

Deck play

Variables that have deck play lifetime have values that only last for one deck play before reseting to their initial value either by the player restarting the deck or leaving the deck and returning to it.

Persistent per player

Variables with 'persistent per player' lifetime save progress between deck plays. Leaving and returning to a deck with a persistent variable will preserve the value of the variable, as will restarting the deck.