Skip to content

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.

If you want to use a machine variable in a slide player you can access it similarly to normal variables, you need to use the syntax (machine|my_var_name) where my_var_name obviously has to be replaced with your variable name.

Video about player and machine variables:

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:


Something missing or wrong? You can fix it!

This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?

Please help us! You can fix it yourself and be an official "open source" contributor!

It's easy! See our Beginner's guide to editing the docs.

Page navigation via the keyboard: < >

You can navigate this site via the keyboard. There are two modes:

General navigation, when search is not focused:

  • F , S , / : open search dialog
  • P , , : go to previous page
  • N , . : go to next page

While using the search function:

  • Down , Up : select next / previous result
  • Esc , Tab : close search
  • Enter : go to highlighted page in the results