Warning

This is the dev documentation for an unreleased version of MPF!

This is the documentation for MPF 0.54+, which is the “dev” (next) release of MPF that is a work-in-progress. Unless you’re specifically looking for this version, you probably want to use the version of documentation called “latest” which is for the latest released version of MPF. That documentation is at docs.missionpinball.org/en/latest.

Machine Variables

MPF uses the concept of machine variables to track dynamically- created variables that apply on a machine-wide basis. Machine variables are similar in concept to player variables, except machine variables are machine-wide instead of per-player. Examples of things that are stored in machine variables include:

  • The number of credits on the machine (if you’re using the credits mode and not set to free play)
  • The scores of the last game played (which are typically shown in the attract mode display loop)
  • The names and scores of the high scores (which are also shown in the attract mode display loop and in the “status” screen when a player holds a flipper button in during a game).

Machine variables can be set to persist, meaning they are saved to disk and available to MPF the next time it boots up. (For example, if you first turn on a pinball machine, it will still show the scores of the last game played in the attract mode.) These machine variables are stored in the <your_machine_folder>/data/machine_vars.yaml file. Machine variables that are saved to disk can optionally be written with an expiration time which means they’re cleared out if MPF boots after the time has passed. (For example, the number of credits on the machine might only persist for a few hours.)

Like player variables, you can use machine variables in your config files, particularly in text display widgets, to show things on your display.

You can create your own machine variables in your configs. There are also several machine variables that are automatically created. Here’s a list of the machine variables that are “built in” and available for use in your configs: