Config Players
An important concept to using the YAML-based configuration files is something we call config players.
Config players in MPF have nothing to with the actual human players of your machine, rather, they are things that "play" based on configurations.
Config players are used in both the machine-wide and mode-specific config files, and also in show steps.
- In a config file, the config players are setup via the
(config_player_name)_player:
section of the file. - In show steps, config players are accessed via the
(config_player_name)s:
setting.
Some examples:
- You play sounds via a config file in the
sound_player:
section, and you play sounds from a show step via thesounds:
setting for that step. - You show slides on a display via a config file in the
slide_player:
section, and you show slides from a show step via theslides:
setting for that step. - You set the color of LEDs via a config file in the
light_player:
section, and you set colors from a show step via thelights:
setting for that step. - You set player and machine variables based on events in the
variable_player:
section (this is commonly used for scoring in your machine), and you set variables from a show step via thevariables:
setting of that step. - etc.
Config players in MPF
- Blinkenlight player
- Coil player
- Using LEDs as display (display_light_player)
- Event player
- Flasher player
- GI (general illumination) player
- Hardware Sound player
- LED player
- Light player
- Playlist player
- Queue Event player
- Queue Relay player
- Random event player
- Segment Display player
- Show player
- Slide player
- Sound Loop player
- Sound player
- Track player
- Variable player
- Widget player
Video about events in MPF:
Video about shows:
Standalone Config Player
General syntax looks like this in a standalone player:
Normal syntax
example_player:
event_which_is_posted_elsewhere:
<depends on the player>
For example (show_player; short syntax):
show_player:
event_which_is_posted_elsewhere:
your_show: play
Another example (show_player; long syntax):
show_player:
event_which_is_posted_elsewhere:
your_show:
action: play
sync_ms: 1000
One line syntax
This is not supported in all players. This usually performs the default action on the element:
example_player:
event_which_is_posted_elsewhere: <depends on the player>
An example (show_player):
show_player:
event_which_is_posted_elsewhere: your_show
Subscription syntax
This is not supported for all variables and all players. It will perform the action (i.e. play a show or enable a light) when the condition becomes true. Later it will remove/stop the action (i.e. stop the show or disable the light) when the condition becomes false.
example_player:
"{machine.test_machine_var == 23}":
<depends on the player>
An example (light_player):
light_player:
"{current_player.score > 1000000}":
score_1M: white
See Conditional Events for details about conditionals.
Config Player in a Show
All config players also work in shows. However, you need to skip the event which triggers the player since the action is triggered by the show.
Normal syntax
This supports the same syntax as above (just without the event). Also
note that instead of example_player:
it becomes examples:
.
- duration: 2s
examples:
<depends on the player>
For example (show_player; short syntax):
##! show: test
- duration: 2s
shows:
your_show: play
Another example (show_player; long syntax):
##! show: test
- duration: 2s
shows:
your_show:
action: play
sync_ms: 1000
One line syntax
There is no one line syntax in shows.
There are several different config players in MPF and MPF-MC. Click on each below for specific details of how to use them, with explanations of how to use them in config files and in shows.
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