Skip to content

Tutorial Conditioned Bindings

johnjohto edited this page Jul 26, 2026 · 1 revision

Tutorial: Conditioned Bindings (One Grammar for "It Depends")

Anywhere a record binds a target, the binding can instead be an ordered candidate list -- first match wins, a candidate without when always matches, and your existing plain records stay valid untouched. Encounter slots were first:

{
 "id": "zone:route22_wilds",
 "maps": ["map:Route22"],
 "slots": {
  "grass": [
   {"when": "time_part_nite", "group": "egroup:route22_nite", "rate": 25},
   {"group": "egroup:route22_day", "rate": 25}
  ]
 }
}
  • when is a plain condition expression over the same identifiers events use -- the clock's time_* family, badge_count, story flags, items. Mixed conditions like "badge_count >= 3 and time_part_nite" just work.
  • Order is authored order. A candidate after an unconditioned one can never fire, and the validator refuses it as dead.
  • No match means no binding -- for an encounter slot, that's "no encounters of this kind right now", which is itself authorable.
  • Determinism is part of the contract: resolution consumes no randomness, so replays and link sessions stay byte-exact.

Map palettes speak the same grammar (see Day and Night), and future surfaces (conditional music is on the roadmap) will too -- learn it once, use it everywhere. Studio renders the two shapes with a branch picker, so you can flip a plain binding into candidates without leaving the editor.

Clone this wiki locally