FolioTier 2

gain stat

Augment a Stats counter by a signed amount.

Parameters

ParameterKindRequiredDefaultNotes
nameidentifieryesIdentifier of the stat being augmented. The stat does not need to have been declared first — the runtime treats an undeclared stat's prior value as 0 — but declaring with `set stat <name> value=<init>` first makes intent visible in the editor sidebar.
amountexpressionyesSigned expression evaluated and added to the current stat value. Positive adds; negative subtracts. Bounded grammar — literals, arithmetic, references to other stats (`stats.<name>`). The result is coerced to a finite number; non-numeric or non-finite results contribute 0.

Canonical example

Folio
gain stat love amount=1
gain stat money amount=-50
gain stat damage amount=stats.str * 2 - 5
Ren'Py
$ love += 1
$ money -= 50
$ damage = damage + (str * 2 - 5)

gain stat is augmented assignment for the Stats subsystem — the canonical lowering for Ren'Py's $ <name> += N idiom. It appears 700+ times in Acting Lessons, 580+ in Eternum, 270+ in What a Legend. That's the dominant control-flow shape in Tier 2-3 games, and it's why Stats ships first.

The verb is signed: positive amounts add, negative amounts subtract. There is no separate lose stat verb; gain stat money amount=-50 covers spending exactly the same as $ money -= 50.

Notes

The amount expression accepts the full bounded grammar — including references to other stats. The corpus pattern gain stat damage amount=(stats.str * 2 - enemy.def) * crit_mod shows how RPG-style combat-math chains naturally through the verb. The amount is evaluated against current state at runtime, so stats.str reads the player's current strength, not the value at declaration time.

If the target stat hasn't been declared, the runtime treats its prior value as 0. The first gain stat unseen amount=1 thus effectively creates the stat with value 1. Prefer declaring with set stat near the entry scene so the editor sidebar surfaces every stat the project tracks; implicit creation is allowed but makes the stat surface harder to read.

See also

  • set stat — declare a stat or overwrite hard
  • stats — the Stats subsystem at a glance
  • if — read stats.<name> to gate routing on a counter