Skip to content
Docs
Build it yourself

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.

An expression script in the editor returning the higher of RedScore and BlueScore, with its result type in the Inspector.

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

NameWhat it is
game, world, uiThe game API (reference)
mathVectors and helpers (reference)
varsGame variables by name
objects, prefabsYour objects and prefabs by name
events, enumsCustom events and enumeration values
roles, actionsRoles and control actions
boundWhat the row's trigger gives, like bound.player

Rules

  • No clocks, no network, no Math: every player must see the same game. Use math for numbers, and math.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.