Skip to content

Attract (mode)

MPF includes a built-in attract mode which is what runs the machine when a game is not in progress. It starts when either the game_ended or reset_complete event is posted, and it stops when the game_start mode is posted. The attract mode runs at priority 10.

The code and configuration for the built-in attract mode is in the mpf/modes/attract folder. It's automatically added to the list of modes in the modes: section of your machine-wide config based on settings in the mpfconfig.yaml baseline configuration file.

The attract mode is responsible for many things, including:

  • Watching for the start button to be pressed & released to kick off the request_to_start_game event
  • Recording how long the start button was held in for in order to take different actions based on different times. (For example, maybe pressing the start button normally starts a regular game, and doing a long-press lets the player login with a custom player profile.)
  • Recording what other buttons were active when the start button is pressed. (Maybe holding the right flipper button and pushing start enables tournament mode.)

You can completely customize and extend the attract mode. In most cases that's as simple as adding a config file for the attract mode to your game folder and then configuring light and display shows to play. See the tutorial for details on how to do this.

Related How To Guides

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