Token State
A token state is a binary (i.e., it has two possible values, 1 or 0) condition that is set for a given token. States are frequently used for conditions or statuses that affect a particular character in a game (for example "Bloodied" or "Fatigued" or "Fighting Defensively").
Setting Up Token States
States are configured by the user and are specific to a given campaign. States are configured via the Campaign Properties window, under the States tab. See Configuring States for details on setting up states for your campaign.
Getting Token States with Macros
States are special variables that can be referenced by macros using the general format state.statename where statename is the name configured by the user for a given state.
Examples
States can be retrieved programmatically.
[h:isBloodied=state.Bloodied]
[isBloodied]
Will return 0 if state.Bloodied is off (in other words, the token is not Bloodied), and 1 if state.Bloodied is on.
Setting Token States with Macros
States can also be set programmatically, by assigning a value of 1 or 0 to the token state.
Examples
Suppose we want to check to see if a token is "dead" and if so, set the "Dead" state on that token. We are assuming two things:
- "Death" occurs if the token's hit points (HP) have been reduced to 0 or below; and
- A state called "Dead" has been configured in the Campaign Properties.
To check for "death" and, if required, set the appropriate state, we write the following simple macro:
[h:state.Dead=if(HP <= 0, 1, 0)]
This statement evaluates the condition within the if() statement, and if true, assigns the value 1 to state.Dead. If the condition HP >= 0 is false, on the other hand, the value 0 is assigned to state.Dead.