'Elvira and The Party Monsters
'
VP9 table by JPSalas version 1.0
Option Explicit
ExecuteGlobal GetTextFile("b2s.vbs")
ResetB2SData 0,49,0 'Initialise the b2s data area
'***********************************************************************
' Choose where to display the THING lights
LaunchBackGlass "Elvira_and_the_Party_Monsters_B2S", false 'True=Launch bg , False=Don't launch bg.
'***********************************************************************
Randomize
LoadVPM "01560000", "S11.VBS", 3.26
Sub LoadVPM(VPMver, VBSfile, VBSver)
On Error Resume Next
If ScriptEngineMajorVersion <5 Then MsgBox "VB Script Engine 5.0 or higher required"
ExecuteGlobal GetTextFile(VBSfile)
If Err Then MsgBox "Unable to open " & VBSfile & ". Ensure that it is in the same folder as this table. " & vbNewLine & Err.Description
Set Controller = CreateObject("
B2S.Server")
'Set Controller = CreateObject("VPinMAME.Controller")
If Err Then MsgBox "Can't Load VPinMAME." & vbNewLine & Err.Description
If VPMver> "" Then If Controller.Version '.SetDisplayPosition 0,0,GetPlayerHWnd 'uncomment if you can't see the dmd
On Error Resume Next
.Run GetPlayerHWnd
If Err Then MsgBox Err.Description
On Error Goto 0
End With
' Nudging
vpmNudge.TiltSwitch = swTilt
vpmNudge.Sensitivity = 3
vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingshot, RightSlingshot)
' Trough
Set bsTrough = New cvpmBallStack
With bsTrough
.InitSw 9, 11, 12, 13, 0, 0, 0, 0
.InitKick BallRelease, 80, 6
.InitEntrySnd "Solenoid", "Solenoid"
.InitExitSnd "ballrel", "Solenoid"
.Balls = 3
End With
' Lock
Set bsLock = new cvpmBallStack
With bsLock
.InitSw 0, 49, 50, 51, 0, 0, 0, 0
.InitKick BallLock, 80, 28
.InitAddSnd "metalrolling2"
.InitExitSnd "popper", "Solenoid"
.CreateEvents "bsLock", BallLock
End With
' Top Eject Hole
Set bsTP = New cvpmBallStack
With bsTP
.InitSaucer sw48, 48, 24, 19
.InitExitSnd "popper", "Solenoid"
.KickAngleVar = 3
.KickForceVar = 4
End With
' Ball Popper - VUK
Set bsBP = New cvpmBallStack
bsBP.InitSaucer sw32, 32, 0, 0
bsBP.InitKick sw32a, 190, 6
bsBP.InitExitSnd "Popper", "Solenoid"
' Drop targets
set dtbank = new cvpmdroptarget
With dtbank
.initdrop array(sw41, sw42, sw43), array(41, 42, 43)
.initsnd "droptarget", "resetdrop"
End With
' Main Timer init
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = 1
StopShake 'StartShake
BallInVuk = 0
' Init Bumper Rings and targets
LeftSLing.IsDropped = 1:LeftSLing2.IsDropped = 1:LeftSLing3.IsDropped = 1
RightSLing.IsDropped = 1:RightSLing2.IsDropped = 1:RightSLing3.IsDropped = 1
B1s1.IsDropped = 0:B1s1t.IsDropped = 0:B1s1on.IsDropped = 1:B1s1ton.IsDropped = 1
B1s2on.IsDropped = 1:B1s2ton.IsDropped = 1:B1s3on.IsDropped = 1:B1s3ton.IsDropped = 1
B2s1.IsDropped = 0:B2s1t.IsDropped = 0:B2s1on.IsDropped = 1:B2s1ton.IsDropped = 1
B2s2on.IsDropped = 1:B2s2ton.IsDropped = 1:B2s3on.IsDropped = 1:B2s3ton.IsDropped = 1
B3s1.IsDropped = 0:B3s1t.IsDropped = 0:B3s1on.IsDropped = 1:B3s1ton.IsDropped = 1
B3s2on.IsDropped = 1:B3s2ton.IsDropped = 1:B3s3on.IsDropped = 1:B3s3ton.IsDropped = 1
bump1 = 0:bump2 = 0:bump3 = 0
AllLampsOff
sw15a.IsDropped = 1:sw16a.IsDropped = 1
sw25a.IsDropped = 1:sw26a.IsDropped = 1:sw27a.IsDropped = 1:sw28a.IsDropped = 1
SolGI 0
f14a.IsDropped = 1
SolFlash13 0:SolFlash15 0:SolFlash26 0:SolFlash29 0:SolFlash30 0:SolFlash31 0:SolFlash32 0
End Sub
Sub Elvira_Paused:Controller.Pause = 1:End Sub
Sub Elvira_unPaused:Controller.Pause = 0:End Sub
Sub Elvira_exit()
Controller.Stop
End sub
sub Trigger1_hit:ClearBallId : end Sub
sub kicker2_hit:ClearBallId:kicker2.destroyball:end Sub
'**********
' Keys
'**********
Sub Elvira_KeyDown(ByVal Keycode)
If keycode = RightFlipperKey Then Controller.Switch(57) = 1
If keycode = LeftFlipperKey Then Controller.Switch(58) = 1
If keycode = LeftTiltKey Then LeftNudge 80, 1.2, 20:PlaySound "nudge_left"
If keycode = RightTiltKey Then RightNudge 280, 1.2, 20:PlaySound "nudge_right"
If keycode = CenterTiltKey Then CenterNudge 0, 1.6, 25:PlaySound "nudge_forward"
If keycode = 45 Then LeftNudge 80, 2, 30:PlaySound "nudge_left"
If keycode = 52 Then RightNudge 280, 2, 30:PlaySound "nudge_right"
If vpmKeyDown(keycode) Then Exit Sub
If keycode = PlungerKey Then Plunger.TimerEnabled = 0:Plunger.Pullback:PNewPos = 0:PTime.Enabled = 1
If keycode = KeyRules Then Rules
End Sub
Sub Elvira_KeyUp(ByVal Keycode)
If keycode = RightFlipperKey Then Controller.Switch(57) = 0
If keycode = LeftFlipperKey Then Controller.Switch(58) = 0
If vpmKeyUp(keycode) Then Exit Sub
If keycode = PlungerKey Then
PTime.Enabled = 0:PNewPos = 0:PTime2.Enabled = 1:Plunger.Fire
If(BallinPlunger = 1) then 'the ball is in the plunger lane
PlaySound "Plunger2"
else
PlaySound "Plunger"
end if
End If
End Sub
'********
'Plunger
'********
'********************************
' JP's Alpha Ramp Plunger
'********************************
Dim PNewPos, POldPos
Dim Plungers:Plungers = Array(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p12)
Dim BallinPlunger
InitARPlunger
Sub InitARPlunger
Dim i
For i = 1 to 11
Plungers(i).alpha = 0
Next
PRefresh.State= ABS(PRefresh.state -1)
PNewPos = 0:POldPos = 0
BallinPlunger = 0
End Sub
Sub swPlunger_Hit:Controller.Switch(21) = 1:BallinPlunger = 1:End Sub 'in this sub you may add a switch, for example Controller.Switch(14) = 1
Sub swPlunger_UnHit:Controller.Switch(21) = 0:BallinPlunger = 0:End Sub 'in this sub you may add a switch, for example Controller.Switch(14) = 0
Sub PTime_Timer 'pull timer
Plungers(POldPos).alpha = 0
Plungers(PNewPos).alpha = 1
PRefresh.State= ABS(PRefresh.state -1)
POldPos = PNewPos
PNewPos = PNewPos + 1
If PNewPos> 11 Then Me.Enabled = 0
End Sub
Sub PTime2_Timer 'release timer
Plungers(POldPos).alpha = 0
Plungers(PNewPos).alpha = 1
PRefresh.State= ABS(PRefresh.state -1)
POldPos = PNewPos
PNewPos = PNewPos + 1
If PNewPos> 2 Then
Me.Enabled = 0
Plungers(2).alpha = 0
Plungers(0).alpha = 1
PRefresh.State= ABS(PRefresh.state -1)
End If
End Sub
'PinWizard Plunger script
'Turn on the Plunger timer if analog plunger is detected
Dim AnPlNewPos, AnPlOldPos
AnPlNewPos = 0:AnPlOldPos = 0
If Plunger.MotionDevice> 0 Then
Plunger.TimerEnabled = 1
Plunger.MechPlunger = 1
End If
Sub Plunger_Timer()
If Plunger.MotionDevice> 0 Then
Plungers(AnPlOldPos).alpha = 0
AnPlNewPos = Plunger.Position \ 2
Plungers(AnPlNewPos).alpha = 1
PRefresh.State= ABS(PRefresh.state -1)
AnPlOldPos = AnPlNewPos
End if
End Sub
'*************************************
' Nudge System
' based on Noah's nudgetest table
'*************************************
Dim LeftNudgeEffect, RightNudgeEffect, NudgeEffect
Sub LeftNudge(angle, strength, delay)
vpmNudge.DoNudge angle, (strength * (delay-LeftNudgeEffect) / delay) + RightNudgeEffect / delay
LeftNudgeEffect = delay
RightNudgeEffect = 0
RightNudgeTimer.Enabled = 0
LeftNudgeTimer.Interval = delay
LeftNudgeTimer.Enabled = 1
End Sub
Sub RightNudge(angle, strength, delay)
vpmNudge.DoNudge angle, (strength * (delay-RightNudgeEffect) / delay) + LeftNudgeEffect / delay
RightNudgeEffect = delay
LeftNudgeEffect = 0
LeftNudgeTimer.Enabled = 0
RightNudgeTimer.Interval = delay
RightNudgeTimer.Enabled = 1
End Sub
Sub CenterNudge(angle, strength, delay)
vpmNudge.DoNudge angle, strength * (delay-NudgeEffect) / delay
NudgeEffect = delay
NudgeTimer.Interval = delay
NudgeTimer.Enabled = 1
End Sub
Sub LeftNudgeTimer_Timer()
LeftNudgeEffect = LeftNudgeEffect-1
If LeftNudgeEffect = 0 then LeftNudgeTimer.Enabled = False
End Sub
Sub RightNudgeTimer_Timer()
RightNudgeEffect = RightNudgeEffect-1
If RightNudgeEffect = 0 then RightNudgeTimer.Enabled = False
End Sub
Sub NudgeTimer_Timer()
NudgeEffect = NudgeEffect-1
If NudgeEffect = 0 then NudgeTimer.Enabled = False
End Sub
'*********
' Switches
'*********
' Slings
Dim LStep, RStep
Sub LeftSlingShot_Slingshot:LeftSling.IsDropped = 0:PlaySound "slingshot":vpmTimer.PulseSw 33:LStep = 0:Me.TimerEnabled = 1:End Sub
Sub LeftSlingShot_Timer
Select Case LStep
Case 0:LeftSLing.IsDropped = 0
Case 1: 'pause
Case 2:LeftSLing.IsDropped = 1:LeftSLing2.IsDropped = 0
Case 3:LeftSLing2.IsDropped = 1:LeftSLing3.IsDropped = 0
Case 4:LeftSLing3.IsDropped = 1:Me.TimerEnabled = 0
End Select
LStep = LStep + 1
End Sub
Sub RightSlingShot_Slingshot:RightSling.IsDropped = 0:PlaySound "slingshot":vpmTimer.PulseSw 34:RStep = 0:Me.TimerEnabled = 1:End Sub
Sub RightSlingShot_Timer
Select Case RStep
Case 0:RightSLing.IsDropped = 0
Case 1: 'pause
Case 2:RightSLing.IsDropped = 1:RightSLing2.IsDropped = 0
Case 3:RightSLing2.IsDropped = 1:RightSLing3.IsDropped = 0
Case 4:RightSLing3.IsDropped = 1:Me.TimerEnabled = 0
End Select
RStep = RStep + 1
End Sub
' Bally Bumper thumpers
Sub Bumper1_Hit:vpmTimer.PulseSw 35:PlaySound "bumper1":bump1 = 1:Bumper1.TimerEnabled = 1:End Sub
Sub Bumper1_Timer():UpdateBumper1:End Sub
Sub UpdateBumper1()
Select Case bump1
Case 0
If bumpLamp1 = 0 Then
B1s1.IsDropped = 0:B1s1t.IsDropped = 0:B1s1on.IsDropped = 1:B1s1ton.IsDropped = 1
Else
B1s1on.IsDropped = 0:B1s1ton.IsDropped = 0:B1s1.IsDropped = 1:B1s1t.IsDropped = 1
End If
Case 1:B1s1.IsDropped = 1:B1s1t.IsDropped = 1:B1s1on.IsDropped = 1:B1s1ton.IsDropped = 1:B1s3on.IsDropped = 0:B1s3ton.IsDropped = 0:bump1 = 2
Case 2:B1s3on.IsDropped = 1:B1s3ton.IsDropped = 1:B1s2on.IsDropped = 0:B1s2ton.IsDropped = 0:bump1 = 3
Case 3:B1s2on.IsDropped = 1:B1s2ton.IsDropped = 1:Bumper1.TimerEnabled = 0:bump1=0:UpdateBumper1
End Select
End Sub
Sub Bumper2_Hit:vpmTimer.PulseSw 36:PlaySound "bumper2":bump2 = 1:Bumper2.TimerEnabled = 1:End Sub
Sub Bumper2_Timer():UpdateBumper2:End Sub
Sub UpdateBumper2()
Select Case bump2
Case 0
If bumpLamp2 = 0 Then
B2s1.IsDropped = 0:B2s1t.IsDropped = 0:B2s1on.IsDropped = 1:B2s1ton.IsDropped = 1
Else
B2s1on.IsDropped = 0:B2s1ton.IsDropped = 0:B2s1.IsDropped = 1:B2s1t.IsDropped = 1
End If
Case 1:B2s1.IsDropped = 1:B2s1t.IsDropped = 1:B2s1on.IsDropped = 1:B2s1ton.IsDropped = 1:B2s3on.IsDropped = 0:B2s3ton.IsDropped = 0:bump2 = 2
Case 2:B2s3on.IsDropped = 1:B2s3ton.IsDropped = 1:B2s2on.IsDropped = 0:B2s2ton.IsDropped = 0:bump2 = 3
Case 3:B2s2on.IsDropped = 1:B2s2ton.IsDropped = 1:Bumper2.TimerEnabled = 0:bump2=0:UpdateBumper2
End Select
End Sub
Sub Bumper3_Hit:vpmTimer.PulseSw 37:PlaySound "bumper3":bump3 = 1:Bumper3.TimerEnabled = 1:End Sub
Sub Bumper3_Timer():UpdateBumper3:End Sub
Sub UpdateBumper3()
Select Case bump3
Case 0
If bumpLamp3 = 0 Then
B3s1.IsDropped = 0:B3s1t.IsDropped = 0:B3s1on.IsDropped = 1:B3s1ton.IsDropped = 1
Else
B3s1on.IsDropped = 0:B3s1ton.IsDropped = 0:B3s1.IsDropped = 1:B3s1t.IsDropped = 1
End If
Case 1:B3s1.IsDropped = 1:B3s1t.IsDropped = 1:B3s1on.IsDropped = 1:B3s1ton.IsDropped = 1:B3s3on.IsDropped = 0:B3s3ton.IsDropped = 0:bump3 = 2
Case 2:B3s3on.IsDropped = 1:B3s3ton.IsDropped = 1:B3s2on.IsDropped = 0:B3s2ton.IsDropped = 0:bump3 = 3
Case 3:B3s2on.IsDropped = 1:B3s2ton.IsDropped = 1:Bumper3.TimerEnabled = 0:bump3=0:UpdateBumper3
End Select
End Sub
' Eject holes
Sub Drain_Hit:ClearBallId:Playsound "drain":bsTrough.AddBall Me:End Sub
Sub Drain1_Hit:ClearBallId:Playsound "drain":bsTrough.AddBall Me:End Sub
Sub Drain2_Hit:ClearBallId:Playsound "drain":bsTrough.AddBall Me:End Sub
Sub Drain3_Hit:ClearBallId:Playsound "drain":bsTrough.AddBall Me:End Sub
Sub Drain4_Hit:ClearBallId:Playsound "drain":bsTrough.AddBall Me:End Sub
Sub sw48_Hit:PlaySound "kicker_enter":bsTP.AddBall Me:End Sub
' Rollovers
Sub sw17_Hit:la1.IsDropped = 1:Controller.Switch(17) = 1:PlaySound "sensor":End Sub
Sub sw17_UnHit:la1.IsDropped = 0:Controller.Switch(17) = 0:PlaySound"outlane":End Sub
Sub sw18_Hit:la2.IsDropped = 1:Controller.Switch(18) = 1:PlaySound "sensor":End Sub
Sub sw18_UnHit:la2.IsDropped = 0:Controller.Switch(18) = 0:End Sub
Sub sw19_Hit:la3.IsDropped = 1:Controller.Switch(19) = 1:PlaySound "sensor":End Sub
Sub sw19_UnHit:la3.IsDropped = 0:Controller.Switch(19) = 0:End Sub
Sub sw20_Hit:la4.IsDropped = 1:Controller.Switch(20) = 1:PlaySound "sensor":End Sub
Sub sw20_UnHit:la4.IsDropped = 0:Controller.Switch(20) = 0:PlaySound"outlane":End Sub
Sub sw21_Hit():Controller.Switch(21) = 1:End Sub
Sub sw21_UnHit():Controller.Switch(21) = 0:End Sub
Sub sw22_Hit:Controller.Switch(22) = 1:PlaySound "sensor":End Sub
Sub sw22_UnHit:Controller.Switch(22) = 0:End Sub
Sub sw23_Hit:la5.IsDropped = 1:Controller.Switch(23) = 1:PlaySound "sensor":End Sub
Sub sw23_UnHit:la5.IsDropped = 0:Controller.Switch(23) = 0:End Sub
Sub sw29_Hit:Controller.Switch(29) = 1:PlaySound "gate":End Sub
Sub sw29_UnHit:Controller.Switch(29) = 0:End Sub
Sub sw30_Hit:Controller.Switch(30) = 1:End Sub
Sub sw30_UnHit:Controller.Switch(30) = 0:End Sub
Sub sw31_Hit:Controller.Switch(31) = 1:End Sub
Sub sw31_UnHit:Controller.Switch(31) = 0:PlaySound "metalrolling":End Sub
Sub sw32_Hit():ClearBallId: PlaySound "kicker_enter":bsBP.AddBall Me:End Sub
Sub sw44_Hit:Controller.Switch(44) = 1:End Sub
Sub sw44_UnHit:Controller.Switch(44) = 0:End Sub
Sub sw45_Hit:la6.IsDropped = 1:Controller.Switch(45) = 1:PlaySound "sensor":End Sub
Sub sw45_UnHit:la6.IsDropped = 0:Controller.Switch(45) = 0:End Sub
Sub sw46_Hit:la7.IsDropped = 1:Controller.Switch(46) = 1:PlaySound "sensor":End Sub
Sub sw46_UnHit:la7.IsDropped = 0:Controller.Switch(46) = 0:End Sub
Sub sw47_Hit:la8.IsDropped = 1:Controller.Switch(47) = 1:PlaySound "sensor":End Sub
Sub sw47_UnHit:la8.IsDropped = 0:Controller.Switch(47) = 0:End Sub
Sub sw52_Hit:Controller.Switch(52) = 1:End Sub
Sub sw52_UnHit:Controller.Switch(52) = 0:End Sub
' Targets
Sub sw15_Hit:vpmTimer.PulseSw 15:sw15.IsDropped = 1:sw15a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw16_Hit:vpmTimer.PulseSw 16:sw16.IsDropped = 1:sw16a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw25_Hit:vpmTimer.PulseSw 25:sw25.IsDropped = 1:sw25a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw26_Hit:vpmTimer.PulseSw 26:sw26.IsDropped = 1:sw26a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw27_Hit:vpmTimer.PulseSw 27:sw27.IsDropped = 1:sw27a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw28_Hit:vpmTimer.PulseSw 28:sw28.IsDropped = 1:sw28a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw15_Timer:sw15.IsDropped = 0:sw15a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw16_Timer:sw16.IsDropped = 0:sw16a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw25_Timer:sw25.IsDropped = 0:sw25a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw26_Timer:sw26.IsDropped = 0:sw26a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw27_Timer:sw27.IsDropped = 0:sw27a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw28_Timer:sw28.IsDropped = 0:sw28a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
' Droptargets
Sub sw41_Hit:dtbank.Hit 1:End Sub
Sub sw42_Hit:dtbank.Hit 2:End Sub
Sub sw43_Hit:dtbank.Hit 3:End Sub
' Gates
Sub Gate1_Hit():PlaySound "gate":End Sub
Sub Gate2_Hit():PlaySound "gate":End Sub
Sub Gate3_Hit():PlaySound "gate":End Sub
' Flip Targets
Sub sw53_Hit()
PlaySound "target"
vpmTimer.PulseSw 55
Controller.Switch(53) = 1
elvira1.IsDropped = 1
End Sub
Sub sw54_Hit()
PlaySound "target"
vpmTimer.PulseSw 56
Controller.Switch(54) = 1
drac1.IsDropped = 1
End Sub
'*********
'Solenoids
'*********
SolCallback(1) = "bsTrough.SolIn"
SolCallback(2) = "bsTrough.SolOut"
SolCallback(3) = "dtbank.SolDropUp"
SolCallback(5) = "bsTP.SolOut"
SolCallback(6) = "SolPopper"
SolCallback(7) = "vpmSolSound ""knocker"","
SolCallback(8) = "bsLock.SolOut"
SolCallback(9) = "SolFlash9"
SolCallback(11) = "SolGI"
SolCallback(13) = "SolFlash13"
SolCallback(14) = "SolBoogie"
SolCallback(15) = "SolFlash15"
SolCallback(16) = "SetFlash 116,"
SolCallback(18) = "vpmSolSound ""slingshot"","
SolCallback(20) = "vpmSolSound ""slingshot"","
SolCallback(22) = "SolFlipReset"
SolCallback(23) = "SolRun"
SolCallback(25) = "SolFlash25"
SolCallback(26) = "SolFlash26"
SolCallback(27) = "SolFlash27"
SolCallback(28) = "SolFlash28"
'SolCallback(27) = "vpmflasher f27,"
'SolCallback(28) = "vpmflasher f28,"
SolCallback(29) = "SolFlash29"
SolCallback(30) = "SolFlash30"
SolCallback(31) = "SolFlash31"
SolCallback(32) = "SolFlash32"
Sub SolBoogie(Enabled)
If Enabled then
PlaySound "Metalhit2"
f14.IsDropped = 1
f14a.IsDropped = 0
SetFlash 114, abs(Enabled)
else
f14a.IsDropped = 1
f14.IsDropped = 0
SetFlash 114, 0
End If
End Sub
'***********************
' Special Bally Flippers
'***********************
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
Dim FlOldPos, FlNewPos, FrOldPos, FrNewPos, LF, RF
FlOldPos = 0
FlNewPos = 0
FrOldPos = 0
FrNewPos = 0
LF = Array(lf1, lf2, lf3, lf4, lf5, lf6, lf7, lf8, lf9, lf10, lf11)
RF = Array(rf1, rf2, rf3, rf4, rf5, rf6, rf7, rf8, rf9, rf10, rf11)
InitFlippers
Set MotorCallback = GetRef("UpdateFlippers")
Sub InitFlippers
Dim ii
For each ii in lf2:ii.IsDropped = 1:next
For each ii in lf3:ii.IsDropped = 1:next
For each ii in lf4:ii.IsDropped = 1:next
For each ii in lf5:ii.IsDropped = 1:next
For each ii in lf6:ii.IsDropped = 1:next
For each ii in lf7:ii.IsDropped = 1:next
For each ii in lf8:ii.IsDropped = 1:next
For each ii in lf9:ii.IsDropped = 1:next
For each ii in lf10:ii.IsDropped = 1:next
For each ii in lf11:ii.IsDropped = 1:next
For each ii in rf2:ii.IsDropped = 1:next
For each ii in rf3:ii.IsDropped = 1:next
For each ii in rf4:ii.IsDropped = 1:next
For each ii in rf5:ii.IsDropped = 1:next
For each ii in rf6:ii.IsDropped = 1:next
For each ii in rf7:ii.IsDropped = 1:next
For each ii in rf8:ii.IsDropped = 1:next
For each ii in rf9:ii.IsDropped = 1:next
For each ii in rf10:ii.IsDropped = 1:next
For each ii in rf11:ii.IsDropped = 1:next
End Sub
Sub UpdateFlippers
dim obj, a
a = rightflipper.currentangle
if a> 285 then FrNewPos = 10 else
if a <285 then FrNewPos = 9 else
if a <280 then FrNewPos = 8 else
if a <275 then FrNewPos = 7 else
if a <270 then FrNewPos = 6 else
if a <265 then FrNewPos = 5 else
if a <260 then FrNewPos = 4 else
if a <255 then FrNewPos = 3 else
if a <250 then FrNewPos = 2 else
if a <245 then FrNewPos = 1 else
if a <239 then FrNewPos = 0
If FrNewPos <> FrOldPos Then
For each obj in RF(FrOldPos):obj.IsDropped = 1:next
For each obj in RF(FrNewPos):obj.IsDropped = 0:next
FrOldPos = FrNewPos
End If
a = leftflipper.currentangle
if a> 115 then FlNewPos = 0 else
if a <115 then FlNewPos = 1 else
if a <110 then FlNewPos = 2 else
if a <105 then FlNewPos = 3 else
if a <100 then FlNewPos = 4 else
if a <95 then FlNewPos = 5 else
if a <90 then FlNewPos = 6 else
if a <85 then FlNewPos = 7 else
if a <80 then FlNewPos = 8 else
if a <75 then FlNewPos = 9 else
if a <71 then FlNewPos = 10
If FlNewPos <> FlOldPos Then
For each obj in LF(FlOldPos):obj.IsDropped = 1:next
For each obj in LF(FlNewPos):obj.IsDropped = 0:next
FlOldPos = FlNewPos
End if
End Sub
Sub SolLFlipper(Enabled)
If Enabled Then
PlaySound SFlipperOn:LeftFlipper.RotateToEnd
Else
PlaySound SFlipperOff:LeftFlipper.RotateToStart
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
PlaySound SFlipperOn:RightFlipper.RotateToEnd
Else
PlaySound SFlipperOff:RightFlipper.RotateToStart
End If
End Sub
Sub LeftFlipper_Collide(parm)
PlaySound "rubber_flipper"
End Sub
Sub RightFlipper_Collide(parm)
PlaySound "rubber_flipper"
End Sub
'****
' GI
'****
Sub SolGI(Enabled)
If Enabled Then
gi1.state = 0
gi2.state = 0
gi2b.state = 0
gi3.state = 0
'gi3a.IsDropped = 1
gi3b.state = 0
gi4.state = 0
'gi4a.IsDropped = 1
gi4b.state = 0
gi5.IsDropped = 1
gi6.state = 0
gi7.state = 0
gi8.state = 0
gi9.state = 0
gi10.state = 0
gi11.state = 0
gi11a.state = 0
gi11b.state = 0
gi12.IsDropped = 1
gi13.IsDropped = 1
gi14.IsDropped = 1
SetFlash 100, 0
Else
gi1.state = 1
gi2.state = 1
gi2b.state = 1
gi3.state = 1
'gi3a.IsDropped = 0
gi3b.state = 1
gi4.state = 1
'gi4a.IsDropped = 0
gi4b.state = 1
gi5.IsDropped = 0
gi6.state = 1
gi7.state = 1
gi8.state = 1
gi9.state = 1
gi10.state = 1
gi11.state = 1
gi11a.state = 1
gi11b.state = 1
gi12.IsDropped = 0
gi13.IsDropped = 0
gi14.IsDropped = 0
SetFlash 100, 1
End If
End Sub
'Flashers
Sub SolFlash9(Enabled):SetB2SData 7,Abs(Enabled):End Sub
Sub SolFlash13(Enabled):f13.IsDropped = abs(not Enabled):SetFlash 113, abs(Enabled):SetB2SData 8,Abs(Enabled):End Sub
Sub SolFlash15(Enabled):f15.IsDropped = abs(not Enabled):SetFlash 115, abs(Enabled):SetB2SData 9,Abs(Enabled):End Sub
Sub SolFlash25(Enabled):f25.State = abs(Enabled):SetFlash 125, abs(Enabled):SetB2SData 0,Abs(Enabled):End Sub
Sub SolFlash26(Enabled):f26b.State = abs(Enabled):f26.IsDropped = abs(not Enabled):SetFlash 126, abs(Enabled):End Sub
Sub SolFlash27(Enabled):f27.State = abs(Enabled):SetFlash 127, abs(Enabled):SetB2SData 1,Abs(Enabled):End Sub
Sub SolFlash28(Enabled):f28.State = abs(Enabled):SetFlash 128, abs(Enabled):SetB2SData 2,Abs(Enabled):End Sub
Sub SolFlash29(Enabled):SetFlash 148, abs(Enabled):SetB2SData 3,Abs(Enabled):End Sub
Sub SolFlash30(Enabled):f30.State = abs(Enabled):f30a.IsDropped = abs(not Enabled):f30b.State = abs(Enabled):SetFlash 130, abs(Enabled):SetB2SData 4,Abs(Enabled):End Sub
Sub SolFlash31(Enabled):f31.State = abs(Enabled):f31a.IsDropped = abs(not Enabled):f31b.State = abs(Enabled):SetFlash 126, abs(Enabled):SetB2SData 5,Abs(Enabled):End Sub
Sub SolFlash32(Enabled):f32.IsDropped = abs(not Enabled):SetFlash 132, abs(Enabled):SetB2SData 6,Abs(Enabled):End Sub
' Vertical Up-Kicker
Dim popperBall, popperZpos
Sub SolPopper(Enabled)
If Enabled Then
If bsBP.Balls Then
Set popperBall = sw32a.Createball
popperBall.Z = 0
popperZpos = 0
PlaySound "popper"
sw32a.TimerInterval = 2
sw32a.TimerEnabled = 1
End If
End If
End Sub
Sub sw32a_Timer
popperBall.Z = popperZpos
popperZpos = popperZpos + 10
If popperZpos> 150 Then
sw32a.TimerEnabled = 0
sw32a.DestroyBall
bsBP.ExitSol_On
End If
End Sub
' Flip reset
Sub SolFlipReset(Enabled)
If Enabled Then
PlaySound "metalhit2"
elvira1.IsDropped = 0
drac1.IsDropped = 0
Controller.Switch(53) = 0
Controller.Switch(54) = 0
End If
End Sub
' Game over mode: bumpers and slingshots are turned off
Sub SolRun(enabled)
If Enabled Then
Bumper1.Force = 10
Bumper2.Force = 10
Bumper3.Force = 10
LeftSlingShot.SlingshotStrength = 8
RightSlingShot.SlingshotStrength = 8
Else
Bumper1.Force = 0
Bumper2.Force = 0
Bumper3.Force = 0
LeftSlingShot.SlingshotStrength = 0
RightSlingShot.SlingshotStrength = 0
End If
End Sub
'*****************************
' Helpers and extra sound subs
'*****************************
Sub LRampHelp_Hit():PlaySound "ballhit":ActiveBall.VelY = 1:End Sub
Sub RRampHelp_Hit():PlaySound "ballhit":ActiveBall.VelY = 1:End Sub
Sub URampHelp_Hit():ActiveBall.VelX = - 4:PlaySound "ballhit":End Sub
Sub top1_Hit():PlaySound "ballhit":End Sub
Sub Launchball_Hit()
If ActiveBall.VelY <0 Then Playsound "metalrolling2"
End Sub
'****************************************
' JP's Fading Lamps 3.5
VP9 Fading only
' Based on PD's Fading Lights
' SetLamp 0 is Off
' SetLamp 1 is On
' LampState(x) current state
'****************************************
Dim LampState(200), FadingLevel(200)
Dim FlashState(200), FlashLevel(200)
Dim FlashSpeedUp, FlashSpeedDown
'AllLampsOff()
LampTimer.Interval = 35
LampTimer.Enabled = 1
FlashInit()
FlasherTimer.Interval = 10 'flash fading speed
FlasherTimer.Enabled = 1
Sub LampTimer_Timer()
Dim chgLamp, num, chg, ii
chgLamp = Controller.ChangedLamps
If Not IsEmpty(chgLamp) Then
For ii = 0 To UBound(chgLamp)
LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4
FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4
FlashState(chgLamp(ii, 0) ) = chgLamp(ii, 1)
Next
End If
UpdateLamps
End Sub
Sub UpdateLamps
SendLights
FadeL 1, l1, l1a
FadeL 2, l2, l2a
FadeL 3, l3, l3a
FadeL 4, l4, l4a
FadeL 5, l5, l5a
FadeL 6, l6, l6a
FadeL 7, l7, l7a
FadeL 8, l8, l8a
FadeL 9, l9, l9a
FadeL 10, l10, l10a
NFadeLm 11, l11b
NFadeWm 11, l11a
NFadeL 11, l11
FadeL 12, l12, l12a
FadeL 13, l13, l13a
FadeL 14, l14, l14a
FadeL 15, l15, l15a
FadeL 16, l16, l16a
NFadeL 17, l17
NFadeL 18, l18
FadeL 19, l19, l19a
NFadeLm 20, l20b
NFadeWm 20, l20a
NFadeL 20, l20
FadeL 21, l21, l21a
FadeL 22, l22, l22a
FadeL 23, l23, l23a
FadeL 24, l24, l24a
NFadeL 25, l25
FadeL 26, l26, l26a
FadeL 27, l27, l27a
FadeL 28, l28, l28a
FadeL 29, l29, l29a
FadeL 30, l30, l30a
FadeL 31, l31, l31a
FadeL 32, l32, l32a
FadeL 33, l33, l33a
FadeL 34, l34, l34a
FadeL 35, l35, l35a
FadeL 36, l36, l36a
FadeL 37, l37, l37a
FadeL 38, l38, l38a
FadeL 39, l39, l39a
FadeL 40, l40, l40a
FadeL 41, l41, l41a
FadeL 42, l42, l42a
FadeL 43, l43, l43a
FadeL 44, l44, l44a
FadeL 45, l45, l45a
FadeL 46, l46, l46a
FadeL 47, l47, l47a
FadeL 48, l48, l48a
FadeL 49, l49, l49a
FadeL 50, l50, l50a
FadeL 51, l51, l51a
FadeL 52, l52, l52a
FadeL 53, l53, l53a
NFadeB1 54
NFadeB2 55
NFadeB3 56
NFadeW 57, l57
NFadeW 58, l58
NFadeW 59, l59
NFadeL 60, l60
NFadeL 61, l61
NFadeL 62, l62
NFadeL 63, l63
NFadeL 64, l64
End Sub
Sub FlasherTimer_Timer()
Flash 1, z1
Flash 2, z2
Flash 3, z3
Flash 4, z4
Flash 5, z5
Flash 6, z6
Flash 7, z7
Flash 8, z8
Flash 9, z9
Flash 10, z10
Flashm 11, z11
Flashm 11, z11a
Flashm 11, z11a1
Flash 11, z11a2
Flash 12, z12
Flash 13, z13
Flash 14, z14
Flash 15, z15
Flash 16, z16
Flash 17, z17
Flash 18, z18
Flash 19, z19
Flashm 20, z20
Flashm 20, z20a
Flashm 20, z20a1
Flash 20, z20a2
Flash 21, z21
Flash 22, z22
Flash 23, z23
Flash 24, z24
Flash 25, z25
Flash 26, z26
Flash 27, z27
Flash 28, z28
Flash 29, z29
Flash 30, z30
Flash 31, z31
Flash 32, z32
Flash 33, z33
Flash 34, z34
Flash 35, z35
Flash 36, z36
Flash 37, z37
Flash 38, z38
Flash 39, z39
Flash 40, z40
Flash 41, z41
Flash 42, z42
Flash 43, z43
Flash 44, z44
Flash 45, z45
Flash 46, z46
Flash 47, z47
Flash 48, z48
Flash 49, z49
Flash 50, z50
Flash 51, z51
Flash 52, z52
Flash 53, z53
Flashm 54, z54
Flash 54, z54a
Flashm 55, z55
Flash 55, z55a
Flashm 56, z56
Flash 56, z56a
'Flash 58, z58
'Flash 59, z59
'Flash 60, z60
'Flash 61, z61
'Flash 62, z62
'Flash 63, z63
'Flash 64, z64
'Flash 65, z65
'Flash 66, z66
'Flash 67, z67
'Flash 68, z68
'Flash 69, z69
'Flash 70, z70
'Flash 71, z71
'Flash 72, z72
'Flash 73, z73
'Flash 74, z74
'Flash 75, z75
'Flash 76, z76
'Flash 77, z77
'Flash 78, z78
'Flash 79, z79
'Flash 80, z80
'Flash 81, z81
'Flash 82, z82
'Flash 83, z83
'Flash 84, z84
'Flash 85, z85
'Flash 86, z86
'Flash 87, z87
'Flash 88, z88
'Flash 89, z89
Flash 116, z116
Flash 148, z148
Flash 131, z131
Flash 130, z130
Flash 125, z125
Flash 115, z115
Flash 114, z114
Flash 113, z113
Flash 126, z126
Flashm 127, z127
Flash 127, z127a
Flashm 128, z128
Flash 128, z128a
Flash 132, z132
'***********GI************'
Flashm 100, z100
Flashm 100, z100a
Flashm 100, z100a1
Flashm 100, z100a2
Flashm 100, z100a3
Flashm 100, z100a4
Flashm 100, z100a5
Flashm 100, z100a6
Flashm 100, z100a7
Flashm 100, z100a8
Flashm 100, z100a9
Flashm 100, z100a10
Flashm 100, z100a11
Flashm 100, z100a12
Flashm 100, z100a13
Flashm 100, z100a14
Flashm 100, z100a15
Flashm 100, z100a16
Flashm 100, z100a17
Flashm 100, z100a18
Flashm 100, z100a19
Flashm 100, z100a20
Flashm 100, z100a21
Flashm 100, z100a22
Flashm 100, z100a23
Flashm 100, z100a24
Flashm 100, z100a25
Flashm 100, z100a26
Flashm 100, z100a27
Flash 100, z100a28
'Flashm 100, z100a29
'Flashm 100, z100a30
'Flashm 100, z100a31
End Sub
Sub AllLampsOff():For x = 1 to 200:LampState(x) = 4:Next:UpdateLamps:UpdateLamps:Updatelamps:End Sub
Sub SetLamp(nr, value):LampState(nr) = abs(value) + 4:End Sub
Sub FlashInit
Dim i
For i = 0 to 200
FlashState(i) = 0
FlashLevel(i) = 0
Next
FlashSpeedUp = 50 ' fast speed when turning on the flasher
FlashSpeedDown = 25 ' slow speed when turning off the flasher, gives a smooth fading
' you could also change the default images for each flasher or leave it as in the editor
' for example
' Flasher1.Image = "fr"
AllFlashOff()
End Sub
Sub AllFlashOff
Dim i
For i = 0 to 200
FlashState(i) = 0
Next
End Sub
Sub SetFlash(nr, stat)
FlashState(nr) = ABS(stat)
End Sub
Sub Flash(nr, object)
Select Case FlashState(nr)
Case 0 'off
FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown
If FlashLevel(nr) < 0 Then
FlashLevel(nr) = 0
FlashState(nr) = -1 'completely off
End if
Object.alpha = FlashLevel(nr)
Case 1 ' on
FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp
If FlashLevel(nr) > 255 Then
FlashLevel(nr) = 255
FlashState(nr) = -2 'completely on
End if
Object.alpha = FlashLevel(nr)
End Select
End Sub
Sub Flashm(nr, object) 'multiple flashers, it doesn't change the flashstate
Select Case FlashState(nr)
Case 0 'off
Object.alpha = FlashLevel(nr)
Case 1 ' on
Object.alpha = FlashLevel(nr)
End Select
End Sub
Sub FadeW(nr, a, b, c)
Select Case LampState(nr)
Case 2:c.IsDropped = 1:LampState(nr) = 0 'Off
Case 3:b.IsDropped = 1:c.IsDropped = 0:LampState(nr) = 2 'fading...
Case 4:a.IsDropped = 1:b.IsDropped = 0:LampState(nr) = 3 'fading...
Case 5:c.IsDropped = 1:a.IsDropped = 0:LampState(nr) = 1 'ON
End Select
End Sub
Sub FadeWm(nr, a, b, c)
Select Case LampState(nr)
Case 2:c.IsDropped = 1
Case 3:b.IsDropped = 1:c.IsDropped = 0
Case 4:a.IsDropped = 1:b.IsDropped = 0
Case 5:c.IsDropped = 1:a.IsDropped = 0
End Select
End Sub
Sub NFadeW(nr, a)
Select Case LampState(nr)
Case 4:a.IsDropped = 1:LampState(nr) = 0
Case 5:a.IsDropped = 0:LampState(nr) = 1
End Select
End Sub
Sub NFadeWm(nr, a)
Select Case LampState(nr)
Case 4:a.IsDropped = 1
Case 5:a.IsDropped = 0
End Select
End Sub
Sub NFadeWi(nr, a)
Select Case LampState(nr)
Case 5:a.IsDropped = 1:LampState(nr) = 0
Case 4:a.IsDropped = 0:LampState(nr) = 1
End Select
End Sub
Sub FadeL(nr, a, b)
Select Case LampState(nr)
Case 2:b.state = 0:LampState(nr) = 0
Case 3:b.state = 1:LampState(nr) = 2
Case 4:a.state = 0:LampState(nr) = 3
Case 5:a.state = 1:LampState(nr) = 1
End Select
End Sub
Sub FadeLm(nr, a, b)
Select Case LampState(nr)
Case 2:b.state = 0
Case 3:b.state = 1
Case 4:a.state = 0
Case 5:a.state = 1
End Select
End Sub
Sub NFadeL(nr, a)
Select Case LampState(nr)
Case 4:a.state = 0:LampState(nr) = 0
Case 5:a.State = 1:LampState(nr) = 1
End Select
End Sub
Sub NFadeLm(nr, a)
Select Case LampState(nr)
Case 4:a.state = 0
Case 5:a.State = 1
End Select
End Sub
Sub FadeR(nr, a)
Select Case LampState(nr)
Case 2:a.SetValue 3:LampState(nr) = 0
Case 3:a.SetValue 2:LampState(nr) = 2
Case 4:a.SetValue 1:LampState(nr) = 3
Case 5:a.SetValue 0:LampState(nr) = 1
End Select
End Sub
Sub FadeRm(nr, a)
Select Case LampState(nr)
Case 2:a.SetValue 3
Case 3:a.SetValue 2
Case 4:a.SetValue 1
Case 5:a.SetValue 0
End Select
End Sub
Sub NFadeT(nr, a, b)
Select Case LampState(nr)
Case 4:a.Text = "":LampState(nr) = 0
Case 5:a.Text = b:LampState(nr) = 1
End Select
End Sub
Sub NFadeTm(nr, a, b)
Select Case LampState(nr)
Case 4:a.Text = ""
Case 5:a.Text = b
End Select
End Sub
Sub NFadeWi(nr, a)
Select Case LampState(nr)
Case 4:a.IsDropped = 0:LampState(nr) = 0
Case 5:a.IsDropped = 1:LampState(nr) = 1
End Select
End Sub
Sub NFadeWim(nr, a)
Select Case LampState(nr)
Case 4:a.IsDropped = 0
Case 5:a.IsDropped = 1
End Select
End Sub
Sub FadeLCo(nr, a, b) 'fading collection of lights
Dim obj
Select Case LampState(nr)
Case 2:vpmSolToggleObj b, Nothing, 0, 0:LampState(nr) = 0
Case 3:vpmSolToggleObj b, Nothing, 0, 1:LampState(nr) = 2
Case 4:vpmSolToggleObj a, Nothing, 0, 0:LampState(nr) = 3
Case 5:vpmSolToggleObj a, Nothing, 0, 1:LampState(nr) = 1
End Select
End Sub
Sub FlashL(nr, a, b) ' simple light flash, not controlled by the rom
Select Case LampState(nr)
Case 2:b.state = 0:LampState(nr) = 0
Case 3:b.state = 1:LampState(nr) = 2
Case 4:a.state = 0:LampState(nr) = 3
Case 5:a.state = 1:LampState(nr) = 4
End Select
End Sub
Sub MFadeL(nr, a, b, c) 'Light acting as a flash. C is the light number to be restored
Select Case LampState(nr)
Case 2:b.state = 0:LampState(nr) = 0: If LampState© = 1 Then SetLamp c, 1
Case 3:b.state = 1:LampState(nr) = 2
Case 4:a.state = 0:LampState(nr) = 3
Case 5:a.state = 1:LampState(nr) = 1
End Select
End Sub
Sub NFadeB1(nr) 'New Bally Bumper Thumpers: only sets a variable
Select Case LampState(nr)
Case 4:bumpLamp1=0:UpdateBumper1:LampState(nr) = 0
Case 5:bumpLamp1=1:UpdateBumper1:LampState(nr) = 1
End Select
End Sub
Sub NFadeB2(nr) 'New Bally Bumper Thumpers: only sets a variable
Select Case LampState(nr)
Case 4:bumpLamp2=0:UpdateBumper2:LampState(nr) = 0
Case 5:bumpLamp2=1:UpdateBumper2:LampState(nr) = 1
End Select
End Sub
Sub NFadeB3(nr) 'New Bally Bumper Thumpers: only sets a variable
Select Case LampState(nr)
Case 4:bumpLamp3=0:UpdateBumper3:LampState(nr) = 0
Case 5:bumpLamp3=1:UpdateBumper3:LampState(nr) = 1
End Select
End Sub
'******
' Rules
'******
Dim Msg(20)
Sub Rules()
Msg(0) = "Elvira and the Party Monsters - Williams 1989" &Chr(10) &Chr(10)
Msg(1) = ""
Msg(2) = "Eyes indicate number of balls locked. Enable locks by completing BAT Lanes or JAM"
Msg(3) = "Drop Targets. Lock balls (3 to start Multi-Ball) in Skull. During Multi-Ball, ride Monster"
Msg(4) = "Slide and Party Punch ramps for JACKPOT."
Msg(5) = ""
Msg(6) = "Light Dead Heads on backboard to spot MILLION shot on Eject Hole by shooting for"
Msg(7) = "Dead Head Targets. Light Barbeque on Eject Hole by flipping both Flip-Up Targets."
Msg(8) = ""
Msg(9) = "Vie for 3 Million Points. Light the Monster Slide to spot an ELVIRA letter by"
Msg(10) = "completing Dead Head Targets, BAT Lanes, or JAM Drop Targets. Spot letter by riding"
Msg(11) = "the Slide. Spelling ELVIRA lights Skull for 3 Million on timer."
Msg(12) = ""
Msg(13) = "Increase the Boogie Bonus with JAM Targets and Bumpers. JAM Targets"
Msg(14) = "also light Eject Hole to collect Boogie Bonus."
Msg(15) = ""
Msg(16) = "Ride Monster Slide Ramp. Ramp builds till 1 Million scored. Each shot then"
Msg(17) = "collects 250,000 points and spots an ELVIRA letter."
Msg(18) = ""
Msg(19) = "A Party Punch Ramp shot collects and advances current position value."
Msg(20) = "Scoring 250,000 points on ramp awards EXTRA BALL."
For X = 1 To 20
Msg(0) = Msg(0) + Msg(X) &Chr(13)
Next
MsgBox Msg(0), , " Instructions and Rule Card"
End Sub
'***********************************************************************************************
'*****************************************
B2S ************************************************
'***********************************************************************************************
Dim LFStI,LFSpI,RFStI,RFSpI,LFC,RFC,LFD,RFD
LFStI=LeftFlipper.Strength: LFSpI=LeftFlipper.Speed:LFC=1:LFD=0
RFStI=RightFlipper.Strength: RFSpI=RightFlipper.Speed:RFC=1:RFD=0
Sub LRF_Timer()
If LFD=0 Then 'down
If LFC>1 Then
LFC=LFC-1
LeftFlipper.Strength=LFStI/LFC
LeftFlipper.Speed=LFSpI/LFC
End If
Else 'up
If LFC<4 Then
LFC=LFC+1
LeftFlipper.Strength=LFStI/LFC
LeftFlipper.Speed=LFSpI/LFC
End If
End If
If RFD=0 Then 'down
If RFC>1 Then
RFC=RFC-1
RightFlipper.Strength=RFStI/RFC
RightFlipper.Speed=RFSpI/RFC
End If
Else 'up
If RFC<4 Then
RFC=RFC+1
RightFlipper.Strength=RFStI/RFC
RightFlipper.Speed=RFSpI/RFC
End If
End If
End Sub
Sub SendLights()
B2SUpdateLed
Select Case LampState(60)
Case 4:SetB2SData 10, 0
Case 5:SetB2SData 10, 1
End Select
Select Case LampState(61)
Case 4:SetB2SData 11, 0
Case 5:SetB2SData 11, 1
End Select
Select Case LampState(62)
Case 4:SetB2SData 12, 0
Case 5:SetB2SData 12, 1
End Select
Select Case LampState(63)
Case 4:SetB2SData 13, 0
Case 5:SetB2SData 13, 1
End Select
Select Case LampState(64)
Case 4:SetB2SData 14, 0
Case 5:SetB2SData 14, 1
End Select
End Sub
'***********************************************************************************************
'*****************************************
B2S ************************************************
'***********************************************************************************************
'****************************************
' B2B Collision by Steely & Pinball Ken
'****************************************
' For use with core.vbs 3.37 or greater to grab BSize variable
Dim tnopb, nosf, iball, cnt, errMessage, B2BOn
B2BOn = 2 '0=Off, 1=On, 2=AutoDetect
CheckB2B
XYdata.interval = 10 ' <<<<< ADD timer named XYData to table
tnopb = 6 ' <<<<< SET to the "Total Number Of Possible Balls" in play at any one time
nosf = 10 ' <<<<< SET to the "Number Of Sound Files" used / B2B collision volume levels
ReDim CurrentBall(tnopb), BallStatus(tnopb)
For cnt = 0 to ubound(BallStatus) : BallStatus(cnt) = 0 : Next
'****************************************
' B2B AutoDisable for XP x64 Added by Koadic
'****************************************
Sub CheckB2B ' Added by Koadic for XP x64 handling
Dim osver, cpuver, check
On Error Resume Next
For x = 0 to 1 : If B2BOn = x Then Exit Sub : End If : Next 'If B2BOn is set manually, then end routine
Set check = CreateObject("WScript.Shell")
osver = check.RegRead ("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")
cpuver = check.RegRead ("HKLM\SYSTEM\ControlSet001\Control\Session Manager\Environment\Processor_Architecture")
If osver < 6 and cpuver = "AMD64" Then B2BOn = 0 Else B2BOn = 1 'If OS is XP and 64bit, then disable B2B
If Err Then B2BOn = 1 'If there is an error in detecting either OS or x32/x64, then default to On
On Error Goto 0
End Sub
'======================================================
' <<<<<<<<<<<<<< Ball Identification >>>>>>>>>>>>>>
'======================================================
'******************************
' Destruk's alternative vpmCreateBall for use with B2B Enabled tables
' Core.vbs calls vpmCreateBall when a ball is created from a ball stack
'******************************
Set vpmCreateBall = GetRef("B2BvpmCreateBall") ' Override the core.vbs and redefine vpmCreateBall
Function B2BvpmCreateBall(aKicker)
For cnt = 1 to ubound(ballStatus) ' Loop through all possible ball IDs
If ballStatus(cnt) = 0 Then ' If ball ID is available...
If Not IsEmpty(vpmBallImage) Then ' Set ball object with the first available ID
Set CurrentBall(cnt) = aKicker.Createsizedball(bsize).Image
Else
Set CurrentBall(cnt) = aKicker.Createsizedball(bsize)
End If
' CheckBallShading (cnt)
Set B2BvpmCreateBall = aKicker
CurrentBall(cnt).uservalue = cnt ' Assign the ball's uservalue to it's new ID
ballStatus(cnt) = 1 ' Mark this ball status active
ballStatus(0) = ballStatus(0)+1 ' Increment ballStatus(0), the number of active balls
If B2BOn > 0 Then ' If B2BOn is 0, it overrides auto-turn on collision detection
' If more than one ball active, start collision detection process
If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
End If
Exit For ' New ball ID assigned, exit loop
End If
Next
End Function
' Use CreateBallID(kickername) to manually create a ball with a BallID
' Can also be used on nonVPM tables (EM or Custom)
Sub CreateBallID(aKicker)
For cnt = 1 to ubound(ballStatus) ' Loop through all possible ball IDs
If ballStatus(cnt) = 0 Then ' If ball ID is available...
Set CurrentBall(cnt) = aKicker.Createsizedball(bsize) ' Set ball object with the first available ID
' CheckBallShading (cnt)
CurrentBall(cnt).uservalue = cnt ' Assign the ball's uservalue to it's new ID
ballStatus(cnt) = 1 ' Mark this ball status active
ballStatus(0) = ballStatus(0)+1 ' Increment ballStatus(0), the number of active balls
If B2BOn > 0 Then ' If B2BOn is 0, it overrides auto-turn on collision detection
' If more than one ball active, start collision detection process
If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
End If
Exit For ' New ball ID assigned, exit loop
End If
Next
End Sub
' Use CreateBallID2(kickername, ballsize) to manually create a custom sized ball with a BallID
' Can also be used on nonVPM tables (EM or Custom)
Sub CreateBallID2(aKicker, bsize2) ' Use to manually create a ball with a BallID with a custom size
For cnt = 1 to ubound(ballStatus) ' Loop through all possible ball IDs
If ballStatus(cnt) = 0 Then ' If ball ID is available...
Set CurrentBall(cnt) = aKicker.Createsizedball(bsize2/2) ' Set ball object with the first available ID
' CheckBallShading (cnt)
CurrentBall(cnt).uservalue = cnt ' Assign the ball's uservalue to it's new ID
ballStatus(cnt) = 1 ' Mark this ball status active
ballStatus(0) = ballStatus(0)+1 ' Increment ballStatus(0), the number of active balls
If B2BOn > 0 Then ' If B2BOn is 0, it overrides auto-turn on collision detection
' If more than one ball active, start collision detection process
If ballStatus(0) > 1 and XYdata.enabled = False Then XYdata.enabled = True
End If
Exit For ' New ball ID assigned, exit loop
End If
Next
End Sub
'Call this sub from every kicker that destroys a ball, before the ball is destroyed.
Sub ClearBallid
StopRollingSound
On Error Resume Next ' Error handling for debugging purposes
iball = ActiveBall.uservalue ' Get the ball ID to be cleared
If Err Then Msgbox Err.description & vbCrLf & iball
ballStatus(iBall) = 0 ' Clear the ball status
ballStatus(0) = ballStatus(0)-1 ' Subtract 1 ball from the # of balls in play
On Error Goto 0
End Sub
'=====================================================
' <<<<<<<<<<<<<<<<< XYdata_Timer >>>>>>>>>>>>>>>>>
'=====================================================
'Ball data collection and B2B Collision detection.
ReDim baX(tnopb,4), baY(tnopb,4), baZ(tnopb,4), bVx(tnopb,4), bVy(tnopb,4), TotalVel(tnopb,4)
Dim cForce, bDistance, xyTime, cFactor, id, id2, id3, B1, B2
Sub XYdata_Timer()
xyTime = Timer+(XYdata.interval*.001) ' xyTime is the system timer plus the current interval time
If id2 >= 4 Then id2 = 0 ' Loop four times and start over
id2 = id2+1 ' Increment the ball sampler ID
For id = 1 to ubound(ballStatus) ' Loop once for each possible ball
If ballStatus(id) = 1 Then ' If ball is active...
baX(id,id2) = round(CurrentBall(id).x,2) ' Sample x-coord
baY(id,id2) = round(CurrentBall(id).y,2) ' Sample y-coord
baZ(id,id2) = round(CurrentBall(id).z,2) ' Sample z-coord
bVx(id,id2) = round(CurrentBall(id).velx,2) ' Sample x-velocity
bVy(id,id2) = round(CurrentBall(id).vely,2) ' Sample y-velocity
TotalVel(id,id2) = (bVx(id,id2)^2 + bVy(id,id2)^2) ' Calculate total velocity
If TotalVel(id,id2) > TotalVel(0,0) Then TotalVel(0,0) = int(TotalVel(id,id2))
End If
Next
id3 = id2 : B2 = 2 : B1 = 1 ' Set up the counters for looping
Do
If ballStatus(B1) = 1 and ballStatus(B2) = 1 Then ' If both balls are active...
bDistance = int((TotalVel(B1,id3)+TotalVel(B2,id3))^(1.04 * (CurrentBall(B1).radius + CurrentBall(B2).radius)/50))
If ((baX(B1,id3) - baX(B2,id3))^2 + (baY(B1,id3) - baY(B2,id3))^2) < (2800 * ((CurrentBall(B1).radius + CurrentBall(B2).radius)/50)^2) + bDistance Then
If ABS(baZ(B1,id3) - baZ(B2,id3)) < (CurrentBall(B1).radius + CurrentBall(B2).radius) Then collide B1,B2 : Exit Sub 'added z axis collision detection here
End If
End If
B1 = B1+1 ' Increment ball1
If B1 = ubound(ballstatus) Then Exit Do ' Exit loop if all ball combinations checked
If B1 >= B2 then B1 = 1:B2 = B2+1 ' If ball1 >= reset ball1 and increment ball2
Loop
If ballStatus(0) <= 1 Then XYdata.enabled = False ' Turn off timer if one ball or less
If XYdata.interval >= 40 Then B2BOn = 0 : XYdata.enabled = False ' Auto-shut off
If Timer > xyTime * 3 Then B2BOn = 0 : XYdata.enabled = False ' Auto-shut off
If Timer > xyTime Then XYdata.interval = XYdata.interval+1 ' Increment interval if needed
End Sub
'=========================================================
' <<<<<<<<<<< Collide(ball id1, ball id2) >>>>>>>>>>>
'=========================================================
'Calculate the collision force and play sound accordingly.
Dim cTime, cb1,cb2, avgBallx, cAngle, bAngle1, bAngle2
Sub Collide(cb1,cb2)
If TotalVel(0,0) / 1.8 > cFactor Then cFactor = int(TotalVel(0,0) / 1.8)
avgBallx = (bvX(cb2,1) + bvX(cb2,2) + bvX(cb2,3) + bvX(cb2,4)) / 4
If avgBallx < bvX(cb2,id2) + .1 and avgBallx > bvX(cb2,id2) - .1 Then
If ABS(TotalVel(cb1,id2) - TotalVel(cb2,id2)) < .000005 Then Exit Sub
End If
If Timer < cTime Then Exit Sub
cTime = Timer+.1 ' Limits collisions to .1 seconds apart
GetAngle baX(cb1,id3) - baX(cb2,id3), baY(cb1,id3) - baY(cb2,id3), cAngle ' Collision angle via x/y-coordinates
id3 = id3 - 1 : If id3 = 0 Then id3 = 4 ' Step back one xyData sampling for a good velocity reading
GetAngle bVx(cb1,id3), bVy(cb1,id3), bAngle1 ' ball 1 travel direction, via velocity
GetAngle bVx(cb2,id3), bVy(cb2,id3), bAngle2 ' ball 2 travel direction, via velocity
cForce = Cint((abs(TotalVel(cb1,id3)*Cos(cAngle-bAngle1))+abs(TotalVel(cb2,id3)*Cos(cAngle-bAngle2))))
If cForce < 4 Then Exit Sub ' Another collision limiter
cForce = Cint((cForce)/(cFactor/nosf)) ' Divides up cForce for the proper sound selection.
If cForce > nosf-1 Then cForce = nosf-1 ' First sound file 0(zero) minus one from number of sound files
PlaySound("collide" & cForce) ' Combines "collide" with the calculated sound level and play sound
End Sub
'=================================================
' <<<<<<<< GetAngle(X, Y, Anglename) >>>>>>>>
'=================================================
Dim Xin,Yin,rAngle,Radit,wAngle,Pi
Pi = Round(4*Atn(1),6) '3.1415926535897932384626433832795
Sub GetAngle(Xin, Yin, wAngle)
If Sgn(Xin) = 0 Then
If Sgn(Yin) = 1 Then rAngle = 3 * Pi/2 Else rAngle = Pi/2
If Sgn(Yin) = 0 Then rAngle = 0
Else
rAngle = atn(-Yin/Xin)
End If
If sgn(Xin) = -1 Then Radit = Pi Else Radit = 0
If sgn(Xin) = 1 and sgn(Yin) = 1 Then Radit = 2 * Pi
wAngle = round((Radit + rAngle),4)
End Sub
'******************************************
' Use RollingSoundTimer to call div subs
'******************************************
Sub RollingSoundTimer_Timer()
RollingSound
End Sub
'****************************************
' JimmyFingers Enhanced Ball Rolling Script (Extension of Rascal's Original)
'****************************************
ReDim BRVeloY(tnopb), BRVeloX(tnopb), rolling(tnopb), rollingfast(tnopb)
Dim b
b = 0
RollingSoundTimer.Interval = 60/tnopb
Sub RollingSound()
B = B + 1
If B > tnopb Then B = 1
If BallStatus(b) = 0 Then Exit Sub
BRVeloY(b) = Cint(CurrentBall(b).VelY)
BRVeloX(b) = Cint(CurrentBall(b).VelX)
If((ABS(BRVeloY(b))> 3 AND (ABS(BRVeloY(b))< 10) or (ABS(BRVeloX(b) )> 3 AND (ABS(BRVeloX(b))< 10)))) Then
If rolling(b) = True then
Exit Sub
Else
If rollingfast(b) = True then
StopSound "JF_rollingfaster"
rollingfast(b) = False
Else
rolling(b) = True
Select Case Int(Rnd*3)+1
Case 1 : PlaySound "JF_roll1"
Case 2 : PlaySound "JF_roll2"
Case 3 : PlaySound "JF_roll3"
End Select
End If
End If
ElseIf (ABS(BRVeloY(b) )> 10 or ABS(BRVeloX(b) )> 10) Then
If rollingfast(b) = True then
Exit Sub
Else
If rolling(b) = True then
StopSound "JF_roll1"
StopSound "JF_roll2"
StopSound "JF_roll3"
rolling(b) = False
Else
rollingfast(b) = True
PlaySound "JF_rollingfaster"
End If
End If
Else
If rolling(b) = True Then
StopSound "JF_roll1"
StopSound "JF_roll2"
StopSound "JF_roll3"
rolling(b) = False
ElseIf rollingfast(b) = True Then
StopSound "JF_rollingfaster"
rollingfast(b) = False
End If
End If
End Sub
Sub StopRollingSound()
StopSound "JF_roll1"
StopSound "JF_roll2"
StopSound "JF_roll3"
StopSound "JF_rollingfaster"
End Sub