Score reel controller.

class mpf.devices.score_reel_controller.ScoreReelController(machine)

The overall controller that is in charge of and manages the score reels in a pinball machine.

The main thing this controller does is keep track of how many ScoreReelGroups there are in the machine and how many players there are, as well as maps the current player to the proper score reel.

This controller is also responsible for working around broken ScoreReelGroups and “stacking” and switching out players when there are multiple players per ScoreReelGroup.

Known limitations of this module:
  • Assumes all score reels include a zero value.
  • Assumes all score reels count up or down by one.
  • Assumes all score reels map their displayed value to their stored value in a 1:1 way. (i.e. value[0] displays 0, value[5] displays 5, etc.
  • Currently this module only supports “incrementing” reels (i.e. counting up). Decrementing support will be added in the future.

Initialise score reel controller.

active_scorereelgroup = None

Pointer to the active ScoreReelGroup for the current player.

game_starting(queue, game, **kwargs)

Reset the score reels when a new game starts.

This is a queue event so it doesn’t allow the game start to continue until it’s done.

  • queue – A reference to the queue object for the game starting event.
  • game – A reference to the main game object. This is ignored and only included because the game_starting event passes it.

Create a mapping of a player to a score reel group.

player_to_scorereel_map = None

This is a list of ScoreReelGroup objects which corresponds to player indexes. The first element [0] in this list is the first player (which is player index [0], the next one is the next player, etc.

queue = None

Holds any active queue event queue objects

reset_queue = None

List of score reel groups that still need to be reset


Called when a new player’s turn starts.

The main purpose of this method is to map the current player to their ScoreReelGroup in the backbox. It will do this by comparing length of the list which holds those mappings (player_to_scorereel_map) to the length of the list of players. If the player list is longer that means we don’t have a ScoreReelGroup for that player.

In that case it will check the tags of the ScoreReelGroups to see if one of them is tagged with playerX which corresponds to this player. If not then it will pick the next free one. If there are none free, then it will “double up” that player on an existing one which means the same Score Reels will be used for both players, and they will reset themselves automatically between players.

score_change(value, change, **kwargs)

Called whenever the score changes and adds the score increase to the current active ScoreReelGroup.

This method is the handler for the score change event, so it’s called automatically.

  • score – Integer value of the new score. This parameter is ignored, and included only because the score change event passes it.
  • change – Interget value of the change to the score.