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:stable version from the lower-left corner of this page. You can always update to the latest at any time.

Types of events

There are several different types of events in MPF, including:

  • Basic
  • Queue

You can find the details of how to use each of these events by reading through the API documentation for the event manager, but here’s a quick overview.

Video about events in MPF:

Basic Events

The basic event is a simple event with a name (and possibly keyword argument pairs) that is posted.

The event manager will call the registered handlers one-by-one in the order of their priority (from when they registered).

Queue Events

Queue events are similar to basic events, except that the event won’t actually finish until all the handlers say it’s ok to do so.

The game_ending event is an example of a queue event. When the game is over, game_ending is posted, and when that’s done, game_ended is posted and the attract mode starts again. However there are several modes that might want to “block” the completion of game_ending until they can do whatever they need to do. For example, if match is enabled, it will want to block game_ending until it can run the match animation. If a player has achieved a high score, the high score mode will want to block game ending, etc.

You can create your own queue events with the queue_event_player: and queue_relay_player: config file sections.

Note for Programmers

If you’re a programmer and familiar with Python, you’ll notice in the source code that there are more types of events than just basic and queue events. The basic and queue events are the only ones that are exposed via config files, but you’ll notice there are boolean and relay events, and that there are asynchronous versions of all events too. See the API reference for details.