Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Dazz

Plunger Code Stanadardization

Recommended Posts

One thing that I think we really needed is plunger code standardization.  Right now I think we have 3 or 4 different methods that can be used to add analog plunger code to tables. Some seem to be easier to implement than others, but others seem to be more consistent in their power when released.

 

I'm not as familiar with the methods as I would like to be, but after testing out the differences I think the impulse plunger method that Koadic uses. It seems to have the most consistent release power when released from the same tension. 

 

If anyone is familiar with the multiple plunger methods can chime in and discuss the + and - to the different methods.  Perhaps if could get someone to create a couple test tables and use a different plunger method we can determine the better way to go.

Share this post


Link to post
Share on other sites

I havent looked at kodiacs code as of yet.

When I get a chance to have a look at it ill give my opinion.

Although for the most part he is pretty good at using the most optimum code

Share this post


Link to post
Share on other sites

Hey guys...  here is the current version of my code with example Impulse Plunger initialization along with the suggested Key Down and Key Up entries and some code comments...

 

	
' Example of modified Impulse Plunger scripting. IMPowerSetting and IMTime moved down to plunger area.'

	'Impulse Plunger'
	'--------------------'
''	Set plungerIM = New cvpmImpulseP
''	With plungerIM
''		.InitImpulseP swPlunger, IMPowerSetting, IMTime
''		.Switch 16
''		.Random 1.5
''		.InitEntrySnd "PlungerPull"
''		.InitExitSnd "plunger2", "plunger"
''		.CreateEvents "plungerIM"
''	End With


'**************'
'Key Input     '
'**************'

 Sub Table1_KeyDown(ByVal keycode)
	If keycode = PlungerKey Then PlungerIM.Pullback:Pcount = 0:PTime.Enabled = 1:Plunger.TimerEnabled=0
	If vpmKeyDown(keycode) Then Exit Sub
 End Sub

 Sub Table1_KeyUp(ByVal keycode)
	If keycode = PlungerKey Then PTime.Enabled = 0:Pcount = 0:PTime2.Enabled = 1:PlungerIM.Fire
	If vpmKeyUp(keycode) Then Exit Sub
 End Sub


'        Koadic's Alpha Ramp
'   Impulse Plunger Scripting v5'
'       single ramp animated'
'        via image switching'
'------------------------------'
 Dim PDelay, PCount, PImages, PStart, IMTime, IMPowerSetting, PlFrame

 IMPowerSetting = Plunger.MechStrength	' Plunger Power - Set via Plunger MechStrength'
 IMTime = Round(Plunger.PullSpeed/10, 2)' Time in 1/10th seconds for Full Plunge - Set via Plunger Pull Speed...'
											' 1 = .1 second, 5 = .5 second, 10 = 1 second, etc.'
 PStart = 0				' Set number of first plunger image, use 1 for legacy "1-12" setup'
 PImages = 25			' Set number of animation frames not including the PStart position, use 11 for legacy "1-12" setup'
 PTime.Interval = INT(IMTime*1000/PImages)

 'This sets window for power readings to use when the analog plunger triggers a ball launch.'
 ' When the analog plunger position triggers the launch, this will grab the power to use from previous'
 ' readings going back the amount of the delay window (200ms by default). This helps compensate if the'
 ' plunger is slowed too much by friction by grabbing the power from an earlier reading.'
 'Set desired delay in editor via Plunger Release Speed'
 PDelay = CINT(Plunger.FireSpeed/Plunger.TimerInterval)
 ReDim PlPos(PDelay)
 
 ResetPlungers

 Sub ResetPlungers
	aPlunger.Image = "p" & PStart
	For x = 0 to ubound(PlPos):PlPos(x) = 0:Next
	Pcount = 0
	PRefresh.state = ABS(PRefresh.state - 1)
 End Sub

 Sub PTime_Timer
	If PCount < (PImages) Then
		PCount = PCount + 1
		aPlunger.Image = "p" & (PCount+PStart)
		PRefresh.state = ABS(PRefresh.state - 1)
	End If
 End Sub

 Sub PTime2_Timer
	Select Case PCount
		Case 0:aPlunger.Image = "p" & PStart : PRefresh.state = ABS(PRefresh.state - 1)
		Case 1:aPlunger.Image = "p" & INT(PImages/5) : PRefresh.state = ABS(PRefresh.state - 1)
		Case 2:ResetPlungers:Plunger.TimerEnabled = 1:Me.Enabled = 0
	End Select
	Pcount = Pcount + 1
 End Sub

 Sub Plunger_Timer()
	PlPos(PDelay) = Plunger.Position
	PlFrame = PlPos(PDelay)  ' can change to INT(PlPos(PDelay)/2)+1 for legacy "1-12" setups'
	'If PlFrame > 12 Then PlFrame = 12 ''uncomment and adjust if needed for using fewer animation frames'
	If PlPos(PDelay) <> PlPos(PDelay - 1) Then
		aPlunger.Image = "p" & PlFrame
		PRefresh.state = ABS(PRefresh.state - 1)
		If PlPos(PDelay) < 2 and PlPos(0) > 5 Then
			PlungerIM.Strength = (PlPos(0)/25*Plunger.MechStrength)
			PlungerIM.AutoFire
			PlungerIM.Strength = Plunger.MechStrength
			Plunger.TimerEnabled = 0:PTime2.Enabled = 1
		End If
	End If
	For x = 0 to ubound(PlPos)-1:PlPos(x)=PlPos(x+1):Next
 End Sub

Link to original

If anyone wants further information/explanation of the specifics, just ask :)

Share this post


Link to post
Share on other sites

Hi, is this something that I can just paste in to a table script? if so where?

I just received one of the new virtua pin plungers and am getting confused with the multiple ways on how to add analog plunger support to tables

 

thanks

  • Upvote 1

Share this post


Link to post
Share on other sites

No offense, but something as basic as plunger response coding should be placed in VP proper, not in table scripts.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...