' Funhouse / IPD No. 966 / Williams, November, 1990 / 4 Players
' VP9 12.0 by JPSalas 2009
Option Explicit
ExecuteGlobal GetTextFile("b2s.vbs")
ResetB2SData 0,49,0 'Initialise the b2s data area
'***********************************************************************
' Choose where to display the THING lights
LaunchBackGlass "Funhouse_FS_B2S", true 'True=Launch bg , False=Don't launch bg.
'***********************************************************************
Randomize
LoadVPM "01560000", "WPC.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")
If Err Then MsgBox "Can't Load VPinMAME." & vbNewLine & Err.Description
If VPMver> "" Then If Controller.Version <VPMver Or Err Then MsgBox "VPinMAME ver " & VPMver & " required."
If VPinMAMEDriverVer <VBSver Or Err Then MsgBox VBSFile & " ver " & VBSver & " or higher required."
On Error Goto 0
End Sub
'********************
'Standard definitions
'********************
Const UseSolenoids = 1
Const UseLamps = 0
Const UseSync = 0
Const HandleMech = 0
' Standard Sounds
Const SSolenoidOn = "Solenoid"
Const SSolenoidOff = ""
Const SCoin = "Coin"
Set GiCallback = GetRef("UpdateGI")
Dim bsTrough, bsLock, bsHideout, bsDropHole, bsRudy, cbLeft, LeftMagnet, RightMagnet, x, bump1, bump2, bump3, plungerIM, plungerIM2
Dim TrapDoor
TrapDoor = Array(td1, td2, td3, td4, td5, td6, td7, td8, td9, td10, td11, td12, td13, td14, td15, td16, td17)
'************
' Table init.
'************
Const cGameName = "fh_l9"
Sub Table1_Init
vpmInit Me
With Controller
.GameName = cGameName
If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
.SplashInfoLine = "Funhouse - based on the table by Williams 1990" & vbNewLine & "VP9 table by JPSalas v2.0"
'DMD position and size 1400x1050
'.Games(cGameName).Settings.Value("dmd_pos_x") = 500
'.Games(cGameName).Settings.Value("dmd_pos_y") = 2
'.Games(cGameName).Settings.Value("dmd_width") = 400
'.Games(cGameName).Settings.Value("dmd_height") = 92
.Games(cGameName).Settings.Value("rol") = 1 'rotated to the left
.HandleKeyboard = 0
.ShowTitle = 0
.ShowDMDOnly = 1
.ShowFrame = 0
.HandleMechanics = 0
.Hidden = 1
On Error Resume Next
.Run GetPlayerHWnd
If Err Then MsgBox Err.Description
On Error Goto 0
End With
' Nudging
vpmNudge.TiltSwitch = 14
vpmNudge.Sensitivity = 1
vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingshot, RightSlingshot)
' Trough
Set bsTrough = New cvpmBallStack
With bsTrough
.InitSw 73, 63, 74, 72, 0, 0, 0, 0
.InitKick BallRelease, 90, 4
.InitEntrySnd "Drain", "Solenoid"
.InitExitSnd "ballrel", "Solenoid"
.Balls = 3
.IsTrough = 1
End With
' Lock
Set bsLock = New cvpmBallStack
With bsLock
.InitSw 0, 28, 27, 25, 0, 0, 0, 0
.InitKick LockMech, 270, 8
.InitExitSnd "popper", "Solenoid"
.KickBalls = 1
.KickForceVar = 2
End With
' Hideout
Set bsHideout = New cvpmBallStack
With bsHideout
.InitSaucer sw46, 46, 290, 15
.InitExitSnd "popper_ball", "Solenoid"
End With
' DropHole
Set bsDropHole = New cvpmBallStack
With bsDropHole
.InitSw 0, 58, 0, 0, 0, 0, 0, 0
.InitKick sw58, 205, 10
.KickBalls = 1
.InitAddSnd "kicker_enter"
.InitExitSnd "popper_ball", "Solenoid"
.KickForceVar = 1
.KickAngleVar = 1
End With
' Rudy
Set bsRudy = New cvpmBallStack
With bsRudy
.InitSaucer sw65, 65, 190, 8
.InitExitSnd "popper_ball", "Solenoid"
End With
' Impulse Plunger
Const IMPowerSetting = 43 ' Plunger Power
Const IMTime = 0.4 ' Time in seconds for Full Plunge
Set plungerIM = New cvpmImpulseP
With plungerIM
.InitImpulseP swplunger, IMPowerSetting, IMTime
.Random 0.3
.switch 62
.InitExitSnd "plunger2", "plunger"
.CreateEvents "plungerIM"
End With
' Impulse Plunger2
Const IMPowerSetting2 = 43 ' Plunger Power
Const IMTime2 = 0.4 ' Time in seconds for Full Plunge
Set plungerIM2 = New cvpmImpulseP
With plungerIM2
.InitImpulseP swplunger2, IMPowerSetting2, IMTime2
.Random 0.3
.switch 47
.InitExitSnd "plunger2", "plunger"
.CreateEvents "plungerIM2"
End With
' Main Timer init
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = 1
StartShake
' Init Bumper Rings and targets
Ring1a.IsDropped = 1:Ring2a.IsDropped = 1:Ring3a.IsDropped = 1
Ring1b.IsDropped = 1:Ring2b.IsDropped = 1:Ring3b.IsDropped = 1
Ring1c.IsDropped = 1:Ring2c.IsDropped = 1:Ring3c.IsDropped = 1
sw17a.IsDropped = 1:sw54a.IsDropped = 1:sw64a.IsDropped = 1:sw31a.IsDropped = 1
ResetPlungers
Llogo.IsDropped = 1:Llogo3.IsDropped = 1:Rlogo.IsDropped = 1
LeftSLing.IsDropped = 1:LeftSLing2.IsDropped = 1:LeftSLing3.IsDropped = 1
RightSLing.IsDropped = 1:RightSLing2.IsDropped = 1:RightSLing3.IsDropped = 1
SolTrapDoor 1
ResetRudy
End Sub
Sub table1_Paused:Controller.Pause = 1:End Sub
Sub table1_unPaused:Controller.Pause = 0:End Sub
'**********
' Keys
'**********
Sub table1_KeyDown(ByVal Keycode)
If Keycode = KeyFront Then Controller.Switch(23) = 1
If keycode = PlungerKey Then PlungerIM.Pullback:PlungerIM2.Pullback:Pcount = 0:PTime.Enabled = 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 = KeyRules Then Rules
If vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub table1_KeyUp(ByVal Keycode)
If Keycode = KeyFront Then Controller.Switch(23) = 0
If keycode = PlungerKey Then PlungerIM.Fire:PlungerIM2.Fire:PTime.Enabled = 0:Pcount = 0:PTime2.Enabled = 1
If vpmKeyUp(keycode) Then Exit Sub
End Sub
'********
'Plunger
'********
dim PCount:Pcount = 0
dim Plungers:Plungers = Array(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)
Sub PTime_Timer
If Pcount <12 Then
Pcount = Pcount + 1
Plungers(Pcount - 1).Isdropped = 1
Plungers(Pcount).Isdropped = 0
End If
End Sub
Sub PTime2_Timer
Select Case Pcount
Case 0:ResetPlungers
Case 1:Plungers(0).Isdropped = 1:Plungers(2).Isdropped = 0
Case 2:Plungers(2).Isdropped = 1:Plungers(0).Isdropped = 0
Case 3:Me.Enabled = 0
End Select
Pcount = Pcount + 1
End Sub
Sub ResetPlungers
For x = 1 to 12:Plungers(x).Isdropped = 1:Next
Plungers(0).Isdropped = 0
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 = 0
End Sub
Sub RightNudgeTimer_Timer()
RightNudgeEffect = RightNudgeEffect-1
If RightNudgeEffect = 0 then RightNudgeTimer.Enabled = 0
End Sub
Sub NudgeTimer_Timer()
NudgeEffect = NudgeEffect-1
If NudgeEffect = 0 then NudgeTimer.Enabled = 0
End Sub
'*********
' Switches
'*********
' Slings & div switches
Dim LStep, RStep
Sub LeftSlingShot_Slingshot:LeftSling.IsDropped = 0:PlaySound "slingshot_left":vpmTimer.PulseSw 41: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_right":vpmTimer.PulseSw 53: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
' Bumpers
Sub Bumper1_Hit:vpmTimer.PulseSw 18:PlaySound "bumper_center":bump1 = 1:Me.TimerEnabled = 1:End Sub
Sub Bumper1_Timer()
Select Case bump1
Case 1:Ring1a.IsDropped = 0:bump1 = 2
Case 2:Ring1b.IsDropped = 0:Ring1a.IsDropped = 1:bump1 = 3
Case 3:Ring1c.IsDropped = 0:Ring1b.IsDropped = 1:bump1 = 4
Case 4:Ring1c.IsDropped = 1:Me.TimerEnabled = 0
End Select
End Sub
Sub Bumper2_Hit:vpmTimer.PulseSw 77:PlaySound "bumper2_right":bump2 = 1:Me.TimerEnabled = 1:End Sub
Sub Bumper2_Timer()
Select Case bump2
Case 1:Ring2a.IsDropped = 0:bump2 = 2
Case 2:Ring2b.IsDropped = 0:Ring2a.IsDropped = 1:bump2 = 3
Case 3:Ring2c.IsDropped = 0:Ring2b.IsDropped = 1:bump2 = 4
Case 4:Ring2c.IsDropped = 1:Me.TimerEnabled = 0
End Select
End Sub
Sub Bumper3_Hit:vpmTimer.PulseSw 68:PlaySound "bumper_right":bump3 = 1:Me.TimerEnabled = 1:End Sub
Sub Bumper3_Timer()
Select Case bump3
Case 1:Ring3a.IsDropped = 0:bump3 = 2
Case 2:Ring3b.IsDropped = 0:Ring3a.IsDropped = 1:bump3 = 3
Case 3:Ring3c.IsDropped = 0:Ring3b.IsDropped = 1:bump3 = 4
Case 4:Ring3c.IsDropped = 1:Me.TimerEnabled = 0
End Select
End Sub
' Drain holes, vuks & saucers
Sub Drain_Hit:bsTrough.AddBall Me:End Sub
Sub Drain1_Hit:bsTrough.AddBall Me:End Sub
Sub Drain2_Hit:bsTrough.AddBall Me:End Sub
Sub Drain3_Hit:bsTrough.AddBall Me:End Sub
Sub Drain4_Hit:bsTrough.AddBall Me:End Sub
Sub LockMech_Hit
PLaySound "kicker_enter"
bsLock.AddBall Me
End Sub
Sub sw46_Hit()
bsHideout.AddBall Me
End Sub
Sub sw65_Hit
bsRudy.AddBall Me
End Sub
Sub sw67_Hit
Me.DestroyBall
vpmTimer.PulseSw 67
vpmTimer.AddTimer 500, "SubwayHandler"
End Sub
Sub SubwayHandler(dummy)
bsDropHole.AddBall 0
End Sub
' Holes with animation
Dim aBall, aZpos
Dim bBall, bZpos
Sub sw44_Hit
Me.Enabled=0
Set aBall = ActiveBall
PlaySound "kicker_enter"
aZpos = 35
Me.TimerInterval = 3
Me.TimerEnabled = 1
End Sub
Sub sw44_Timer
aBall.Z = aZpos
aZpos = aZpos-4
If aZpos <-30 Then
Me.TimerEnabled = 0
Me.DestroyBall
vpmTimer.PulseSw 44
vpmTimer.AddTimer 1500, "SubwayHandler"
Me.Enabled=1
End If
End Sub
Sub sw58_Hit
Me.Enabled=0
Set bBall = ActiveBall
PlaySound "kicker_enter"
bZpos = 35
Me.TimerInterval = 3
Me.TimerEnabled = 1
End Sub
Sub sw58_Timer
bBall.Z = bZpos
bZpos = bZpos-4
If bZpos <-30 Then
Me.TimerEnabled = 0
Me.DestroyBall
If bsDropHole.Balls then bsDropHole.KickBalls = 2
SubwayHandler 0
Me.Enabled=1
End If
End Sub
' Rollovers & Ramp Switches
Sub sw43_Hit:la1.IsDropped = 1:Controller.Switch(43) = 1:PlaySound "sensor":End Sub
Sub sw43_UnHit:la1.IsDropped = 0:Controller.Switch(43) = 0:End Sub
Sub sw42_Hit:la2.IsDropped = 1:Controller.Switch(42) = 1:PlaySound "sensor":End Sub
Sub sw42_UnHit:la2.IsDropped = 0:Controller.Switch(42) = 0:End Sub
Sub sw61_Hit:la3.IsDropped = 1:Controller.Switch(61) = 1:PlaySound "sensor":End Sub
Sub sw61_UnHit:la3.IsDropped = 0:Controller.Switch(61) = 0:End Sub
Sub sw71_Hit:la4.IsDropped = 1:Controller.Switch(71) = 1:PlaySound "sensor":End Sub
Sub sw71_UnHit:la4.IsDropped = 0:Controller.Switch(71) = 0:End Sub
Sub sw52_Hit:la5.IsDropped = 1:Controller.Switch(52) = 1:PlaySound "sensor":End Sub
Sub sw52_UnHit:la5.IsDropped = 0:Controller.Switch(52) = 0:End Sub
Sub sw57_Hit:la6.IsDropped = 1:Controller.Switch(57) = 1:PlaySound "sensor":End Sub
Sub sw57_UnHit:la6.IsDropped = 0:Controller.Switch(57) = 0:End Sub
Sub sw66_Hit:la7.IsDropped = 1:Controller.Switch(66) = 1:PlaySound "sensor":End Sub
Sub sw66_UnHit:la7.IsDropped = 0:Controller.Switch(66) = 0:End Sub
Sub sw75_Hit:la8.IsDropped = 1:Controller.Switch(75) = 1:PlaySound "sensor":End Sub
Sub sw75_UnHit:la8.IsDropped = 0:Controller.Switch(75) = 0:End Sub
Sub sw51_Hit:Controller.Switch(51) = 1:End Sub
Sub sw51_Unhit:Controller.Switch(51) = 0:End Sub
Sub sw38_Hit:Controller.Switch(38) = 1:PlaySound "sensor":End Sub
Sub sw38_Unhit:Controller.Switch(38) = 0:PlaySound "metalrolling":End Sub
Sub sw48_Hit:Controller.Switch(48) = 1:PlaySound "sensor":End Sub
Sub sw48_Unhit:Controller.Switch(48) = 0:PlaySound "metalrolling":End Sub
Sub sw33_Hit:Controller.Switch(33) = 1:PlaySound "sensor":End Sub
Sub sw33_Unhit:Controller.Switch(33) = 0:End Sub
Sub sw55_Hit:Controller.Switch(55) = 1:PlaySound "sensor":End Sub
Sub sw55_Unhit:Controller.Switch(55) = 0:End Sub
Sub sw36_Hit:Controller.Switch(36) = 1:PlaySound "sensor":End Sub
Sub sw36_Unhit:Controller.Switch(36) = 0:End Sub
Sub sw26_Hit:Controller.Switch(26) = 1:PlaySound "sensor":End Sub
Sub sw26_Unhit:Controller.Switch(26) = 0:End Sub
Sub sw15_Hit:Controller.Switch(15) = 1:PlaySound "sensor":End Sub
Sub sw15_Unhit:Controller.Switch(15) = 0:End Sub
Sub sw16_Hit:Controller.Switch(16) = 1:PlaySound "sensor":End Sub
Sub sw16_Unhit:Controller.Switch(16) = 0:End Sub
Sub sw35_Hit:Controller.Switch(35) = 1:PlaySound "sensor":End Sub
Sub sw35_Unhit:Controller.Switch(35) = 0:End Sub
Sub sw56_Hit:Controller.Switch(56) = 1:PlaySound "sensor":End Sub
Sub sw56_Unhit:Controller.Switch(56) = 0:End Sub
' Targets
Sub sw17_Hit:vpmTimer.PulseSw 17:sw17.IsDropped = 1:sw17a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw17_Timer:sw17.IsDropped = 0:sw17a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw31_Hit:vpmTimer.PulseSw 31:sw31.IsDropped = 1:sw31a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw31_Timer:sw31.IsDropped = 0:sw31a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw32_Hit:vpmTimer.PulseSw 32:sw32.IsDropped = 1:sw32a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw32_Timer:sw32.IsDropped = 0:sw32a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw34_Hit:vpmTimer.PulseSw 34:sw34.IsDropped = 1:sw34a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw34_Timer:sw34.IsDropped = 0:sw34a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw37_Hit:vpmTimer.PulseSw 37:sw37.IsDropped = 1:sw37a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw37_Timer:sw37.IsDropped = 0:sw37a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw54_Hit:vpmTimer.PulseSw 54:sw54.IsDropped = 1:sw54a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw54_Timer:sw54.IsDropped = 0:sw54a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
Sub sw64_Hit:vpmTimer.PulseSw 64:sw64.IsDropped = 1:sw64a.IsDropped = 0:Me.TimerEnabled = 1:PlaySound "target":End Sub
Sub sw64_Timer:sw64.IsDropped = 0:sw64a.IsDropped = 1:Me.TimerEnabled = 0:End Sub
' Gates
Sub Gate1_Hit():PlaySound "gate":End Sub
Sub Gate2_Hit():PlaySound "gate":End Sub
Sub Gate3_Hit():PlaySound "gate":End Sub
' Ramps helpers
Sub RHelp1_Hit()
ActiveBall.VelZ = -2
ActiveBall.VelY = 0
ActiveBall.VelX = 0
StopSound "metalrolling"
PlaySound "ballhit"
End Sub
Sub RHelp2_Hit()
ActiveBall.VelZ = -2
ActiveBall.VelY = 0
ActiveBall.VelX = 0
StopSound "metalrolling"
PlaySound "ballhit"
End Sub
Sub RHelp3_Hit()
ActiveBall.VelZ = -2
ActiveBall.VelY = 1
ActiveBall.VelX = 1
PlaySound "ballhit"
End Sub
Sub Rubbers_Hit(Idx):PlaySound "rubber":End Sub
'*********
'Solenoids
'*********
SolCallback(1) = "bsTrough.SolIn"
SolCallback(2) = "SolRampDiv"
SolCallback(3) = "bsHideout.SolOut"
SolCallback(4) = "SolDropKickout"
SolCallback(5) = "SolTrapDoor 0 '"
SolCallback(6) = "SolTrapDoor 1 '"
SolCallback(7) = "vpmSolSound ""Knocker"","
SolCallback(8) = "bsLock.SolOut"
SolCallback(14) = "SolStepGate"
SolCallback(15) = "bsTrough.SolOut"
SolCallback(16) = "bsRudy.SolOut"
SolCallback(25) = "SolEyesRight"
SolCallback(26) = "SolEyesOpen"
SolCallback(27) = "SolEyesClosed"
SolCallback(28) = "SolEyesLeft"
SolCallback(17) = "SetLamp 117,"
SolCallback(18) = "SetLamp 118,"
SolCallback(19) = "SetLamp 119,"
SolCallback(20) = "SetLamp 120,"
SolCallback(23) = "SetLamp 123,"
SolCallback(24) = "SetLamp 124,"
'**************
' Flipper Subs
'**************
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
Sub SolLFlipper(Enabled)
If Enabled Then
PlaySound "flipperup_left":LeftFlipper.RotateToEnd:LeftFlipper2.RotateToEnd
Else
PlaySound "flipperdown_left":LeftFlipper.RotateToStart:LeftFlipper2.RotateToStart
End If
Llogo.IsDropped = Not Enabled
Llogo3.IsDropped = Not Enabled
Llogo2.IsDropped = Enabled
Llogo4.IsDropped = Enabled
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
PlaySound "flipperup_right":RightFlipper.RotateToEnd
Else
PlaySound "flipperdown_right":RightFlipper.RotateToStart
End If
Rlogo.IsDropped = Not Enabled
Rlogo2.IsDropped = Enabled
End Sub
'**************
' Solenoid Subs
'**************
Sub TrapDoorEnter_Hit
Me.DestroyBall
vpmTimer.PulseSw 45
vpmTimer.AddTimer 1500, "SubwayHandler"
Me.Enabled = False
End Sub
Sub SolTrapDoor(Enabled)
Dim obj
If Enabled Then
TrapDoorEnter.Enabled = 0
TrapDoorRamp.Collidable = 0
Else
TrapDoorEnter.Enabled = 1
TrapDoorRamp.Collidable = 1
End If
For each obj in TrapDoor:obj.IsDropped = Enabled:Next
Controller.Switch(76) = Enabled
PlaySound "Diverter"
End Sub
Sub SolRampDiv(Enabled)
If Enabled Then
RampDiv.RotateToEnd
Else
RampDiv.RotateToStart
End If
PlaySound "Diverter"
End Sub
Sub SolDropKickout(Enabled)
bsDropHole.SolOut Enabled
bsDropHole.Kickballs = 1
End Sub
Sub SolStepGate(Enabled)
If Enabled Then
StepGate3.IsDropped=1
StepGate.RotateToEnd
StepGate2.RotateToEnd
PlaySound "Diverter"
Else
vpmTimer.AddTimer 500, "ShutGate"
End If
End Sub
Sub ShutGate(swNo)
StepGate3.IsDropped=0
StepGate.RotateToStart
StepGate2.RotateToStart
PlaySound "Diverter"
End Sub
'******
' Rudy
'******
Sub ResetRudy
Dim i
rudy_left.IsDropped = 1
rudy_closed.IsDropped = 1
rudy_right.IsDropped = 1
rudy_open.IsDropped = 1
For i = 1 to 31:RudyMouth(i).IsDropped = 1:Next
mouth1.IsDropped = 0
MouthPos = 0
End Sub
' Rudy's Eyes
Sub SolEyesOpen(Enabled)
rudy_closed.IsDropped = 1
rudy_open.IsDropped = NOT Enabled
End Sub
Sub SolEyesClosed(Enabled)
rudy_closed.IsDropped = 0
End Sub
Sub SolEyesRight(Enabled)
rudy_closed.IsDropped = 1
rudy_right.IsDropped = NOT Enabled
End Sub
Sub SolEyesLeft(Enabled)
rudy_closed.IsDropped = 1
rudy_left.IsDropped = NOT Enabled
End Sub
' Rudy's Mouth
Dim MouthPos
Sub MouthTimer_Timer()
Dim temp, MotorState, DriverState
temp = MouthPos
MotorState = Controller.Solenoid(21)
DriverState = Controller.Solenoid(22)
If Abs(MotorState) = 1 then
If Abs(DriverState) = 1 then
MouthPos = MouthPos + 1
Else
MouthPos = MouthPos - 1
End if
End if
If MouthPos <0 then MouthPos = 0
If MouthPos> 31 then MouthPos = 31
If temp <> MouthPos Then
RudyMouth(temp).IsDropped = 1
RudyMouth(MouthPos).IsDropped = 0
End If
End Sub
'***********
' Update GI
'***********
UpdateGI 2, 0:UpdateGI 4, 0
Sub UpdateGI(no, Enabled)
Select Case no
Case 2 'rear playfield
gib1.IsDropped = NOT Enabled
gib2.IsDropped = NOT Enabled
gib3.IsDropped = NOT Enabled
gib4.IsDropped = NOT Enabled
gib5.IsDropped = NOT Enabled
gib6.IsDropped = NOT Enabled
gib7.IsDropped = NOT Enabled
gib8.IsDropped = NOT Enabled
gib9.IsDropped = NOT Enabled
gib10.IsDropped = NOT Enabled
Case 4 ' front playfield
gi1.State = ABS(Enabled)
gi2.State = ABS(Enabled)
gi3.State = ABS(Enabled)
gi4.State = ABS(Enabled)
gi5.State = ABS(Enabled)
gi6.State = ABS(Enabled)
gi7.State = ABS(Enabled)
gi8.State = ABS(Enabled)
gi2w.IsDropped = NOT Enabled
gi2w2.IsDropped = NOT Enabled
gi2w3.IsDropped = NOT Enabled
gi2p.IsDropped = NOT Enabled
gi3w.IsDropped = NOT Enabled
gi3p.IsDropped = NOT Enabled
gi5w2.IsDropped = NOT Enabled
gi5w3.IsDropped = NOT Enabled
gi5p.IsDropped = NOT Enabled
gi7w.IsDropped = NOT Enabled
gi7p.IsDropped = NOT Enabled
gi6w2.IsDropped = NOT Enabled
gi6w3.IsDropped = NOT Enabled
gi6p.IsDropped = NOT Enabled
gi9p.IsDropped = NOT Enabled
End Select
End Sub
'****************************************
' JP's Fading Lamps 3.1 VP9 Fading only
' Based on PD's Fading Lights
' SetLamp 0 is Off
' SetLamp 1 is On
' LampState(x) current state
'****************************************
Dim LampState(200)
AllLampsOff()
LampTimer.Interval = 43
LampTimer.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
Next
End If
UpdateLamps
End Sub
Sub UpdateLamps
SendLights
FadeL 11, l11, l11a
FadeL 12, l12, l12a
FadeL 13, l13, l13a
FadeL 14, l14, l14a
FadeL 15, l15, l15a
FadeL 16, l16, l16a
FadeL 17, l17, l17a
FadeL 18, l18, l18a
FadeL 21, l21, l21a
FadeL 22, l22, l22a
FadeL 23, l23, l23a
FadeL 24, l24, l24a
FadeL 25, l25, l25a
FadeL 26, l26, l26a
FadeL 27, l27, l27a
FadeL 28, l28, l28a
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 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
NFadeL 51, Bumper3
NFadeL 52, Bumper1
FadeL 53, l53, l53a
FadeW 54, l54, l54a, l54b
FadeW 55, l55, l55a, l55b
FadeW 56, l56, l56a, l56b
FadeW 57, l57, l57a, l57b
FadeW 58, l58, l58a, l58b
FadeLm 61, l611, l611a
FadeL 61, l61, l61a
FadeL 62, l62, l62a
FadeL 63, l63, l63a
FadeL 64, l64, l64a
FadeL 65, l65, l65a
FadeL 66, l66, l66a
FadeL 67, l67, l67a
FadeL 68, l68, l68a
FadeW 71, l71, l71a, l71b
NFadeL 72, Bumper2
FadeL 73, l73, l73a
FadeW 74, l74, l74a, l74b
FadeW 75, l75, l75a, l75b
FadeW 76, l76, l76a, l76b
FadeW 77, l77, l77a, l77b
FadeW 78, l78, l78a, l78b
FadeL 81, l81, l81a
FadeLm 82, l821, l821a
FadeL 82, l82, l82a
FadeL 83, l83, l83a
FadeL 84, l84, l84a
FadeL 85, l85, l85a
FadeL 86, l86, l86a
FadeL 87, l87, l87a
NFadeL 88, l88
'flashers
FadeLm 117, f172, f172a
FadeWm 117, r17, r17a, r17b
FadeLm 117, f173, f173a
FadeW 117, f171, f171a, f171b
FadeL 118, f18, f18a
FadeL 119, f19, f19a
NFadeL 120, f20
FadeLm 123, f232, f232a
FadeLm 123, f233, f233a
FadeW 123, f231, f231a, f231b
FadeLm 124, f242, f242a
FadeLm 124, f243, f243a
FadeW 124, f241, f241a, f241b
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 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:b.IsDropped = 1:c.IsDropped = 0:LampState(nr) = 6 'turning ON
Case 6: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:b.IsDropped = 1:c.IsDropped = 0
Case 6: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:b.state = 1:LampState(nr) = 6
Case 6: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:b.state = 1
Case 6: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 1:LampState(nr) = 6
Case 6: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 1
Case 6: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
'***************
' Rules
'***************
Dim RuleWindow
RuleWindow = 0
Sub Rules
If RuleWindow = 0 Then
Dim objShell:Set objShell = CreateObject("Wscript.Shell")
objShell.Run "Funhouse_JP_VP9.hta"
RuleWindow = 1
Controller.Pause = 1
Else
RuleWindow = 0
Controller.Pause = 0
End If
End Sub
'***********************************************************************************************
'***************************************** B2S ************************************************
'***********************************************************************************************
Sub SendLights()
B2SUpdateLed
Select Case LampState(51)
Case 4:SetB2SData 0, 0
Case 5:SetB2SData 0, 1
End Select
Select Case LampState(84)
Case 4:SetB2SData 1, 0
Case 5:SetB2SData 1, 1
End Select
Select Case LampState(85)
Case 4:SetB2SData 2, 0
Case 5:SetB2SData 2, 1
End Select
Select Case LampState(86)
Case 4:SetB2SData 3, 0
Case 5:SetB2SData 3, 1
End Select
Select Case LampState(88)
Case 4:SetB2SData 4, 0
Case 5:SetB2SData 4, 1
End Select
Select Case LampState(83)
Case 4:SetB2SData 5, 0
Case 5:SetB2SData 5, 1
End Select
Select Case LampState(85)
Case 4:SetB2SData 6, 0
Case 5:SetB2SData 6, 1
End Select
End Sub
'***********************************************************************************************
'***************************************** B2S ************************************************
'***********************************************************************************************