⚠️ Stale document. This is a YAML-example quickstart that predates the current RuntimeOp/Predicate/Effect system. See CORE_DESIGN.md (RuntimeOp section) and VM_DESIGN.md (Traversal Traits) for the current architecture.

Conditional Narratives in StoryTangl

State Variables

Define global state in your script:

globals:
  has_key: false
  player_health: 100

Effects

Modify state when blocks are entered:

effects:
  - "has_key = True"
  - "player_health -= 10"

Conditions

Gate actions based on state:

actions:
  - text: "Use the key"
    conditions:
      - "has_key"
  
  - text: "Break down the door"
    conditions:
      - "player_health > 50"

Items and Flags

items:
  sword:
    name: "Iron Sword"

effects:
  - "acquire_item('sword')"

conditions:
  - "has_item('sword')"