Reference
Rules & verbs
A rule is three things: on (an event), an optional when (one property against one number, on self, other or the level's data), and do (a list of verbs). The vocabulary is closed, which is why it fits on a panel — and why nothing you can write here fails while somebody is playing.
The shape of a rule
on: damaged when: hp <= 0
do: spawn shard · score 1 · emit "target down" · despawnVerbs run in order, and despawn stops the rule — anything after it would be writing to a corpse. target on a verb is self or other; for setProp and addProp it can also be world, writing a declared data field.
The events
| Event | Fires when | other is |
|---|---|---|
enter | the player walks into it | the player |
exit | the player walks out | the player |
collide | another entity touches it — a ball rolling into a goal fires this, never enter | what hit it |
damaged | its hp changed by a shot, a rule or a script | whoever dealt it |
spawned | it comes into being | — |
pressed | a bound key is pressed — needs a key in player.keys first, optionally within a distance | the presser |
held | it goes into somebody’s hands | the holder |
dropped | it is put down | — |
returned | it comes back from a timed deactivate — the respawn trick | — |
emitted | any emit says the name it listens for | the emitter |
finished | the match ends | — |
The verbs
damage / heal | Changes hp, clamped at zero. Heal by 999 is the document's way of saying "whatever full is". |
setProp / addProp | Writes or adds to a property — including the level’s own data via target world. |
despawn | Removes it, finally. A rule stops here. The thing that comes back later is a new one, spawned by something still alive — or a deactivate. |
spawn | Makes one from a blueprint, offset from this entity. |
deactivate / activate | Off and back on — for a number of seconds, or until something turns it back. Coming back fires returned, which is how poppers stand back up and pickups meter themselves. |
carry / drop / unhand | Hangs it off whoever set the rule off; lets go of one thing, or of everything. |
disarm / arm | Takes the weapon away and gives it back. |
stun | Roots a player where they stand, still standing. |
teleport | Sends it to a named entity or a mark. The picker takes a name not placed yet, for forward references. |
checkpoint | Where this player comes back to. |
load | A door out — another XP, by name. |
sound | The host plays it, from a closed list. |
score | Credits whoever set the rule off. What a score means is the host’s business — that is what lets one level be a practice range and a match. |
emit | Says a name out loud. See below. |
animate | Plays a document clip on an entity — see the animator. |
emit and emitted
emit says a name; every emitted rule listening for that exact name hears it. The sender does not name a receiver — so a third thing that reacts is a new rule and no edit to the emitter, which is the whole point:
the bell on: pressed (key use) do: emit "ring"
the gate on: emitted "ring" do: setProp open = 1
the lights on: emitted "ring" do: activateThe name is exact — no wildcards, and gate-open does not hear gate-opened. A chain works (one → two → three runs to the end); a loop is cut off after 512 deliveries in a frame rather than hanging the tab. other in the listening rule is whoever emitted, so a when can ask about the sender.
What the panel refuses
The panel will not build a document the parser would send back, because that refusal would arrive as "nothing happened". So: the last verb of a rule has no remove button — a rule must do something. A spawn can only name a blueprint that exists. pressed is not offered until the level has a key to bind it to. An emitted with no name does not save. And finished warns when the level has no way to finish — a rule that can never fire is a bug with no symptom.