Mistake in MPF Tutorial? (no mode_attract_started)

43 views
Skip to first unread message

soraxxo

unread,
May 26, 2019, 5:56:57 PM5/26/19
to MPF Users

Hi! I've been following this project for a while, finally plugging through the tutorials and configuring a project I've been wanting to build.

First, I'd like to say thanks for the incredible efforts y'all have put in. I haven't gotten in too deep yet, but I feel that this has been a very well documented and engineered package, and I'm really excited to work with it.

I ran into some trouble on Step 5 of the tutorial (http://docs.missionpinball.org/en/latest/tutorial/5_add_a_display.html) and I think it might be due to outdated info, so I wanted to mention it here so it can be updated if needed:

When I get to the part where we add an event handler for 
mode_attract_started
 to change slides, it does not go to the attract mode slide. I noticed in the console log for the mpf-mc window that
mode_attract_started
was never mentioned. I had to change the slide_player to respond to another event call that was coming up (I chose 
client_connected
) in order 
to get it to work as described in the tutorial.

Is the event
mode_attract_started
no longer used in current builds of MPF? (For the record, I'm running v0.53.0-dev.31, because I'm planning to develop my machine against a VPX simulation of the table until I have the time and resources to fabricate a physical playfield.)

jabdoa

unread,
May 26, 2019, 6:33:44 PM5/26/19
to MPF Users
Hi soraxxo,

first: Welcome to MPF! Good work on debugging that issue while being new to the project. To me it looks like the tutorial is unclear in step 5. You should get mode_attract_started if you start MPF (mpf game) + MPF-MC (mpf mc). You could run "mpf both" to start them both. However, the tutorial explicitly mentions "mpf mc". Since the modes run on the MPF side and not in the media controller this will only work if you start both. We explain that later in paragraph 7 but it actually might be already needed in 6. Can you verify that? I guess we should clarify it a bit.


Jan

soraxxo

unread,
May 26, 2019, 9:47:59 PM5/26/19
to MPF Users
Hi Jan, thanks for the quick reply! (And apologies for the wonky formatting; I thought I could use code blocks to stylize commands in-line with text, like you can on Slack etc.)

Having followed the tutorials from installing Python up through the page I linked to, I was not getting mode_attract_started in the console output or either of the log files with my dev build of MPF, regardless of whether I start with "mpf game" and "mpf mc" in separate command prompt windows or with "mpf both".

The thing that confused me while I was working on this was the fact that I had not declared any modes, or logic for switching between modes, so I couldn't figure out how the machine's default logic would get me to an attract_started state to trigger a related event callback. (Seriously, I didn't even have a top-level modes: in my config file. Just the welcome and attract slide definitions under the top-level slide_player.)

Related: I cannot find /mpf-examples/tutorial/config/step5.yaml to cross-reference in my local copy of mpf-examples. Nor can I find it on the Github repo (https://github.com/missionpinball/mpf-examples/tree/dev/tutorial only has Step 2 and a readme, which is the same as my local copy.)

I'm going to dig a little more and see if I missed a step along the way or something.

jabdoa

unread,
May 27, 2019, 2:11:13 AM5/27/19
to MPF Users
There is a default attract mode in MPF. It handles the start button and such.

Did you already configure your "hardware"? If yes that might be the issue. MPF will wait until the hardware is initialized/booted. In case of VPX you would have to start it and start your table with the right script. However, you can also pass "-X" to force the default virtual platform. Can you try "mpf both -X"? If that does not help please post your config and a log. That way I can test it locally tonight.


Jan

soraxxo

unread,
May 27, 2019, 2:40:00 AM5/27/19
to MPF Users
Oh! Good catch. I put the following lines --
hardware:
 platform
: virtual_pinball
into my config pretty early on, I highly suspect that is the culprit here.

(I'm still having trouble getting VPX to create the Controller object that MPF is supposed to connect to, but that is another issue entirely... I had hoped to avoid VPX scripting entirely, so much for that, ha!)

I'm in the middle of defining my machine's switches, coils, etc (Step 13 as of this writing) so MPF is failing on run right now, but I will try "mpf both -X" once the rest of the config is stable, and report back with the result. Thanks!

soraxxo

unread,
May 27, 2019, 3:08:20 AM5/27/19
to MPF Users
OK, my machine's config is stable again -- and yes, "mpf both -X" did the trick; the event handlers work exactly as described in the tutorial now. I was just jumping the gun by trying to add a machine definition. (I'll start a separate thread for my issues with understanding how to link to my VPX table.)

Thanks again, Jan!

jabdoa

unread,
May 27, 2019, 1:08:09 PM5/27/19
to MPF Users
Thanks for testing. I guess it would not harm to just include that in the commandline.

Jan

Reply all
Reply to author
Forward
0 new messages