lamps Submodule

Classes for controlling lamp shows.


class procgame.lamps.LampController(game)

Controller object that encapsulates a LampShow and helps to restore lamp drivers to their prior state.


LampShowMode that must be added to the mode queue.


Dictionary of LampShow objects.


class procgame.lamps.LampShow(game)

Manages loading and playing a lamp show consisting of several lamps (or other drivers), each of which is a track (LampShowTrack, to be precise).


True if each of the tracks has completed.


Reads lines from the given filename in to create tracks within the lamp show. A lamp show generally consists of several lines of text, one for each driver, spaced so as to show a textual representation of the lamp activity over time.

Lines that start with a ‘#’ are ignored as comments. An example (and very short) lamp show follows:

lamp:Left   | ..      ..
lamp:Center |   ..  ..  ..
lamp:Right  |     ..      ..

See LampShowTrack for a complete description of the track line format.


Clears out all of the tracks in this lamp show.


Restart the show from the beginning.


Instructs the lamp show to advance based on the system clock and update the drivers associated with its tracks.


class procgame.lamps.LampShowMode(game)

Mode subclass that manages a single LampShow, updating it in the mode_tick() method.

load(filename, repeat=False, callback='None')

Load a new lamp show.


Restart the lamp show.


class procgame.lamps.LampShowTrack(line)

A series of schedules to be applied to a driver over a period of time, usually in concert with other tracks to make up a LampShow.

Tracks are initialized from a string with three parts:

  1. An identifier describing the driver to be manipulated by this track. If the identifier has a lamp: prefix the text following it is interpreted as a lamp name (member of lamps); coil: corresponds to members of coils. If neither of these prefixes is present then the name is assumbed to be a lamp name.
  2. A pipe character (|).
  3. A sequence of characters describing the lighting/activation pattern for the driver. In the simplest case such a string would be a series of dots/periods ('.') and spaces.

For example, a lamp show track describing a lamp (named Bonus5X) that would blink on and off might be:

lamp:Bonus5X | ....    ....    ....    ....

Each character in a track represents 1/32nd of a second. This corresponds to the 32 schedule bits of a Driver.

Special characters may be used in place of dots as shorthand for effects such as fades or simply holding a driver on. This makes constructing and tuning large shows much less time-consuming. Four characters may be used:

[ – open with a “hold on”
] – close with a “hold on”
< – open with a fade-in
> – close with a fade-out

Each open must be balanced with a close, although it need not be of the same type. For example, to fade on a lamp and then keep it on:

lamp:Bonus5X |    <                  ][                 ]

This is translated (by expand_line()) to something similar to this:

lamp:Bonus5X |    .  .  .. .. ... .......................

Or, to pulse it in a fade-in-fade-out pattern:

lamp:Bonus5X |       <                     >

To pulse a flasher rapidly:

coil:Flasher2 |       .      .     .     .    .

These special characters may be mixed with the simpler dots and spaces, but there must always be spaces between the open and close characters. Note that the fade effect is not exactly a fade, but rather turning the driver on and off very rapidly to simulate the lamp getting brighter or darker.


Care must be used when constructing lamp shows controlling coils. Never hold a coil or flasher active for an extended period of time. Otherwise the game will blow a fuse, burn a coil/flasher, or worse.


Index into the schedules list.


The Driver correspopnding to this track.


True if this track’s schedules have all been used.


Name of this track which corresponds to a driver.


Clears the contents of this track.


Restarts this track at the beginning.


Sequence of 32-bit schedule values.



Expands special characters <>[] within str and returns the dots-and-spaces representation. Used by LampShowTrack.

Table Of Contents

Previous topic

highscore Submodule

Next topic

modes Submodule

This Page