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.

logic_blocks (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

lights:
  led1:
    number:
  led2:
    number:
  led3:
    number:

switches:
  s_qualify1:
    number:
  s_qualify2:
    number:

# system wide logic blocks
accruals:
    accrual1:
        events:
            - accrual1_step1a, accrual1_step1b, accrual1_step1c
            - accrual1_step2a, accrual1_step2b, accrual1_step2c
            - accrual1_step3a, accrual1_step3b, accrual1_step3c
        events_when_complete: accrual1_complete1, accrual1_complete2
        enable_events: accrual1_enable
        disable_events: accrual1_disable
        reset_events: accrual1_reset
        events_when_hit: accrual1_hit
        advance_random_events: accrual1_random_advance
    accrual2:
        events:
            - accrual2_step1
            - accrual2_step2
        restart_events: accrual2_restart
    accrual3:
        events:
            - accrual3_step1
            - accrual3_step2
        reset_on_complete: False
        disable_on_complete: True
        enable_events: accrual3_enable
        disable_events: accrual3_disable
        reset_events: accrual3_reset
    accrual4:
        events:
            - accrual4_step1
            - accrual4_step2
        reset_on_complete: False
        disable_on_complete: False
        enable_events: accrual4_enable
        disable_events: accrual4_disable
        reset_events: accrual4_reset
    accrual10:
        events:
            - accrual10_step1
            - accrual10_step2
        reset_on_complete: True
        disable_on_complete: False
        enable_events: accrual10_enable
        disable_events: accrual10_disable
        reset_events: accrual10_reset
    accrual7:
        events:
          - accrual7_step1
          - accrual7_step2
          - accrual7_step3
        events_when_complete: accrual7_complete
        events_when_hit: accrual7_hit
        reset_on_complete: True
        disable_on_complete: False
        enable_events: accrual7_enable
        disable_events: accrual7_disable
        reset_events: accrual7_reset
        logic_block_timeout: 50
counters:
    counter1:
        count_events: counter1_count
        starting_count: 5
        count_complete_value: 0
        direction: down
        enable_events: counter1_enable
        disable_events: counter1_disable
        restart_events: counter1_restart
        reset_events: counter1_reset
    counter3:
        count_events: counter3_count
        starting_count: 0
        count_complete_value: 5
        count_interval: -1
        direction: up
        enable_events: counter3_enable
        disable_events: counter3_disable
        restart_events: counter3_restart
        reset_events: counter3_reset
        multiple_hit_window: 1s
    counter4:
        count_events: counter4_count
        starting_count: machine.start if machine.start else 0
        count_complete_value: current_player.hits
        direction: up
        enable_events: counter4_enable
        disable_events: counter4_disable
        restart_events: counter4_restart
        reset_events: counter4_reset
    counter5:
        count_events: counter5_count
    counter9:
        count_events: counter9_count
        starting_count: 5
        count_complete_value: 0
        direction: down
        enable_events: counter9_enable
        disable_events: counter9_disable
        restart_events: counter9_restart
        reset_events: counter9_reset
        logic_block_timeout: 50
sequences:
    sequence1:
        events:
            - sequence1_step1a, sequence1_step1b
            - sequence1_step2a, sequence1_step2b
            - sequence1_step3a, sequence1_step3b
        events_when_complete: sequence1_complete
        enable_events: sequence1_enable
        disable_events: sequence1_disable
        reset_events: sequence1_reset
    sequence2:
        events:
            - sequence2_step1a, sequence2_step1b
            - sequence2_step2a, sequence2_step2b
            - sequence2_step3a, sequence2_step3b
        events_when_complete: sequence2_complete
        enable_events: sequence2_enable
        disable_events: sequence2_disable
        reset_events: sequence2_reset
        logic_block_timeout: 50

# logic blocks in mode1
modes:
    - mode1
    - mode2
    - mode3
    - mode4

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: start_mode1
  stop_events: stop_mode1

counters:
  counter2:
      count_events: counter2_count
      events_when_hit: counter2_hit
      events_when_complete: counter2_complete
      starting_count: 0
      count_complete_value: 3
      direction: up
      reset_on_complete: True
      disable_on_complete: False
  counter_persist:
      count_events: counter_persist_count
      enable_events: counter_persist_enable
      direction: down
      starting_count: 5
      count_complete_value: 0
      persist_state: true
accruals:
  accrual5:
      events:
        - accrual5_step1
        - accrual5_step2
      persist_state: True
#config_version=5
mode:
  start_events: start_mode3
  stop_events: stop_mode3

counters:
  qualify1:
      count_events: qualify1_count, s_qualify1_active
      disable_events: disable_qualify
      enable_events: enable_qualify
      start_enabled: True
      events_when_complete: disable_qualify, qualify_start_mode1
      starting_count: 0
      count_complete_value: 3
      persist_state: True
      debug: True
  qualify2:
      count_events: qualify2_count, s_qualify2_active
      disable_events: disable_qualify
      enable_events: enable_qualify
      start_enabled: True
      events_when_complete: disable_qualify, qualify_start_mode2
      starting_count: 0
      count_complete_value: 3
      persist_state: True
      debug: True
#config_version=5
mode:
  start_events: start_mode4
  stop_events: stop_mode4

counters:
  counter6:
      count_events: counter6_count
      events_when_hit: counter6_hit
      events_when_complete: counter6_complete
      starting_count: 0
      count_complete_value: 10
      direction: up
      reset_on_complete: True
      disable_on_complete: False
      control_events:
          - event: increase_counter6_5
            action: add
            value: 5
          - event: increase_counter6_3
            action: add
            value: 3
          - event: increase_counter6_0
            action: add
            value: 0
          - event: reduce_counter6_5
            action: subtract
            value: 5
          - event: reduce_counter6_3
            action: subtract
            value: 3
          - event: reduce_counter6_0
            action: subtract
            value: 0
          - event: set_counter6_25
            action: jump
            value: 25
          - event: set_counter6_0
            action: jump
            value: 0
  counter7:
      count_events: counter7_count
      events_when_hit: counter7_hit
      events_when_complete: counter7_complete
      starting_count: 5
      count_complete_value: 0
      direction: down
      reset_on_complete: True
      disable_on_complete: False
      control_events:
          - event: increase_counter7_5
            action: add
            value: 5
          - event: reduce_counter7_5
            action: subtract
            value: 5
          - event: reduce_counter7_3
            action: subtract
            value: 3
          - event: set_counter7_negative25
            action: jump
            value: -25
          - event: set_counter7_3
            action: jump
            value: 3
          - event: set_counter7_0
            action: jump
            value: 0
          - event: set_counter_placeholder
            action: jump
            value: machine.test2
          - event: subtract_counter_placeholder
            action: subtract
            value: machine.test3
          - event: add_counter_placeholder
            action: add
            value: machine.test4

accruals:
  accrual6:
      events:
        - accrual6_step1
        - accrual6_step2
      persist_state: True
#config_version=5
mode:
  start_events: start_mode2
  stop_events: stop_mode2

counters:
  counter_with_lights:
      count_events: counter_with_lights_count
      enable_events: counter_with_lights_enable
      starting_count: 0
      count_complete_value: 3
      direction: up
      persist_state: True

show_player:
  logicblock_counter_with_lights_updated:
    counter_show:
      start_step: device.counters.counter_with_lights["value"] + 1

shows:
  counter_show:
    - duration: -1
      lights:
        led1: on
        led2: stop
        led3: stop
    - duration: -1
      lights:
        led1: stop
        led2: on
        led3: stop
    - duration: -1
      lights:
        led1: stop
        led2: stop
        led3: on