FolioTier 2

set stat

Declare a Stats counter or overwrite its value.

Parameters

ParameterKindRequiredDefaultNotes
nameidentifieryesIdentifier of the stat being declared or overwritten. Stats live in their own namespace (`subsystems.stats.<name>`) and are reachable from expressions through `stats.<name>`. Names follow the same identifier rules as variables — letters, digits, hyphens, underscores; no spaces.
valueexpressionyesExpression evaluated and assigned to the stat. Bounded grammar — numeric literals, arithmetic, comparison, references to other stats (`stats.<name>`). The result is coerced to a finite number; non-numeric or non-finite results clamp to 0.

Canonical example

Folio
set stat love value=0
set stat money value=100
set stat health value=stats.health + 10
Ren'Py
default love = 0
default money = 100
$ health = health + 10

set stat either declares a new stat with an initial value or overwrites an existing one. Reads inside the bounded expression grammar use stats.<name> — so once a stat is declared, any if, gate when:, option ... if:, or downstream set stat / gain stat slot can reference it.

The first set stat <name> for a name fixes the stat in subsystems.stats. Subsequent calls overwrite. There is no separate "declare" verb; declaration is just the first assignment.

Notes

Stats are numeric. The value expression can do arithmetic (stats.health + 10, stats.charisma * 2) but the result is coerced to a finite number — strings, booleans, and non-finite results clamp to 0. If you need a non-numeric counter, use a regular variable.

Use gain stat (not set stat) for the common $ <name> += N pattern. set stat is the right tool for declaring stats up front (near the project's entry scene) and for setting a hard value ("reset health to 10 at the start of each day").

See also

  • gain stat — augmented assignment for counters
  • stats — the Stats subsystem at a glance
  • if — read stats.<name> in conditional routing