Actions
Actions express calculations and controlled changes to story state.

The current Actions editor, captured December 2, 2026.
An action has a typed header and a matching end. Parameters and local values use backticks; fact references use angle brackets.
ACTION salesTotal(cups|number,price|number)|number
multiply(`cups`, `price`)
ACTION_END salesTotalSupported value types include number, bool, and string. Use void for a procedure that performs work without returning a value. The last expression supplies a calculation's result.
Use named operations such as sum, difference, multiply, and divide. Conditions can use comparisons and and/or/not. if(test, yes, no) evaluates the selected branch. A procedure can call a calculation with arguments.
Run prechecks before testing. Test previews use defaults and supplied inputs; they do not rewrite the story's starting fact values. System facts cannot be written. Use a no-argument procedure on a Fact Update block to run authored changes during play.
Keep actions small enough that you can explain their effect in one sentence. Test both the ordinary inputs and boundary values.