This documentation is for an unreleased version of MPF!
This is the developer documentation for MPF 0.54, 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.
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.
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.
(id, current_position_index, next_switch)
Type: List of tuples
advance(force=False) → 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.
Return if the shot can be rotated according to its profile.
enable() → None¶
Return true if enabled.
Handle advance control event.
Handle disable control event.
Handle enable control event.
Handle hit control event.
Handle reset control event.
Handle restart control event.
format_log_line(msg, context, error_no) → str¶
Return a formatted log line with log link and context.
Get the value of a placeholder.
hit() → bool¶
Advance the currently-active shot profile.
Note that the shot must be enabled in order for this hit to be processed.
Returns true if the shot was enabled or false if the hit has been ignored.
jump(state, force=True, force_show=False)¶
Jump to a certain state in the active shot profile.
- state – int of the state number you want to jump to. Note that states are zero-based, so the first state is 0.
- force – if true, will jump even if the shot is disabled
- force_show – if true, will update the profile show even if the jumped state index is the same as before the jump
Class attribute which specifies whether any monitors have been registered to track shots.
Return if enabled is persisted.
Return profile name.
raise_config_error(msg, error_no, *, context=None) → NoReturn¶
Raise a ConfigFileError exception.
Reset the shot profile for the passed mode back to the first state (State 0) and reset all sequences.
Restart the shot profile by calling reset() and enable().
Automatically called when one fo the restart_events is called.
Return current state index.
Return current state name.
Subscribe to an attribute.