Creating Constants
Create constants for the fixed tuning values of your design, and read them in conditions, expressions and formulas.
Creating Constants
Constants are the fixed tuning values of your design — a base damage value, the XP needed per level, a daily limit. You manage them from the Constants tab of the Element Explorer on the Design tab.
Tip: Put tuning values in constants instead of typing them into many places. Changing the constant then updates every condition, expression and formula that reads it.
Creating a Constant
In a workspace, click New Constant, name the constant in the Inspector — e.g. "Base Damage", with the slug base_damage — enter its Value and click Save. The fields every element shares are covered in Navigating Leap Studio. Two things are specific to constants:
- Value — the value your design reads. Required; it must be a number.
- Slug — constants and resources share slugs: a constant can't use the same slug as a resource in the same group.
How Constants Behave
A constant is saved as a resource whose starting value, minimum and maximum are all the same, so it always reads as its Value and can never drift.
- Reading a constant — use it anywhere a value is expected: in conditions, value expressions and formulas.
- Changing a constant — nothing in your design can. Constants are never offered as the target of an effect; change the Value in the Inspector instead.
- Deleting a constant — leaves the conditions and expressions that read it dangling. Check Element Flow first to see what reads it.
Next Steps
Continue to Creating Flags to track yes/no facts about a player.