-
Notifications
You must be signed in to change notification settings - Fork 37
/
Big Bang Bar 2.4.2.vbs
1757 lines (1500 loc) · 61 KB
/
Big Bang Bar 2.4.2.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
''************ Big Bamg Bar
''************ Capcom, 1996
''************ vp9 version by unclewilly and jimmyfingers, artwork by grizz
''************ original 3dmodels by rom extracted from his Future Pinball release
''************ vpx conversion by ninuzzu, scanned textures, objects corrections and adjustments by clarkkent
Option Explicit
Randomize
Dim DesktopMode:DesktopMode = Table.ShowDT
Dim UseVPMDMD:UseVPMDMD = DesktopMode
LoadVPM "01560000", "Capcom.VBS", 3.10
'******************* Options *********************
' DMD/Backglass Controller Setting
Const cController = 0 '0=Use value defined in cController.txt, 1=VPinMAME, 2=UVP server, 3=B2S server, 4=B2S with DOF (disable VP mech sounds)
dim blacklight : blacklight = True 'chage it to False if you don't want the blacklight during the neon flasher
'*************************************************
BSize = 26
BMass = 1.7
' Thalamus 2020 July : Improved directional sounds
' !! NOTE : Table not verified yet !!
Dim cNewController
Sub LoadVPM(VPMver, VBSfile, VBSver)
Dim FileObj, ControllerFile, TextStr
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
cNewController = 1
If cController = 0 then
Set FileObj=CreateObject("Scripting.FileSystemObject")
If Not FileObj.FolderExists(UserDirectory) then
Msgbox "Visual Pinball\User directory does not exist. Defaulting to vPinMame"
ElseIf Not FileObj.FileExists(UserDirectory & "cController.txt") then
Set ControllerFile=FileObj.CreateTextFile(UserDirectory & "cController.txt",True)
ControllerFile.WriteLine 1: ControllerFile.Close
Else
Set ControllerFile=FileObj.GetFile(UserDirectory & "cController.txt")
Set TextStr=ControllerFile.OpenAsTextStream(1,0)
If (TextStr.AtEndOfStream=True) then
Set ControllerFile=FileObj.CreateTextFile(UserDirectory & "cController.txt",True)
ControllerFile.WriteLine 1: ControllerFile.Close
Else
cNewController=Textstr.ReadLine: TextStr.Close
End If
End If
Else
cNewController = cController
End If
Select Case cNewController
Case 1
Set Controller = CreateObject("VPinMAME.Controller")
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."
Case 2
Set Controller = CreateObject("UltraVP.BackglassServ")
Case 3,4
Set Controller = CreateObject("B2S.Server")
End Select
On Error Goto 0
End Sub
'*************************************************************
'Toggle DOF sounds on/off based on cController value
'*************************************************************
Dim ToggleMechSounds
Function SoundFX (sound)
If cNewController= 4 and ToggleMechSounds = 0 Then
SoundFX = ""
Else
SoundFX = sound
End If
End Function
Sub DOF(dofevent, dofstate)
If cNewController>2 Then
If dofstate = 2 Then
Controller.B2SSetData dofevent, 1:Controller.B2SSetData dofevent, 0
Else
Controller.B2SSetData dofevent, dofstate
End If
End If
End Sub
Const cGameName = "bbb109"
Const UseSolenoids = 1
Const UseLamps = 0
Const UseSync = 1
Const HandleMech = 0
'Standard Sounds
Const SSolenoidOn = "Solenoid"
Const SSolenoidOff = ""
Const SCoin = "Coin"
'**************************
FlipperMassL = leftflipper.mass
FlipperMassR = rightflipper.mass
MassMultiply = 3
'**************************
'******Variables***************
Dim xx
Dim bsTrough, DTBank4, DTBank3, DTBank1, bsRHole
Dim captb1, captb2, captb3, captb4
Dim bsTHelp, bsSw46, bsSw47, bsSw48
Dim bsALL, bsALR
Dim FlipperMassL, FlipperMassR, MassMultiply
'********Table Init************
Sub Table_Init
With Controller
.GameName = cGameName
.SplashInfoLine = "Big Bang Bar, Capcom 1996"
.HandleMechanics = 0
.HandleKeyboard = 0
.ShowDMDOnly = 1
.ShowFrame = 0
.ShowTitle = 0
.Hidden = DesktopMode
End With
On Error Resume Next
Controller.Run
If Err Then MsgBox Err.Description
On Error Goto 0
'Nudging
vpmNudge.TiltSwitch=10
vpmNudge.Sensitivity=5
vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
'********Trough***************
Set bsTrough = New cvpmBallStack
With bsTrough
.InitSw 35,36,37,38,39,0,0,0
.InitKick BallRelease, 90, 8
.InitExitSnd SoundFX("ballrelease"), SoundFX("Solenoid")
.Balls = 4
End With
'********Right Hole***********
Set bsRHole = New cvpmBallStack
With bsRHole
.InitSaucer sw67, 67, 222, 25
.KickZ = 0.4
.InitExitSnd SoundFX("scoop_exit"), SoundFX("Solenoid")
.KickForceVar = 2
End With
'Ball lock stacks
Set bsSw46 = New cvpmBallStack
With bsSw46
.InitSw 0, 0, 0, 0, 0, 0, 0, 0
End With
Set bsSw47 = New cvpmBallStack
With bsSw47
.InitSw 0, 0, 0, 0, 0, 0, 0, 0
End With
Set bsSw48 = New cvpmBallStack
With bsSw48
.InitSw 0, 0, 0, 0, 0, 0, 0, 0
End With
Set bsTHelp = New cvpmBallStack 'To help if all 4 balls get caught in lower lock
With bsTHelp
.InitSw 0, 0, 0, 0, 0, 0, 0, 0
End With
'********Alien Locks ***********
Set bsALL = New cvpmBallStack
With bsALL
.InitSw 0, 0, 0, 0, 0, 0, 0, 0
.InitKick sw61Out, 160, 1
End With
Set bsALR = New cvpmBallStack
With bsALR
.InitSw 0, 0, 0, 0, 0, 0, 0, 0
.InitKick sw62Out, 190, 1
End With
'********DropTargets
Set DTBank4 = New cvpmDropTarget
With DTBank4
.InitDrop Array(sw17,sw18,sw19,sw20), Array(17,18,19,20)
.Initsnd "", SoundFX("resetdrop")
End With
Set DTBank3 = New cvpmDropTarget
With DTBank3
.InitDrop Array(sw49,sw50,sw51), Array(49,50,51)
.Initsnd "", SoundFX("resetdrop")
End With
Set DTBank1 = New cvpmDropTarget
With DTBank1
.InitDrop sw58, 58
.Initsnd "", SoundFX("resetdrop")
End With
'*******Captive balls
' Initialize Captive Ball System
Controller.Switch(77) = True : Controller.Switch(78) = False : Controller.Switch(79) = True : Controller.Switch(80) = False
BP1 = True : BP2 = True : BP3 = True : BP4 = True : BP1R = False : BP2R = False : BP3L = False : BP4L = False
capmove1.enabled = true : capmove3.enabled = true : capmove3L.enabled = false: capmove1R.enabled = false
capmove2.enabled = true : capmove4.enabled = true : capmove4L.enabled = true : capmove2R.enabled = true
CreateBalls
'********Main Timer init
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = 1
'********KickBack Init
kickback.PullBack
'********Diverters Init
DivLR.IsDropped=1
DivTube1.isDropped=1
End Sub
Sub Table_Paused:Controller.Pause = 1:End Sub
Sub Table_unPaused:Controller.Pause = 0:End Sub
Sub Table_Exit:Controller.Stop():End Sub
'***************************************
' KEYS
'***************************************
Sub Table_KeyDown(ByVal keycode)
If Keycode = LeftFlipperKey then
Controller.Switch(33) = 1
End If
If Keycode = RightFlipperKey then
Controller.Switch(34) = 1: Controller.Switch(68) = 1
End If
If keycode = PlungerKey Then PlaySoundAtVol "PlungerPull", Plunger, 1:Plunger.Pullback
If keycode = LeftTiltKey Then Playsound SoundFX("fx_nudge")
If keycode = RightTiltKey Then Playsound SoundFX("fx_nudge")
If keycode = CenterTiltKey Then Playsound SoundFX("nudge")
If vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub Table_KeyUp(ByVal keycode)
If vpmKeyUp(keycode) Then Exit Sub
If Keycode = LeftFlipperKey then
Controller.Switch(33) = 0
End If
If Keycode = RightFlipperKey then
Controller.Switch(34) = 0 : Controller.Switch(68) = 0
End If
If keycode = PlungerKey Then StopSound "PlungerPull":PlaySoundAtVol "Plunger", Plunger, 1:Plunger.Fire
End Sub
'******************************************
'Solenoids
'******************************************
SolCallback(1) = "bsTrough.SolIn" 'OutHole
SolCallback(2) = "bsTrough.SolOut" 'Ball Release
SolCallback(3) = "vpmSolSound SoundFX(""knocker"")," 'Knocker
SolCallback(4) = "vpmSolSound SoundFX(""SlingshotLeft"")," 'LeftSling
SolCallback(5) = "vpmSolSound SoundFX(""SlingshotRight"")," 'RightSling
SolCallback(6) = "SolKickBack" 'KickBack
SolCallback(7) = "sol4Bank" '4-Bank drop target
SolCallback(8) = "SolLowerLockPin" 'Lower Lock Post
' SolCallback(9) = "SolLFlipper" 'Left Flipper
' SolCallback(10) = "SolRFlipper" 'Right Flipper
' SolCallback(11) = "SolURFlipper" 'Upper Flipper
SolCallback(12) = "bsRHole.SolOut" 'Eject Hole
SolCallback(13) = "SolLRDIvert" 'Island Diverter
SolCallback(14) = "SolRDivert1" 'Ramp Diverter 1
SolCallback(15) = "SolRDivert2" 'Ramp Diverter 2
SolCallback(16) = "SolRDivert3" 'Alien Lock Post
SolCallback(17) = "sol3Bank" '3-Bank drop target
SolCallback(18) = "vpmSolSound SoundFX(""fx_bumper1"")," 'Left Bumper
SolCallback(19) = "vpmSolSound SoundFX(""fx_bumper2"")," 'Middle Bumper
SolCallback(20) = "vpmSolSound SoundFX(""fx_bumper3"")," 'Right Bumper
SolCallback(21) ="setlamp 161," 'BackBox Left Flasher
SolCallback(22) ="setlamp 162," 'Tube Dancer Flasher
SolCallback(23) ="setlamp 163," 'Dance Floor Flasher
SolCallback(24) ="setlamp 164," 'Eject Hole Flasher
SolCallback(25) ="setlamp 165," 'Alien Lock Flasher
SolCallback(26) ="setlamp 166," 'Lower Lock Flasher
SolCallback(27) = "GateLeft" 'Loop Left Gate
SolCallback(28) = "GateRight" 'Loop Right Gate
SolCallback(29) = "sol1Bank" '1-Bank drop target
SolCallback(30) = "solDancer" 'Tube Dancer Motor
SolCallback(31) = "SolAlienForward" 'Alien Motor Forward
SolCallback(32) ="SolAlienReverse" 'ALien Motor Reverse
'******************************************
' Flippers
'******************************************
'******Flipper fix stuff till emulation is fixed
dim GameOnFF:GameOnFF = 0
dim BIPFF:BIPFF = 0
'
Sub FFTimer_Timer()
If bsTrough.Balls = 4 or RightSlingshot.SlingshotStrength = 0 or BIPFF = 0 Then
GameOnFF = 0
else
GameOnFF = 1
end if
End Sub
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
Sub SolLFlipper(Enabled)
If Enabled and GameOnFF = 1 Then
PlaySoundAtVol SoundFX("fx_flipperupleft"), LeftFlipper, 1
LeftFlipper.RotateToEnd
Else
PlaySoundAtVol SoundFX("fx_flipperdown"), LeftFlipper, 1
LeftFlipper.RotateToStart
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled and GameOnFF = 1 Then
PlaySoundAtVol SoundFX("fx_flipperupright"), RightFlipper, 1
RightFlipper.RotateToEnd
RightFlipper1.RotateToEnd
Else
PlaySoundAtVol SoundFX("fx_flipperdown"), RightFlipper, 1
RightFlipper.RotateToStart
RightFlipper1.RotateToStart
End If
End Sub
Sub MassTriggerL_Hit(): LeftFlipper.Mass = FlipperMassL * MassMultiply:End Sub
Sub MassTriggerU_Hit(): RightFlipper1.Mass = FlipperMassR * MassMultiply:End Sub
Sub MassTriggerR_Hit(): RightFlipper.Mass = FlipperMassR * MassMultiply:End Sub
Sub MassTriggerL_UnHit(): vpmtimer.addtimer 200, "LeftFlipper.Mass = FlipperMassL'":End Sub
Sub MassTriggerU_UnHit(): vpmtimer.addtimer 200, "RightFlipper1.Mass = FlipperMassR'":End Sub
Sub MassTriggerR_UnHit(): vpmtimer.addtimer 200, "RightFlipper.Mass = FlipperMassR'":End Sub
'******************************************
'Drop Targets
'******************************************
Dim tdir
Sub sw17_Hit:DTBank4.Hit 1:tdir = -1:me.TimerEnabled = 1:End Sub
Sub sw18_Hit:DTBank4.Hit 2:tdir = -1:me.TimerEnabled = 1:End Sub
Sub sw19_Hit:DTBank4.Hit 3:tdir = -1:me.TimerEnabled = 1:End Sub
Sub sw20_Hit:DTBank4.Hit 4:tdir = -1:me.TimerEnabled = 1:End Sub
Sub sw49_Hit:DTBank3.Hit 1:tdir = -1:me.TimerEnabled = 1:End Sub
Sub sw50_Hit:DTBank3.Hit 2:tdir = -1:me.TimerEnabled = 1:End Sub
Sub sw51_Hit:DTBank3.Hit 3:tdir = -1:me.TimerEnabled = 1:End Sub
Sub sw58_Hit:DTBank1.Hit 1:tdir = -1:me.TimerEnabled = 1:End Sub
Sub sol4Bank(Enabled)
If Enabled Then
tdir=1
sw17.TimerEnabled = 1:sw18.TimerEnabled = 1:sw19.TimerEnabled = 1:sw20.TimerEnabled = 1
DTBank4.DropSol_On
End if
End Sub
Sub sol3Bank(Enabled)
If Enabled Then
tdir=1
sw49.TimerEnabled = 1:sw50.TimerEnabled = 1:sw51.TimerEnabled = 1
DTBank3.DropSol_On
End if
End Sub
Sub sol1Bank(Enabled)
If Enabled Then
tDir = 1
sw58.TimerEnabled = 1
DTBank1.DropSol_On
End if
End Sub
Sub sw17_Timer()
sw17p.z=sw17p.z+1*tdir
If sw17p.z < -50 then sw17p.z =-50:me.timerenabled = 0
If sw17p.z>0 then sw17p.z=0:me.timerenabled = 0
End Sub
Sub sw18_Timer()
sw18p.z=sw18p.z+1*tdir
If sw18p.z < -50 then sw18p.z =-50:me.timerenabled = 0
If sw18p.z>0 then sw18p.z=0:me.timerenabled = 0
End Sub
Sub sw19_Timer()
sw19p.z=sw19p.z+1*tdir
If sw19p.z < -50 then sw19p.z =-50:me.timerenabled = 0
If sw19p.z>0 then sw19p.z=0:me.timerenabled = 0
End Sub
Sub sw20_Timer()
sw20p.z=sw20p.z+1*tdir
If sw20p.z < -50 then sw20p.z =-50:me.timerenabled = 0
If sw20p.z>0 then sw20p.z=0:me.timerenabled = 0
End Sub
Sub sw49_Timer()
sw49p.z=sw49p.z+1*tdir
If sw49p.z < -50 then sw49p.z =-50:me.timerenabled = 0
If sw49p.z>0 then sw49p.z=0:me.timerenabled = 0
End Sub
Sub sw50_Timer()
sw50p.z=sw50p.z+1*tdir
If sw50p.z < -50 then sw50p.z =-50:me.timerenabled = 0
If sw50p.z>0 then sw50p.z=0:me.timerenabled = 0
End Sub
Sub sw51_Timer()
sw51p.z=sw51p.z+1*tdir
If sw51p.z < -50 then sw51p.z =-50:me.timerenabled = 0
If sw51p.z>0 then sw51p.z=0:me.timerenabled = 0
End Sub
Sub sw58_Timer()
sw58p.z=sw58p.z+1*tdir
If sw58p.z < -50 then sw58p.z =-50:me.timerenabled = 0
If sw58p.z>0 then sw58p.z=0:me.timerenabled = 0
End Sub
'******************************************
' DANCER ANIMATION
'******************************************
dim dance
sub solDancer(enabled)
if enabled then
dancerT.enabled=1
else
dancerT.enabled=0
end if
end sub
sub dancerT_timer()
dancer.ShowFrame(dance)
'dance = dance + (sin(dance*0.2854)+1)/2 old script, less exaggerated
dance = dance + (sin(dance*0.2854)*1.3+0.7)/2
If dance > 11 Then dance = 0 End If
end sub
'******************************************
' Gates
'******************************************
dim GateStateL, GateStateR : GateStateL = 0 : GateStateR = 0
'
Sub GateLeft(enabled) : If enabled then : GateL.Open = true : GateStateL = 1 : vpmTimer.AddTimer 1000, "GateCloseL" : End If : End Sub
Sub GateCloseL(aSw) : GateL.Open = false : GateStateL = 0 : End Sub
Sub GateRight(enabled) : If enabled then : GateR.Open = true : GateStateR = 1 : vpmTimer.AddTimer 1000, "GateCloseR" : End If : End Sub
Sub GateCloseR(aSw) : GateR.Open = false : GateStateR = 0 : End Sub
'******************************************
' Captive ball script
' based on pacdudes script
'******************************************
dim mBallDir, mBallCos, mBallSin
dim mTrig, mWall, mKickers, mVelX, mVelY, mVelX2, mVelY2
dim ForceTransL, ForceTransR, MinForce
dim BP1,BP2,BP3,BP4,BP1R,BP2R,BP3L,BP4L
' Default Settings
ForceTransL = 0.4 : ForceTransR = 0.6 : MinForce = 5 : mBallDir = 10
mBallCos = Cos(mBallDir * 3.1415927/180) : mBallSin = Sin(mBallDir * 3.1415927/180)
' Trigger Leads (Left/Right Side)
Sub CapLLead_Hit() : mVelX = activeBall.VelX : mVelY = activeBall.VelY : End Sub
Sub CapRLead_Hit() : mVelX2 = activeBall.VelX : mVelY2 = activeBall.VelY : End Sub
' Left Side Captive Ball Hits (Up Motion)
Sub CapLHit_Hit()
dim force, dx, dy
dX = ActiveBall.X - Captive1.X : dY = ActiveBall.Y - Captive1.Y
force = -ForceTransL * (dY * mVelY + dX * mVelX) * (dY * mBallCos + dX * mBallSin) / (dX*dX + dY*dY)
If force < 1 Then Exit Sub
If force < MinForce Then force = MinForce
If BP3L Then : BP3L = False : ForceTransL = 0.2 :PlaySoundAtVol "fx_collide", CapLHit, 1: Captive3L.DestroyBall : CapMove3L.CreateBall : CapMove3L.Kick mBallDir, force : Else :_
If BP4L Then : BP4L = False : ForceTransL = 0.3 : Controller.Switch(78) = False :PlaySoundAtVol "fx_collide", CapLHit, 1: Captive4L.DestroyBall : CapMove4L.CreateBall : CapMove3L.enabled = False : CapMove4L.Kick mBallDir, force : Else :_
If BP2 Then : BP2 = False : ForceTransL = 0.4:PlaySoundAtVol "fx_collide", CapLHit, 1: Captive2.DestroyBall : CapMove2.CreateBall : CapMove4L.enabled = False : CapMove2.Kick mBallDir, force : Else :_
If BP1 Then : BP1 = False : Controller.Switch(77) = False :PlaySoundAtVol "fx_collide", CapLHit, 1: Captive1.DestroyBall : CapMove1.CreateBall : CapMove2.enabled = False : CapMove1.Kick mBallDir, force :_
End If : End If : End If : End If
End Sub
' Right Side Captive Ball Hits (Up Motion)
Sub CapRHit_Hit()
dim force2, dx2, dy2
dX2 = ActiveBall.X - Captive3.X : dY2 = ActiveBall.Y - Captive3.Y
force2 = -ForceTransR * (dY2 * mVelY2 + dX2 * mVelX2) * (dY2 * mBallCos + dX2 * mBallSin) / (dX2*dX2 + dY2*dY2)
If force2 < 1 Then Exit Sub
If force2 < MinForce Then force2 = MinForce
If BP1R Then : BP1R = False : ForceTransR = 0.2 :PlaySoundAtVol "fx_collide", CapRHit, 1: Captive1R.DestroyBall : CapMove1R.CreateBall : CapMove1R.Kick mBallDir, force2 : Else :_
If BP2R Then : BP2R = False : ForceTransR = 0.3 : Controller.Switch(80) = False :PlaySoundAtVol "fx_collide", CapRHit, 1: Captive2R.DestroyBall : CapMove2R.CreateBall : CapMove1R.enabled = False : CapMove2R.Kick mBallDir, force2 : Else :_
If BP4 Then : BP4 = False : ForceTransR = 0.4 :PlaySoundAtVol "fx_collide", CapRHit, 1: Captive4.DestroyBall : CapMove4.CreateBall : CapMove2R.enabled = False : CapMove4.Kick mBallDir, force2 : Else :_
If BP3 Then : BP3 = False : Controller.Switch(79) = False :PlaySoundAtVol "fx_collide", CapRHit, 1: Captive3.DestroyBall : CapMove3.CreateBall : CapMove4.enabled = False : CapMove3.Kick mBallDir, force2 :_
End If : End If : End If : End If
End Sub
' Left Side Return Hits (Down Motion)
Sub CapMove1_Hit()
If BP1 = True Then
CapMove1.DestroyBall : CapMove2_Hit
Else
BP1 = True : Controller.Switch(77) = True : CapMove1.DestroyBall : Captive1.CreateBall : CapMove2.enabled = True
End If
End Sub
Sub CapMove2_Hit()
If BP2 = True Then
CapMove2.DestroyBall : CapMove4L_Hit
Else
BP2 = True : ForceTransL = 0.4 : CapMove2.DestroyBall : Captive2.CreateBall : CapMove4L.enabled = True
end if
End Sub
Sub CapMove4L_Hit()
If BP4L = True Then
CapMove4L.DestroyBall : CapMove3L_Hit
Else
BP4L = True : ForceTransL = 0.3 : Controller.Switch(78) = True : CapMove4L.DestroyBall : Captive4L.CreateBall : CapMove3L.enabled = True
End If
End Sub
Sub CapMove3L_Hit()
BP3L = True : ForceTransL = 0.2 : CapMove3L.DestroyBall : Captive3L.CreateBall
End Sub
' Right Side Return Hits (Down Motion)
Sub CapMove3_Hit()
If BP3 = True Then
CapMove3.DestroyBall : CapMove4_Hit
Else
BP3 = True : Controller.Switch(79) = True : CapMove3.DestroyBall : Captive3.CreateBall : CapMove4.enabled = True
End If
End Sub
Sub CapMove4_Hit()
If BP4 = True Then
CapMove4.DestroyBall : CapMove2R_Hit
Else
BP4 = True : ForceTransR = 0.4 : CapMove4.DestroyBall : Captive4.CreateBall : CapMove2R.enabled = True
End If
End Sub
Sub CapMove2R_Hit()
If BP2R = True Then
CapMove2R.DestroyBall : CapMove1R_Hit
Else
BP2R = True : ForceTransR = 0.3 : Controller.Switch(80) = True : CapMove2R.DestroyBall : Captive2R.CreateBall : CapMove1R.enabled = True
End If
End Sub
Sub CapMove1R_Hit()
BP1R = True : ForceTransR = 0.2 : CapMove1R.DestroyBall : Captive1R.CreateBall
End Sub
' Destroy any Existing Balls and Create the 4 Captive Balls (either real or reel-based)
Sub CreateBalls()
Captive1.DestroyBall : Captive2.DestroyBall : Captive3.DestroyBall : Captive4.DestroyBall
Captive4L.DestroyBall : Captive3L.DestroyBall : Captive1R.DestroyBall : Captive2R.DestroyBall
If BP1 Then : Captive1.CreateBall : End If : If BP2 Then : Captive2.CreateBall : End If : If BP4L Then : Captive4L.CreateBall : End If
If BP3L Then : Captive3L.CreateBall : End If : If BP3 Then : Captive3.CreateBall : End If : If BP4 Then : Captive4.CreateBall : End If
If BP2R Then : Captive2R.CreateBall : End If : If BP1R Then : Captive1R.CreateBall : End If
End Sub
'******************************************
' LowerLock And Post Handling
'******************************************
dim postdwn : postdwn = 0
Sub SolLowerLockPin(Enabled)
if enabled then
If lockPin.IsDropped=0 Then:Playsound SoundFX("diverter"):End If
If postdwn = 0 Then vpmTimer.AddTimer 500, "PostUp"
lockPin.IsDropped=1:postdwn = 1
If bsSw48.Balls>0 Then
sw48H.DestroyBall:sw48.CreateSizedballwithMass BSize,BMass:bsSw48.SolOut 1:sw48.Kick 210, 1
If bsSw48.Balls = 0 Then
controller.switch(48) = 0
End If
End If
If bsSw47.Balls>0 Then
sw47H.DestroyBall:sw47.CreateSizedballwithMass BSize,BMass:bsSw47.SolOut 1:sw47.Kick 180, 1
If bsSw47.Balls = 0 Then
controller.switch(47) = 0
End If
End If
If bsSw46.Balls>0 Then
sw46H.DestroyBall:sw46.CreateSizedballwithMass BSize,BMass:bsSw46.SolOut 1:sw46.Kick 180, 1
If bsSw46.Balls = 0 Then
controller.switch(46) = 0
End If
End If
If bsTHelp.Balls>0 Then
swTHelpH.DestroyBall:swTHelp.CreateSizedballwithMass BSize,BMass:bsTHelp.SolOut 1:swTHelp.Kick 180, 1
End If
End If
End Sub
Sub PostUp(aSw)
postdwn = 0:lockPin.IsDropped=0
End Sub
Sub swTHelp_Hit()
Dim BSpeed
' BIPFF = BIPFF - 1
If bsTHelp.Balls>0 Then
swTHelp.DestroyBall:sw46_Hit
Else
BSpeed = ActiveBall.VelY
If bsSw46.Balls = 0 then
swTHelp.Kick 180, BSpeed
Else
swTHelp.DestroyBall:swTHelpH.CreateSizedballwithMass BSize,BMass:bsTHelp.AddBall 1
End If
End If
End Sub
Sub sw46_Hit()
Dim BSpeed
If bsSw46.Balls>0 Then
sw46.DestroyBall:sw48_Hit
Else
BSpeed = ActiveBall.VelY
If bsSw47.Balls = 0 then
vpmTimer.PulseSw 46
sw46.Kick 180, BSpeed
Else
controller.switch(46) = 1
sw46.DestroyBall:sw46H.CreateSizedballwithMass BSize,BMass:bsSw46.AddBall 1
End If
End If
End Sub
Sub sw47_Hit()
Dim BSpeed
If bsSw47.Balls>0 Then
sw47.DestroyBall:sw46_Hit
Else
BSpeed = ActiveBall.VelY
If bsSw48.Balls = 0 then
vpmTimer.PulseSw 47
sw47.Kick 180, BSpeed
Else
controller.switch(47) = 1
sw47.DestroyBall:sw47H.CreateSizedballwithMass BSize,BMass:bsSw47.AddBall 1
End If
End If
End Sub
Sub sw48_Hit()
Dim BSpeed
BSpeed = ActiveBall.VelY
If bsSw48.Balls>0 and bsSw47.Balls>0 and bsSw46.Balls>0 Then
sw48.Kick 210, BSpeed
Else
If bsSw48.Balls > 0 then
sw48.DestroyBall:sw47_Hit
Else
controller.switch(48) = 1
sw48.DestroyBall:sw48H.CreateSizedballwithMass BSize,BMass:bsSw48.AddBall 1
End If
End If
End Sub
' Sub sw48_UnHit():BIPFF = BIPFF + 1:End Sub
'******************************************
' Left Kickback
'******************************************
Sub SolKickBack(enabled)
If enabled then
PlaySound SoundFX("Solenoid")
kickback.Fire
else
kickback.PullBack
End If
End Sub
'******************************************
' Ramp diverters
'******************************************
Sub SolLRDIvert(Enabled)
If Enabled then
DivLR.IsDropped=0
Else
DivLR.IsDropped=1
End If
End Sub
Sub SolRDivert1(Enabled)
If Enabled then
DivTubef.RotateToEnd
DivTube.isDropped=1
DivTube1.isDropped=0
PlaySoundAtVol SoundFX("Diverter"), DivTubef, 1
vpmTimer.AddTimer 3000, "UnRDivert"
End If
End Sub
Sub UnRDivert(aSw)
DivTubef.RotateToStart
DivTube.isDropped=0
DivTube1.isDropped=1
End Sub
Sub SolRDivert2(Enabled)
If Enabled then
DivTube2f.RotateToEnd
DivTube2.isDropped=1
PlaySoundAtVol SoundFX("Diverter"), DivTube2f, 1
Else
DivTube2f.RotateToStart
DivTube2.isDropped=0
End If
End Sub
Sub SolRDivert3(Enabled)
If Enabled then
DivLock.IsDropped=1
PlaySound SoundFX("Diverter")
Else
DivLock.IsDropped=0
End If
End Sub
'******************************************
' Alien Lock Mech Handler
'******************************************
'Note : The Startup timer is a workaround for motor overshoot caused by no power control option in VPM for the solenoids.
' - It sends an extra quarter cycle of switch changes with no animation before animation engages at actual overshoot position)
' - This prevents the alien mech from looping 2-3 times every time it starts due to position loss caused by overshoot in the
' - forward direction. The alien mech has also been modified to correct a mis-position problem that happens sometimes after
' - Looped In Space mode ends. The correction ensures the alien mech always faces home when it stops. Since during the game
' - it only ever stops at the home position, this makes it fully functional, although the operator test mode doesn't function
' - as one would expect it to (making full loops instead of small movements), but that has no bearing on normal gameplay.
dim startstatus, checkstart : startstatus = 0 : checkstart = 0
Sub SolAlienForward(Enabled)
If enabled then
forward = 1 : ALockTimer.enabled = 1
Else
forward = 0
End If
End Sub
Sub SolAlienReverse(Enabled)
If enabled then
reverse = 1 : ALockTimer.enabled = 1
Else
reverse = 0
End If
End Sub
Sub ALockStartup_Timer() : If direction = 0 then : If checkstart = 0 and startstatus = 1 then : vpmTimer.AddTimer 1000, "CheckStatus" : End If : checkstart = 1 : Else : checkstart = 0 : End If : End Sub
Sub CheckStatus(aSw) : if checkstart = 1 Then : startstatus = 0 : OldPos = 31 : NewPos = 0 : End If : End Sub
dim NewPos, forward, reverse, OldPos : OldPos = 31 : NewPos = 0 : forward = 0 : reverse = 0
'dim RAlien:RAlien = Array(RM0,RM1,RM2,RM3,RM4,RM5,RM6,RM7,RM8,RM9)
'dim LAlien:LAlien = Array(RM10,RM19,RM18,RM17,RM16,RM15,RM14,RM13,RM12,RM11)
dim direction
Sub ALockTimer_timer()
if reverse = 1 then : direction = -1 : end if : If forward = 1 then direction = 1 : end if
NewPos = OldPos + direction
If (NewPos > OldPos) and NewPos >= 32 Then NewPos = 0
If (NewPos < OldPos) and NewPos < 0 Then NewPos = 31
If startstatus = 0 and forward = 1 then
if NewPos >= 7 then startstatus = 1
Select Case NewPos
Case 0 : controller.switch(57) = 0 ' Home Notch 1 (Reset Trick)
Case 1 : controller.switch(57) = 1
Case 2 : controller.switch(57) = 0 ' Home Notch 2 (Rest Trick)
Case 3 : controller.switch(57) = 1
Case 7 : controller.switch(57) = 1
End Select
Else
' If OldPos <> NewPos Then PlaySound Soundfx ("Motor")
' Handle Optos
If forward = 1 or reverse = 1 Then
Select Case NewPos
Case 0 : controller.switch(57) = 0 ' Home Notch 1
Case 1 : controller.switch(57) = 1
Case 2 : controller.switch(57) = 0 ' Home Notch 2
Case 3 : controller.switch(57) = 1
Case 7 : controller.switch(57) = 1
Case 8 : controller.switch(57) = 0 ' Quarter Turn
Case 9 : controller.switch(57) = 1
Case 15: controller.switch(57) = 1
Case 16: controller.switch(57) = 0 ' Half Turn
Case 17: controller.switch(57) = 1
Case 23: controller.switch(57) = 1
Case 24: controller.switch(57) = 0 ' Three Quarters Turn
Case 25: controller.switch(57) = 1
Case 31: controller.switch(57) = 1
End Select
End If
' Animate Aliens
Select Case NewPos
Case 2 : Alien1.rotZ=-255:Alien2.rotZ=345:AW0018624.image = "AW00186-24p27" 'AlienReel.setvalue 8
Case 3 : Alien1.rotZ=-270:Alien2.rotZ=0:AW0018624.image = "AW00186-24p28" 'AlienReel.setvalue 9
Case 5 : Alien1.rotZ=-290:Alien2.rotZ=20:AW0018624.image = "AW00186-24p30" 'AlienReel.setvalue 9
Case 6 : Alien1.rotZ=-315:Alien2.rotZ=45:AW0018624.image = "AW00186-24p31" 'AlienReel.setvalue 0
Case 9 : Alien1.rotZ=-330:Alien2.rotZ=60:AW0018624.image = "AW00186-24p2" 'AlienReel.setvalue 0
Case 10 : Alien1.rotZ=0:Alien2.rotZ=90:AW0018624.image = "AW00186-24p3" 'AlienReel.setvalue 1
Case 11 : Alien1.rotZ=-15:Alien2.rotZ=105:AW0018624.image = "AW00186-24p5" 'AlienReel.setvalue 1
Case 12 : Alien1.rotZ=-30:Alien2.rotZ=120:AW0018624.image = "AW00186-24p6" 'AlienReel.setvalue 2
Case 15 : Alien1.rotZ=-45:Alien2.rotZ=135:AW0018624.image = "AW00186-24p9" 'AlienReel.setvalue 2
Case 16 : Alien1.rotZ=-60:Alien2.rotZ=150:AW0018624.image = "AW00186-24p10" 'AlienReel.setvalue 3
Case 18 : Alien1.rotZ=-75:Alien2.rotZ=165:AW0018624.image = "AW00186-24p11" 'AlienReel.setvalue 3
Case 19 : Alien1.rotZ=-90:Alien2.rotZ=180:AW0018624.image = "AW00186-24p12" 'AlienReel.setvalue 4
Case 21 : Alien1.rotZ=-120:Alien2.rotZ=200:AW0018624.image = "AW00186-24p15" 'AlienReel.setvalue 4
Case 22 : Alien1.rotZ=-135:Alien2.rotZ=225:AW0018624.image = "AW00186-24p16" 'AlienReel.setvalue 5
Case 24 : Alien1.rotZ=-160:Alien2.rotZ=250:AW0018624.image = "AW00186-24p18" 'AlienReel.setvalue 5
Case 25 : Alien1.rotZ=-180:Alien2.rotZ=270:AW0018624.image = "AW00186-24p19" 'AlienReel.setvalue 6
Case 27 : Alien1.rotZ=-195:Alien2.rotZ=285:AW0018624.image = "AW00186-24p21" 'AlienReel.setvalue 6
Case 28 : Alien1.rotZ=-210:Alien2.rotZ=300:AW0018624.image = "AW00186-24p22" 'AlienReel.setvalue 7
Case 30 : Alien1.rotZ=-225:Alien2.rotZ=315:AW0018624.image = "AW00186-24p24" 'AlienReel.setvalue 7
Case 31 : Alien1.rotZ=-240:Alien2.rotZ=330:AW0018624.image = "AW00186-24p25" 'AlienReel.setvalue 8
End Select
'Eject Lock
If (NewPos >= 12 and NewPos <= 15) and (bsALL.balls > 0 or bsALR.balls > 0) Then
AlienEjectR : vpmTimer.Addtimer 300, "AlienEjectL"
End If
End If
OldPos = NewPos
If direction = 1 Then
If forward = 0 and reverse = 0 and NewPos >= 6 and NewPos <= 9 Then : Direction = 0 : ALockTimer.enabled = False : StopSound "Motor": End If
Else
If forward = 0 and reverse = 0 Then : Direction = 0 : ALockTimer.enabled = False : End If
End If
End Sub
' Eject Ball Subs
Sub AlienEjectL(aSw) : bsALL.SolOut 1 : End Sub
Sub AlienEjectR() : bsALR.SolOut 1 : End Sub
Sub sw61Out_UnHit():BIPFF = BIPFF + 1:End Sub
Sub sw62Out_UnHit():BIPFF = BIPFF + 1:End Sub
'******************************************
' Drains and Kickers
'******************************************
Sub Drain_Hit():PlaySoundAtVol "Drain", Drain, 1:BIPFF = BIPFF - 1:bsTrough.AddBall Me:End Sub
Sub BallRelease_UnHit():BIPFF = BIPFF + 1:End Sub
Sub sw61_Hit():BIPFF = BIPFF - 1:bsALL.AddBall Me:End Sub
Sub sw62_Hit():BIPFF = BIPFF - 1:bsALR.AddBall Me:End Sub
Sub sw67_Hit:PlaysoundAtVol "kicker_enter", sw67, 1:bsRHole.AddBall Me:End Sub
'************
' SlingShots
'************
Dim RStep, Lstep
Sub RightSlingShot_Slingshot
PlaySoundAT SoundFX("SlingshotRight"), sling1
RSling.Visible = 0
RSling1.Visible = 1
sling1.TransZ = -20
RStep = 0
RightSlingShot.TimerEnabled = 1
vpmTimer.PulseSw 52
End Sub
Sub RightSlingShot_Timer
Select Case RStep
Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
End Select
RStep = RStep + 1
End Sub
Sub LeftSlingShot_Slingshot
PlaySoundAT SoundFX("SlingshotLeft"), sling2
LSling.Visible = 0
LSling1.Visible = 1
sling2.TransZ = -20
LStep = 0
LeftSlingShot.TimerEnabled = 1
vpmTimer.PulseSw 51
End Sub
Sub LeftSlingShot_Timer
Select Case LStep
Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
End Select
LStep = LStep + 1
End Sub
'************************************************
' Bumpers Animation
'************************************************
Dim dirRing1:dirRing1 = -1
Dim dirRing2:dirRing2 = -1
Dim dirRing3:dirRing3 = -1
Sub Bumper1_Hit:vpmTimer.PulseSw 56:me.TimerEnabled = 1:End Sub
Sub Bumper2_Hit:vpmTimer.PulseSw 54:me.TimerEnabled = 1:End Sub
Sub Bumper3_Hit:vpmTimer.PulseSw 55:me.TimerEnabled = 1:End Sub
Sub Bumper1_timer()
Bumper1Ring.Z = Bumper1Ring.Z + (5 * dirRing1)
If Bumper1Ring.Z <= -40 Then dirRing1 = 1
If Bumper1Ring.Z >= 0 Then
dirRing1 = -1
Bumper1Ring.Z = 0
Me.TimerEnabled = 0
End If
End Sub
Sub Bumper2_timer()
Bumper2Ring.Z = Bumper2Ring.Z + (5 * dirRing2)
If Bumper2Ring.Z <= -40 Then dirRing2 = 1
If Bumper2Ring.Z >= 0 Then
dirRing2 = -1
Bumper2Ring.Z = 0
Me.TimerEnabled = 0
End If
End Sub
Sub Bumper3_timer()
Bumper3Ring.Z = Bumper3Ring.Z + (5 * dirRing3)
If Bumper3Ring.Z <= -40 Then dirRing3 = 1
If Bumper3Ring.Z >= 0 Then
dirRing3 = -1
Bumper3Ring.Z = 0
Me.TimerEnabled = 0
End If
End Sub
'************************************************
' Switches
'************************************************
'*******Rollover switches
Sub sw26_Hit:Controller.Switch(26) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw26_UnHit:Controller.Switch(26) = 0:End Sub
Sub sw27_Hit:Controller.Switch(27) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw27_UnHit:Controller.Switch(27) = 0:End Sub
Sub sw28_Hit:Controller.Switch(28) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw28_UnHit:Controller.Switch(28) = 0:End Sub
Sub sw29_Hit:Controller.Switch(29) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw29_UnHit:Controller.Switch(29) = 0:End Sub
Sub sw30_Hit:Controller.Switch(30) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw30_UnHit:Controller.Switch(30) = 0:End Sub
Sub sw43_Hit:Controller.Switch(43) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:plungerbulb.state=2:End Sub
Sub sw43_UnHit:Controller.Switch(43) = 0:End Sub
Sub sw44_Hit:Controller.Switch(44) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw44_UnHit:Controller.Switch(44) = 0:End Sub
Sub sw45_Hit:Controller.Switch(45) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw45_UnHit:Controller.Switch(45) = 0:End Sub
Sub sw59_Hit:Controller.Switch(59) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw59_UnHit:Controller.Switch(59) = 0:End Sub
Sub sw60_Hit:Controller.Switch(60) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw60_UnHit:Controller.Switch(60) = 0:End Sub
Sub sw65_Hit:Controller.Switch(65) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw65_UnHit:Controller.Switch(65) = 0:End Sub
Sub sw66_Hit:Controller.Switch(66) = 1:PlaySoundAtVol "rollover", ActiveBall, 1:End Sub
Sub sw66_UnHit:Controller.Switch(66) = 0:End Sub
'*******Ramp Switches
Sub sw24_Hit():Controller.Switch(24) = 1:PlaySoundAtVol "Gate", ActiveBall, 1:End Sub
Sub sw24_UnHit:Controller.Switch(24) = 0:End Sub