Cant get manual plunger to work in VPX with MPF bridge (only autofires)

133 views
Skip to first unread message

Morten Søbyskogen

unread,
Feb 18, 2021, 9:37:44 AM2/18/21
to MPF Users
Hi everyone!
I am working on a Age of Empires 2 homebrew pinball, and have started implementing code in MPF connected to VPX with the MPF to VPX Bridge, so I can do some programming until I get the solidworks template done and can start the physical process.

I am having problems getting the logic around manual plunger in VPX to work. Is it okay that I ask it here?

In my PF config, i have the following related to the plunger: (I read another thread here, regarding combo plunger, but its in MPF without Visual Pinball):

config.yaml:
______________
switches:
    s_plunger_lane:
        number: 7
        tags: plunger_lane

coils:
    c_plunger_eject:
        number: coil7
        default_pulse_ms: 100

ball_devices:
  bd_trough:
    tags: trough, home, drain
    ball_switches: s_trough_1, s_trough_2, s_trough_3
    eject_coil: c_ballrelease
    eject_targets: bd_plunger
    entrance_count_delay: 300ms
  bd_plunger:
    ball_switches: s_plunger_lane
    entrance_count_delay: 300ms
    eject_timeouts: 3s
    eject_coil: c_plunger_eject
    mechanical_eject: true
-------------------------------------------------------------------

VPX script (Basically copied the MPF to VPX bridge demo script, which has autoplunger):

Sub UpdateSolenoids(SolNoPar,StatePar)
select Case SolNoPar
Case "coil7": Sol7(StatePar) 'Auto-Plunger
End Select
End Sub

'Sol7 Auto-Plunger
Sub Sol7(enabled)
if enabled Then
Plunger.Pullback
Plunger.Timerenabled = True
end If
End Sub

Sub Plunger_Timer
Plunger.Timerenabled = False
Plunger.Fire
PlaySound "plunger",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
End Sub
-----------------------------
As it is now it is autolaunching. I tried marking the plunger in VPX as mechanical, but it still attempts  to autolunch, it just does not manage it.
I am sure the solution is quite obvious, but I have been sitting with this too long so need to reach out, there is something I am missing =)

Thanks!
Kind regards,
Morten Andre

Scott Miller

unread,
Feb 18, 2021, 7:51:33 PM2/18/21
to MPF Users

Hi Morten, I've got a working mechanical plunger in my VPX version of Cuphead that runs in the MPF/VPX bridge.  Here are a few things to check out:

1) Make sure that the "Enable Mechanical Plunger" box is checked in the "State & Physics" section of your plunger in vpx

2) You have probably set up your vpx table to not just destroy balls when they hit the drain and create balls to drop into your shooter lane since that is not how your real pin will behave?  If that is the case then in your solenoid assignment section sub for the trough kicker (which is a plunger) put in a conditional statement to look for the trough switch to put in a delay to make sure that the plunger doesn't fire before there is a ball over it.  VPX needs some sort of device (like the drain, plunger, saucer...) to create the balls.  In this case 1-0-32 is my first position trough switch (the one closest to the plunge lane)

Sub Sol5(enabled) ' trough kicker is set up as a plunger in vpx
if enabled Then  
If controller.Switch("1-0-32") = True then  ' this is in here to prevent the solenoids from firing on table start
BallRelease.Pullback
BallRelease.Timerenabled = True
End If
end If
End Sub

With these two parts in place the drain should create your balls, they roll to your trough switches, the trough "plunger" ejects a ball to the shooter lane and then your mechanical plunger can strike the ball and launch it.

Here is a link to my Cuphead VPX table on Google Drive that you can download and look at to see the scripting and physical layout for ball handling.


Scott

Michael Fuegemann

unread,
Feb 19, 2021, 7:57:34 AM2/19/21
to MPF Users
Hi,

I think, the solution is just to remove the solenoid from the MPF plunger ball device and set the VPX plunger to "Auto Plunger" = False (State&Physics).
The VPX plunger solenoid code can be removed too.

In the Key-subs there must be some code added to trigger the manual plunger control:

 Sub Table_KeyDown(ByVal keycode)
...
    If keycode = PlungerKey Then Plunger.Pullback
...
    If vpmKeyDown(keycode) Then Exit Sub 
End Sub

Sub Table_KeyUp(ByVal keycode)
...
    If keycode = PlungerKey Then Plunger.Fire
...
End Sub

A combined manual/auto plunger may be achieved by keeping the solenoid and adding the VPX code.

Michael

Morten Søbyskogen

unread,
Feb 22, 2021, 1:26:49 PM2/22/21
to MPF Users
Thanks for the responses!
I got the manual plunger to work, and I will look more closer at the autoplunger working in combination for the multiballs when I get there, so thanks! :)

Morten

Dan - aka BorgDog

unread,
Feb 22, 2021, 8:35:53 PM2/22/21
to MPF Users
when you get the combination working please post it up, I'm looking to do this in the near future, or maybe not so near :)

Scott Miller

unread,
Feb 22, 2021, 8:55:59 PM2/22/21
to MPF Users
Dan you can download mine at the link in my post above
Reply all
Reply to author
Forward
0 new messages