FolioTier 1

set

Assign a project variable from a bounded expression.

Parameters

ParameterKindRequiredDefaultNotes
variableidentifieryesIdentifier of the variable being assigned. Variables are declared by first use; the type is inferred from the first assignment and can be number, string, or boolean.
valueexpressionyesExpression evaluated and assigned to the variable. Same bounded grammar as `if` conditions — literals, arithmetic, references to other variables and subsystem state, membership tests. No side-effecting calls; expressions are pure.

Canonical example

Folio
set has-key = true
set love = 0
set love = love + 1
Ren'Py
$ has_key = True
$ love = 0
$ love += 1

set is the variable assignment verb. Variables live for the duration of the playthrough and are persisted with the save state. There's no explicit declaration step — the first set to a variable name creates it; the inferred type comes from the first value.

Notes

The right-hand side accepts the same bounded expression grammar as if — comparisons, boolean ops, arithmetic, references to other variables and subsystem state. set love = love + 1 is the canonical counter pattern (Ren'Py's $ love += 1).

When the v1 Stats subsystem ships, set stats.charisma = ... becomes the explicit way to write to a stat slot. Until then, plain variables are the unstructured equivalent — the migration path is straight rename.

set is not a way to call into Python or invoke arbitrary methods. The right-hand side is a pure expression — no renpy.* calls, no method invocations on custom objects, no I/O. If the source Ren'Py uses $ <expr> to do those, the importer routes the fragment to the AI pass or the manual lane (see Phase 6 § B.4).

See also

  • if — read the variables set writes
  • variables — declaration, scope, persistence