Controlled lamps are used to highlight shots on the playfield and to keep track of the progress of scoring features. Unlike general illumination, each lamp is individually controllable by the CPU.
Lamps are numbered from 0 to NUM_LAMPS
-1. For each lamp, there
are several flags that can be set to determine its physical state.
The job of the lamp driver is to combine all of these flags into a
single output value, and send that to the underlying hardware.
Every lamp has a basic state, which is either on, off, or flashing. The basic state of a lamp is a per-player value and is automatically saved and restored as players change in a multiplayer game. It is managed by the following APIs:
lamp_on
lamp_off
lamp_test
lamp_toggle
lamp_flash_on
lamp_flash_off
lamp_flash_toggle
lamp_tristate_on
lamp_tristate_off
lamp_tristate_flash
The basic state may be temporarily overriden via a lamp effect. An effect can allocate a lamp, thereby overriding its basic value. When the effect finishes, it frees the lamp, causing the basic state to be shown again (see Lamp Effects).
In the machine description, you can attach a color and coordinates to each lamp. These are not used by the core OS, but they can be used to construct nice looking lamp effects that manipulate them in certain patterns.