Lighting an Insert on a Condition

recipe lit-mode conditions

Lighting an Insert on a Condition

Most “is this lit?” logic follows one shape: a boolean variable tracks whether something is qualified, and a light mirrors that variable. Drive the variable from gameplay and keep the light in sync with it.

Light it when qualified

When the rollover is made and the lane isn’t already lit, flip the variable and turn the insert on:

event_handler "qualify_lane" {
  when      = device.rollover_lane.rollover
  condition = var.lane_lit == false
  actions {
    toggle_variable = "lane_lit"
    set_light "light" {
      device = lane_insert
      state  = "on"
    }
  }
}

Keep the light in step

If anything else changes lane_lit — a mode reset, a player switch, collecting the award — the light should follow. React to the variable’s own change event so the insert never goes stale:

event_handler "lane_light_off" {
  when      = variable.lane_lit.changed
  condition = var.lane_lit == false
  actions {
    set_light "light" {
      device = lane_insert
      state  = "off"
    }
  }
}

How it works

A variable emits a variable.<name>.changed event whenever its value actually changes, which is what lets a light track it across game end, player switch, and resets. For the full lifecycle and why this matters, see Syncing Outputs to Variable State.