Warning

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

This is the documentation for MPF 0.56+, 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.

state_machine (example config files)

Machine config examples

Here are some example machine-wide config files that show real-world examples of how these configs are used.

#config_version=5

modes:
  - game_mode
  - non_game_mode

state_machines:
  my_state:
    states:
      start:
        label: Start state
      step1:
        label:
        show_when_active:
          show: on
          show_tokens: None
        events_when_started: step1_start
        events_when_stopped: step1_stop
      step2:
        label:
    transitions:
      - source: start
        target: step1
        events: state_machine_proceed
      - source: step1
        target: step2
        events: state_machine_proceed2
        events_when_transitioning: going_to_step2
      - source: step2
        target: start
        events: state_machine_proceed3
      - source: step1, step2
        target: start
        events: state_machine_reset
  second_state:
    starting_state: foo
    states:
      bar:
        label: Bar
      foo:
        label: Foo
    transitions:
      - source: foo
        target: bar
        events: state_machine_outoforder

Mode config examples

Here are some example mode config files that go along with the machine-wide config above.

Note that there are multiple mode config examples here. You might not necessarily use more than one in your machine.

#config_version=5
mode:
  start_events: machine_reset_phase_3
  game_mode: false

state_machines:
  non_game_mode_state_machine:
    persist_state: false
    states:
      start:
        label: Start state
      done:
        label: Done state
        events_when_started: non_game_mode_state_machine_done
    transitions:
      - source: start
        target: done
        events: non_game_mode_state_machine_proceed
#config_version=5
mode:
  start_events: ball_started

state_machines:
  game_mode_state_machine:
    persist_state: true
    states:
      start:
        label: Start state
      done:
        label: Done state
        events_when_started: game_mode_state_machine_done
    transitions:
      - source: start
        target: done
        events: game_mode_state_machine_proceed