Scripts
When a sentence is not enough, write JavaScript against the game API.
Most games need no code. When a rule does, add a script.

Two kinds
Action script: runs as an action, Run script {script}.
Expression script: returns a value for any slot of its Result type.
The editor knows your project: variables, objects and events autocomplete.
What a script can use
| Name | What it is |
|---|---|
game, world, ui | The game API (reference) |
math | Vectors and helpers (reference) |
vars | Game variables by name |
objects, prefabs | Your objects and prefabs by name |
events, enums | Custom events and enumeration values |
roles, actions | Roles and control actions |
bound | What the row's trigger gives, like bound.player |
Rules
No clocks, no network, no
Math: every player must see the same game. Usemathfor numbers, andmath.seed(game.seed)for random draws that change every match.A syntax error counts in Problems. An error while the game runs shows in the Play log as Script name: …; click it to open the script.