title: CFE-ConfigValidator-1: Section not valid outside of game modes
CFE-ConfigValidator-1: Section not valid outside of game modes
This error occurs when MPF needs to reference player variables in a
device but you defined the device in a non-game
mode (i.e. with
game_mode: false
) such as the attract mode. Game modes will always end
when the game ends. Non-game modes can run all the time but they should
not access player variables as they do not exist outside of a game.
Certain devices enforce the latter.
Examples
For instance, a counter can store its state in a player variable which is only possible in a game mode:
##! mode: my_game_mode
mode:
start_events: ball_started
stop_events: ball_stopped
game_mode: true # this is the default
counters:
counter_per_player:
count_events: count_up
persist_state: true
However, if you set persist_state: False
in your counter it can also
be used outside of a mode:
##! mode: attract
mode:
game_mode: false
counters:
counter_outside_of_a_game:
count_events: count_up
persist_state: false
Those settings are described in the config reference of your device.
Common Pitfalls
Variable_Players
Variable player will by default use player variables. However, if you use
action: add_machine
or action: set_machine
you can also use it to
add/set machine variables which work in non-game modes.
Attract Mode
Attract mode only runs outside of a game so you cannot reference player here. However, you can use machine variables
Match Mode and High Score Mode
Those modes run at game end and are technically no longer game modes. Therefore, you cannot reference a player here. You might want to put your stuff into a custom mode which run at ball end (but not game end) instead (i.e. the bonus mode). Alternatively, you might want to use machine variables instead of player variables.
Need more help troubleshooting?
Have a look at our Troubleshooting section. It might give you some hints for certain classes of problems.
What if this did not fix your problem?
Please tell us about your error in the community forum and we might be able to update this page afterwards. Or even better: You help us to update it afterwards.
Is something missing here? Do you have a helpful hint for others experiencing this error?
Please create a Pull Request and add it. Alternatively, please tell us in the community forum.
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