Warning

This documentation is for an unreleased version of MPF!

This is the developer documentation for MPF 0.51, which is the “dev” (next) release of MPF that is a work-in-progress. Use the “Read the Docs” link in the lower left corner to view the developer docs for the version of MPF you’re using.

self.machine.shots.*

class mpf.devices.shot.Shot(machine, name)

Bases: mpf.core.enable_disable_mixin.EnableDisableMixin, mpf.core.mode_device.ModeDevice

A device which represents a generic shot.

Accessing shots in code

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

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

Methods & Attributes

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

active_sequences = None

(id, current_position_index, next_switch)

Type:List of tuples
advance(force=False, **kwargs) → bool

Advance a shot profile forward.

If this profile is at the last step and configured to loop, it will roll over to the first step. If this profile is at the last step and not configured to loop, this method has no effect.

disable(**kwargs)

Disable device.

enable(**kwargs) → None

Enable device.

enabled

Return true if enabled.

hit(**kwargs)

Advance the currently-active shot profile.

Note that the shot must be enabled in order for this hit to be processed.

jump(state, force=True)

Jump to a certain state in the active shot profile.

Parameters:
  • state – int of the state number you want to jump to. Note that states are zero-based, so the first state is 0.
  • show_step – The step number that the associated light script should start playing at. Useful with rotations so this shot can pick up right where it left off. Default is 1 (the first step in the show)
monitor_enabled = False

Class attribute which specifies whether any monitors have been registered to track shots.

persist_enabled

Return if enabled is persisted.

profile

Return profile.

profile_name

Return profile name.

raise_config_error(msg, error_no, *, context=None)

Raise a ConfigFileError exception.

reset(**kwargs)

Reset the shot profile for the passed mode back to the first state (State 0) and reset all sequences.

restart(**kwargs)

Restart the shot profile by calling reset() and enable().

Automatically called when one fo the restart_events is called.

state

Return current state index.

state_name

Return current state name.