This is the documentation the latest work-in-progress version of MPF!
This is the documentation for MPF 0.57, which is the “dev” (next) release of MPF that is a work-in-progress. This is probably ok, and means you’ll be on the latest, cutting-edge version of MPF.
However, if you want a more stable version, select the
v:stableversion from the lower-left corner of this page. You can always update to the latest at any time.
When you have some code you want to register to be a handler for an event, you can optionally specify a priority. (Priority is just an integer value.) The default priority for events is 1. If you want a guarantee that a certain event handler will fire last, then register that handler with a priority that’s lower than any other handler for that event. And if you want to guarantee that a handler fires first, register it with a higher priority. (In this case, “higher” and “lower” are literal. A handler with a priority of 500 will be called before a handler of 100.)
The actual integer values of the priorities are arbitrary. They’re called one-by-one, one after the other, in order from highest to lowest. Whether your priorities are 3, 2, and 1, or 1000, 100 and 0, or 1000, 999, 998, and 1 makes no difference.
MPF automatically registers event handlers from modes with the priority of that mode, meaning high-priority modes get access to an event before lower-priority modes. (This is useful since it gives higher-priority modes a chance to “block” events from lower-priority modes.)
See Device Control Events on how to use event handlers in devices.