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"  ·  despawn

Verbs 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

EventFires whenother is
enterthe player walks into itthe player
exitthe player walks outthe player
collideanother entity touches it — a ball rolling into a goal fires this, never enterwhat hit it
damagedits hp changed by a shot, a rule or a scriptwhoever dealt it
spawnedit comes into being
presseda bound key is pressed — needs a key in player.keys first, optionally within a distancethe presser
heldit goes into somebody’s handsthe holder
droppedit is put down
returnedit comes back from a timed deactivate — the respawn trick
emittedany emit says the name it listens forthe emitter
finishedthe match ends

The verbs

damage / healChanges hp, clamped at zero. Heal by 999 is the document's way of saying "whatever full is".
setProp / addPropWrites or adds to a property — including the level’s own data via target world.
despawnRemoves it, finally. A rule stops here. The thing that comes back later is a new one, spawned by something still alive — or a deactivate.
spawnMakes one from a blueprint, offset from this entity.
deactivate / activateOff 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 / unhandHangs it off whoever set the rule off; lets go of one thing, or of everything.
disarm / armTakes the weapon away and gives it back.
stunRoots a player where they stand, still standing.
teleportSends it to a named entity or a mark. The picker takes a name not placed yet, for forward references.
checkpointWhere this player comes back to.
loadA door out — another XP, by name.
soundThe host plays it, from a closed list.
scoreCredits 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.
emitSays a name out loud. See below.
animatePlays 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: activate

The name is exact — no wildcards, and gate-open does not hear gate-opened. A chain works (onetwothree 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.