player_vars:

Config file section

Valid in machine config files YES
Valid in mode config files NO

The player_vars: section of your machine-wide config file lets you specify the initial state of player variables that are set for a player when the game starts.

Example:

#config_version=5

player_vars:
  some_var:
    initial_value: 4
  some_float:
    initial_value: 4
    value_type: float
  some_string:
    initial_value: 4
    value_type: str
  some_other_string:
    initial_value: hello
    value_type: str  # required for non-ints

machine_vars:
  test1:
    initial_value: 4
    value_type: int
  test2:
    initial_value: '5'
    value_type: str

# below is the min config we need to be able to start a game

game:
    balls_per_game: 3

coils:
    eject_coil1:
        number:
    eject_coil2:
        number:

switches:
    s_start:
        number:
        tags: start
    s_ball_switch1:
        number:
    s_ball_switch2:
        number:
    s_ball_switch_launcher:
        number:

playfields:
    playfield:
        default_source_device: bd_launcher
        tags: default

ball_devices:
    bd_trough:
        eject_coil: eject_coil1
        ball_switches: s_ball_switch1, s_ball_switch2
        debug: true
        confirm_eject_type: target
        eject_targets: bd_launcher
        tags: trough, drain, home
    bd_launcher:
        eject_coil: eject_coil2
        ball_switches: s_ball_switch_launcher
        debug: true
        confirm_eject_type: target
        eject_timeouts: 2s

Required settings

The following sections are required in the player_vars: section of your config:

initial_value:

Single value, type: string. Defaults to empty.

The initial value of this player variable that you’re setting. This is set when the player is created.

Optional settings

The following sections are optional in the player_vars: section of your config. (If you don’t include them, the default will be used).

value_type:

Single value, type: one of the following options: str, float, int. Default: int

Select one of the options from this list: int (integer), float, or str (string). The default is “int”, and there is no intelligence to try to detect which type of value you have, so if you have a floating point number or a string, you also need to set the value_type.