EverambleGAME API / 1

CONTENT CONTRACT · VERSION 1

binding

A filtered event subscription with one owner source and an explicit snapshot.

Signature

{ cases: ({BindingCase})?, event: EventKind, filter: EventFilter, id: ContentId, kind: "binding", lasting: (BindingLasting)?, owner_from: BindingOwner, parameters: Parameters, script: ScriptId, snapshot: SnapshotSpec }

Fields

NameTypeMeaning
cases{BindingCase}Optional parameter table. Every matching row invokes the script once in row order, under its stable local identity; the common filter also applies.
Items: 1…64
eventEventKindEvent kind or typed event payload selected by the handler declaration.
filterEventFilterDefinition references that restrict which matching events invoke the binding.
idContentIdPackage-qualified identity; unique within its declaring namespace.
Length: 1…129; Pattern: ^[a-z][a-z0-9_]{0,31}:[a-z][a-z0-9_]{0,95}$
kind"binding"Discriminant
lastingBindingLastingWho owns the lasting state its effects leave; a row's own overrides it. Required exactly when the script declares an effect that leaves owned state (`leaves`: walk, routine, behavior, spawn, faction, work).
owner_fromBindingOwnerEvent field that supplies the invocation owner.
parametersParametersExact closed argument record supplied by the selected definition.
scriptScriptIdAuthority handler declared by the same package.
Length: 1…129; Pattern: ^[a-z][a-z0-9_]{0,31}:[a-z][a-z0-9_]{0,95}$; Reference: script
snapshotSnapshotSpecExplicit visibility requested for the frozen invocation snapshot.

Validated example

{
  "event": "timer_fired",
  "filter": {
    "timer": "core:camp_guards_apply"
  },
  "id": "core:camp_guards_hook",
  "kind": "binding",
  "lasting": {
    "while": [
      {
        "max": 2,
        "min": 0,
        "variable": "core:camp_state"
      }
    ]
  },
  "owner_from": "timer_owner",
  "parameters": {},
  "script": "core:camp_guards",
  "snapshot": {
    "anchors": [
      "core:valley/camp_gate_inside",
      "core:valley/camp_center"
    ],
    "definitions_from": [
      "core"
    ],
    "radius_mm": 50000,
    "variables": [
      {
        "owner": "world",
        "variable": "core:camp_state"
      },
      {
        "owner": "world",
        "variable": "core:camp_guards_arrived"
      }
    ]
  }
}