self.machine.score_reel_groups.*

class mpf.devices.score_reel_group.ScoreReelGroup(machine, name)

Bases: mpf.core.system_wide_device.SystemWideDevice

Represents a logical grouping of score reels in a pinball machine.

Multiple individual ScoreReel object make up the individual digits of this group. This group also has support for the blank zero "inserts" that some machines use. This is a subclass of mpf.core.device.Device.

Accessing score_reel_groups in code

The device collection which contains the score_reel_groups in your machine is available via self.machine.score_reel_groups. For example, to access one called "foo", you would use self.machine.score_reel_groups.foo. You can also access score_reel_groups in dictionary form, e.g. self.machine.score_reel_groups['foo'].

You can also get devices by tag or hardware number. See the DeviceCollection documentation for details.

Methods & Attributes

Score_reel_groups have the following methods & attributes available. Note that methods & attributes inherited from base classes are not included here.

add_value(value, jump=False, target=None)

Add value to a ScoreReelGroup.

You can also pass a negative value to subtract points.

You can control the logistics of how these pulses are applied via the jump parameter. If jump is False (default), then this method will respect the proper "sequencing" of reel advances. For example, if the current value is 1700 and the new value is 2200, this method will fire the hundreds reel twice (to go to 1800 then 1900), then on the third pulse it will fire the thousands and hundreds (to go to 2000), then do the final two pulses to land at 2200.

Parameters:
  • value -- The integer value you'd like to add to (or subtract from) the current value
  • jump -- Optional boolean value which controls whether the reels should "count up" to the new value in the classic EM way (jump=False) or whether they should just jump there as fast as they can (jump=True). Default is False.
  • target -- Optional integer that's the target for where this reel group should end up after it's done advancing. If this is not specified then the target value will be calculated based on the current reel positions, though sometimes this get's wonky if the reel is jumping or moving, so it's best to specify the target if you can.
assumed_value_int

Return integer representation of the value we assume is shown on this ScoreReelGroup.

A value of -999 means the value is unknown.

assumed_value_list

Return list that holds the values of the reels in the group.

classmethod chime(chime, **kwargs)

Pulse chime.

get_physical_value_list()

Query all the reels in the group and builds a list of their actual current physical state.

This is either the value of the current switch or -999 if no switch is active. This method also updates each reel's physical value.

Returns: List of physical reel values.

initialize(**kwargs)

Initialize the score reels by reading their current physical values and setting each reel's rollover reel.

This is a separate method since it can't run int __iniit__() because all the other reels have to be setup first.

int_to_reel_list(value)

Convert an integer to a list of integers that represent each positional digit in this ScoreReelGroup.

The list returned is in reverse order. (See the example below.)

The list returned is customized for this ScoreReelGroup both in terms of number of elements and values of None used to represent blank plastic zero inserts that are not controlled by a score reel unit.

For example, if you have a 5-digit score reel group that has 4 phyiscial reels in the tens through ten-thousands position and a fake plastic "0" insert for the ones position, if you pass this method a value of 12300, it will return [None, 0, 3, 2, 1]

This method will pad shorter ints with zeros, and it will chop off leading digits for ints that are too long. (For example, if you pass a value of 10000 to a ScoreReelGroup which only has 4 digits, the returns list would correspond to 0000, since your score reel unit has rolled over.)

Parameters:value -- The interger value you'd like to convert.
Returns:A list containing the values for each corresponding score reel, with the lowest reel digit position in list position 0.
is_desired_valid(notify_event=False)

Test to see whether the machine thinks the ScoreReelGroup is currently showing the desired value.

In other words, is the ScoreReelGroup "done" moving? Note this ignores placeholder non-controllable digits.

Returns: True or False

light(relight_on_valid=False, **kwargs)

Light up this ScoreReelGroup based on the 'light_tag' in its config.

classmethod reel_list_to_int(reel_list)

Convert an list of integers to a single integer.

This method is like int_to_reel_list except that it works in the opposite direction.

The list inputted is expected to be in "reverse" order, with the ones digit in the [0] index position. Values of None are converted to zeros. For example, if you pass [None, 0, 3, 2, 1], this method will return an integer value of 12300.

Note this method does not take into consideration how many reel positions are in this ScoreReelGroup. It just converts whatever you pass it.

Parameters:reel_list -- The list containing the values for each score reel position.
Returns:The resultant integer based on the list passed.
set_rollover_reels()

Call each reel's set_rollover_reel method and passes it a pointer to the next higher up reel.

This is how we know whether we're able to advance the next higher up reel when a particular reel rolls over during a step advance.

set_value(value=None, value_list=None)

Reset the score reel group to display the value passed.

This method will "jump" the score reel group to display the value that's passed as an it. (Note this "jump" technique means it will just move the reels as fast as it can, and nonsensical values might show up on the reel while the movement is in progress.)

This method is used to "reset" a reel group to all zeros at the beginning of a game, and can also be used to reset a reel group that is confused or to switch a reel to the new player's score if multiple players a sharing the same reel group.

Note you can choose to pass either an integer representation of the value, or a value list.

Parameters:
  • value -- An integer value of what the new displayed value (i.e. score) should be. This is the default option if you only pass a single positional argument, e.g. set_value(2100).
  • value_list -- A list of the value you'd like the reel group to display.
tick(dt)

Automatically called once per machine tick and checks to see if there are any jumps or advances in progress.

If so, calls those methods.

unlight(relight_on_valid=False, **kwargs)

Turn off the lights for this ScoreReelGroup based on the 'light_tag' in its config.

validate(value=None)

Validate that this score reel group is in the position the machine wants it to be in.

If lazy or strict confirm is enabled, this method will also make sure the reels are in their proper physical positions.

Parameters:value (ignored) -- This method takes an argument of value, but it's not used. It's only there because when reels post their events after they're done moving, they include a parameter of value which is the position they're in. So we just need to have this argument listed so we can use this method as an event handler for those events.