forked from sverrewl/vpxtable_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2 in 1 (Bally 1964).vbs
1560 lines (1374 loc) · 37.3 KB
/
2 in 1 (Bally 1964).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
'*** 2 in 1 ***
' Thalamus 2018-07-18
' Added/Updated "Positional Sound Playback Functions" and "Supporting Ball & Sound Functions"
Option Explicit
Randomize
dim score(4)
dim truesc(4)
dim reel(4)
dim ballrelenabled
dim state
dim credit
dim eg
dim currpl
dim playno
dim plno(2)
dim play(2)
dim rst
dim ballinplay
dim match(10)
dim tilt
dim tiltsens
dim rep(4)
dim matchnumb
dim bell
dim points
dim tempscore
dim replay1
dim replay2
dim replay3
dim replay4
dim hisc
dim scn
dim scn1
dim scn2
dim scn3
dim wv
dim mv
dim qs
dim wn
dim sbv1
dim sbv2
dim i
Dim B2SOn
Dim controller
ExecuteGlobal GetTextFile("core.vbs")
Sub Table1_Init
scntimer.enabled=False
scntimer1.enabled=False
scntimer2.enabled=False
set play(1)=plno1
set play(2)=plno2
set match(0)=m0
set match(1)=m1
set match(2)=m2
set match(3)=m3
set match(4)=m4
set match(5)=m5
set match(6)=m6
set match(7)=m7
set match(8)=m8
set match(9)=m9
set reel(1)=reel1
set reel(2)=reel2
set reel(3)=reel3
set reel(4)=reel4
replay1=800
replay2=1000
replay3=1200
replay4=1400
loadhs
if hisc="" then hisc=1000
hisctxt.text=hisc
if credit="" then credit=0
credittxt.text=credit
if matchnumb="" then matchnumb=int(rnd(1)*9)
select case(matchnumb)
case 0:
m0.text="0"
case 1:
m1.text="1"
case 2:
m2.text="2"
case 3:
m3.text="3"
case 4:
m4.text="4"
case 5:
m5.text="5"
case 6:
m6.text="6"
case 7:
m7.text="7"
case 8:
m8.text="8"
case 9:
m9.text="9"
end select
for i=1 to 2
currpl=i
reel(i).setvalue(score(i))
next
currpl=0
B2SOn=True
if B2SOn then
Set Controller = CreateObject("B2S.Server")
Controller.B2SName = "Bally2In1_1964"
Controller.Run()
If Err Then MsgBox "Can't Load B2S.Server."
End if
If B2SOn Then
if matchnumb=0 then
Controller.B2SSetMatch 10
else
Controller.B2SSetMatch matchnumb
End if
Controller.B2SSetScoreRolloverPlayer1 0
Controller.B2SSetScoreRolloverPlayer2 0
Controller.B2SSetScoreRolloverPlayer3 0
Controller.B2SSetScoreRolloverPlayer4 0
Controller.B2SSetTilt 1
Controller.B2SSetCredits Credit
Controller.B2SSetGameOver 1
Controller.B2SSetData 81,0
Controller.B2SSetData 82,0
Controller.B2SSetData 83,0
Controller.B2SSetData 84,0
End if
for i=1 to 4
If B2SOn Then
Controller.B2SSetScorePlayer i, 0
End if
next
bell=0
pno1.state=0
pno2.state=0
mv=0
reel3.setvalue(sbv1)
reel4.setvalue(sbv2)
pno1.state=1
End Sub
Sub Table1_KeyDown(ByVal keycode)
If keycode = PlungerKey Then Plunger.PullBack: PlaySound "plungerpull",0,1,0.25,0.25, AudioFade(Plunger): End if
if keycode = 6 then
playsound "coin3"
coindelay.enabled=true
If B2SOn Then
Controller.B2SSetCredits Credit
End if
End if
if keycode = 5 then
playsound "coin3"
coindelay1.enabled=true
If B2SOn Then
Controller.B2SSetCredits Credit
End if
End if
if keycode = 2 and credit>0 and state=false and playno=0 then
credit=credit-1
qs=qs-1
if qs<0 then qs=0
credittxt.text=credit
eg=0
playno=1
currpl=1
pno.setvalue(playno)
play(currpl).state=1
playsound "click"
playsound "initialize"
rst=0
ballinplay=1
resettimer.enabled=true
If B2SOn Then
Controller.B2SSetTilt 0
Controller.B2SSetGameOver 0
Controller.B2SSetMatch 0
Controller.B2SSetCredits Credit
Controller.B2SSetCanPlay 1
Controller.B2SSetPlayerUp 1
Controller.B2SSetData 81,0
Controller.B2SSetData 82,0
Controller.B2SSetData 83,0
Controller.B2SSetData 84,0
'Controller.B2SSetBallInPlay BallInPlay
Controller.B2SSetScoreRolloverPlayer1 0
End if
End if
if keycode = 2 and credit>0 and state=true and playno>0 and playno<2 and ballinplay<2 then
credit=credit-1
qs=qs-1
if qs<0 then qs=0
credittxt.text=credit
playno=playno+1
select case(playno)
case 1:
pno1.state=1
case 2:
pno2.state=1
end select
pno.setvalue(playno)
playsound "click"
If B2SOn Then
Controller.B2SSetCredits Credit
Controller.B2SSetCanPlay playno
End if
End if
if state=true and tilt=false then
If keycode = LeftFlipperKey Then
LeftFlipper.RotateToEnd
PlaySound "FlipperUp",0,1,-0.05,0, AudioFade(LeftFlipper)
playsound "buzz",0 ,1,-0.05,0, AudioFade(LeftFlipper)
End if
If keycode = RightFlipperKey Then
RightFlipper.RotateToEnd
PlaySound "FlipperUp",0, 1,0.05,0,AudioFade(RightFlipper)
playsound "buzz",0, 1,-0.05,0,AudioFade(RightFlipper)
End if
If keycode = LeftTiltKey Then
Nudge 90, 1
checktilt
End if
If keycode = RightTiltKey Then
Nudge 270, 1
checktilt
End if
If keycode = CenterTiltKey Then
Nudge 0, 1
checktilt
End if
If keycode = MechanicalTilt Then
mechchecktilt
End if
End if
If keycode = RightMagnaSave then Light50.state=1: Light51.state=1: Playsound "click": End if
If keycode = RightMagnaSave then
Light1.state=0
Light2.state=0
Light3.state=0
Light4.state=0
Mushroomlight1.state=0
Mushroomlight2.state=0
Mushroomlight3.state=0
Mushroomlight4.state=0
Mushroomlight5.state=0
if B2SOn Then
Controller.B2SSetData 81,1
End if
End if
End Sub
Sub Table1_KeyUp(ByVal keycode)
If keycode = PlungerKey Then
Plunger.Fire
PlaySoundAt "plungerrelease", Plunger
End if
If keycode = LeftFlipperKey Then
LeftFlipper.RotateToStart
stopsound "buzz"
if state=true and tilt=false then PlaySound "FlipperDown",0,1,-0.05, 0, AudioFade(LeftFlipper)
End if
If keycode = RightFlipperKey Then
RightFlipper.RotateToStart
stopsound "buzz"
if state=true and tilt=false then PlaySound "FlipperDown",0,1,0.05, 0, AudioFade(RightFlipper)
End if
End Sub
sub flippertimer_timer()
LFlip.RotY = LeftFlipper.CurrentAngle+90
RFlip.RotY = RightFlipper.CurrentAngle+90
End Sub
sub newgame
Light17.state=0
Light18.state=0
Light19.state=0
Light20.state=0
Light21.state=0
Light22.state=0
Light23.state=0
Light24.state=0
Light25.state=0
Light26.state=0
Light27.state=0
Light28.state=0
Light50.state=0
Light51.state=0
sbv1=0
sbv2=0
pno2.state=0
scntimer.enabled=False
scntimer1.enabled=False
scntimer2.enabled=False
state=true
eg=0
for i=0 to 3
score(i)=0
truesc(i)=0
rep(i)=0
next
bip5.text=" "
bip1.text="1"
for i=0 to 9
match(i).text=" "
next
tilttext.text=" "
gamov.text=" "
tilt=false
tiltsens=0
ballinplay=1
wheelcheck
motorcheck
nb.CreateBall
nb.kick 90,6
If B2SOn then Controller.B2SSetBallInPlay 1
End Sub
sub resettimer_timer
rst=rst+1
reel1.resettozero
reel2.resettozero
reel3.resettozero
reel4.resettozero
If B2SOn Then
Controller.B2SSetScorePlayer1 0
Controller.B2SSetScorePlayer2 0
Controller.B2SSetScorePlayer3 0
Controller.B2SSetScorePlayer4 0
End if
if rst=14 then
playsound "kickerkick"
End if
if rst=18 then
newgame
resettimer.enabled=false
End if
End Sub
sub coindelay_timer
playsound "click"
credit=credit+5
credittxt.text=credit
coindelay.enabled=false
If B2SOn Then
Controller.B2SSetCredits Credit
End if
End Sub
sub coindelay1_timer
playsound "click"
credit=credit+1
credittxt.text=credit
coindelay1.enabled=false
If B2SOn Then
Controller.B2SSetCredits Credit
End if
End Sub
'*********************
'*** Points Scoring***
'*********************
sub addscore(points)
if tilt=false then
bell=0
scn=0
scn1=0
if points = 1 or points = 10 then scn=1
if points = 1 or points = 10 then matchnumb=matchnumb+1
if matchnumb=10 then matchnumb=0
if points=1 or points=10 then
Light13.state=0
Light14.state=0
Light15.state=0
Light16.state=0
End if
if points = 50 then
reel(currpl).addvalue(50)
bell=2
scn=5
mv=mv+1
motorcheck
End if
if points = 20 then
reel(currpl).addvalue(20)
bell=2
scn=2
mv=mv+1
motorcheck
End if
if points = 10 then
reel(currpl).addvalue(10)
bell=2
End if
if points = 1 then
reel(currpl).addvalue(1)
bell=1
End if
scntimer.enabled=true
score(currpl)=score(currpl)+points
truesc(currpl)=truesc(currpl)+points
If B2SOn Then
Controller.B2SSetScore currpl,score(currpl)
End if
if score(currpl)>9999 then
score(currpl)=score(currpl)-10000
rep(currpl)=0
End if
if score(currpl)=>replay1 and rep(currpl)=0 then
credit=credit+1
qs=qs+2
playsound "knocke"
credittxt.text=credit
If B2SOn Then
Controller.B2SSetCredits Credit
End if
rep(currpl)=1
playsound "click"
End if
if score(currpl)=>replay2 and rep(currpl)=1 then
qs=qs+2
credit=credit+1
playsound "knocke"
credittxt.text=credit
If B2SOn Then
Controller.B2SSetCredits Credit
End if
rep(currpl)=2
playsound "click"
End if
if score(currpl)=>replay3 and rep(currpl)=2 then
credit=credit+1
qs=qs+2
playsound "knocke"
credittxt.text=credit
If B2SOn Then
Controller.B2SSetCredits Credit
End if
rep(currpl)=3
playsound "click"
End if
if score(currpl)=>replay4 and rep(currpl)=3 then
credit=credit+1
qs=qs+2
playsound "knocke"
credittxt.text=credit
If B2SOn Then
Controller.B2SSetCredits Credit
End if
rep(currpl)=4
playsound "click"
End if
End if
End Sub
sub scntimer_timer
scn1=scn1 + 1
if bell=1 then playsound "bell1",0, 0.3, 0, 0
if bell=2 then playsound "bell10",0, 0.6, 0, 0
if bell=3 then playsound "bell100",0, 0.9, 0, 0
wv=wv+1
if wv>9 then wv=0
wheelcheck
if scn1=scn then scntimer.enabled=false
End Sub
sub scntimer1_timer
scn2=scn2 + 1
if bell=3 then playsound "bell100",0, 0.9, 0, 0
if scn2=scn3 then scntimer1.enabled=false
wheelcheck
End Sub
sub wheelcheck
If wv=0 or wv=1 then
BumperLight1.state=1
LeftSlingLight.state=1
BumperLight2.state=0
BumperLight3.state=0
RightSlingLight.state=0
If Light50.state=1 then Mushroomlight1.state=0 else MushroomLight1.state=1
MushroomLight2.state=0
MushroomLight3.state=0
If Light50.state=1 then Mushroomlight4.state=0 else MushroomLight4.state=1
If Light50.state=1 then Mushroomlight5.state=0 else MushroomLight5.state=1
If Light50.state=1 then Light1.state=0 else Light1.state=1
Light2.state=0
Light3.state=0
If Light50.state=1 then Light4.state=0 else Light4.state=1
Light8.state=0
Light9.state=0
Light10.state=0
Light11.state=1
Light12.state=1
quickstep
End if
If wv=2 or wv=3 then
BumperLight1.state=1
LeftSlingLight.state=1
BumperLight2.state=1
bumperLight3.state=0
RightSlingLight.state=0
MushroomLight1.state=0
If Light50.state=1 then Mushroomlight2.state=0 else MushroomLight2.state=1
If Light50.state=1 then Mushroomlight3.state=0 else MushroomLight3.state=1
MushroomLight4.state=0
MushroomLight5.state=0
Light1.state=0
If Light50.state=1 then Light2.state=0 else Light2.state=1
If Light50.state=1 then Light2.state=0 else Light3.state=1
Light4.state=0
Light8.state=1
Light9.state=1
Light10.state=1
Light11.state=0
Light12.state=0
quickstep
End if
If wv=4 or wv=5 then
BumperLight1.state=1
LeftSlingLight.state=1
BumperLight2.state=1
BumperLight3.state=1
RightSlingLight.state=1
If Light50.state=1 then Mushroomlight1.state=0 else Mushroomlight1.state=1
MushroomLight2.state=0
MushroomLight3.state=0
If Light50.state=1 then Mushroomlight4.state=0 else MushroomLight4.state=1
If Light50.state=1 then Mushroomlight5.state=0 else MushroomLight5.state=1
If Light50.state=1 then Light1.state=0 else Light1.state=1
Light2.state=0
Light3.state=0
If Light50.state=1 then Light4.state=0 else Light4.state=1
Light8.state=0
Light9.state=0
Light10.state=0
Light11.state=1
Light12.state=1
quickstep
End if
If wv=6 or wv=7 then
BumperLight1.state=0
LeftSlingLight.state=0
BumperLight2.state=1
BumperLight3.state=1
RightSlingLight.state=1
MushroomLight1.state=0
If Light50.state=1 then Mushroomlight2.state=0 else MushroomLight2.state=1
If Light50.state=1 then Mushroomlight3.state=0 else MushroomLight3.state=1
MushroomLight4.state=0
MushroomLight5.state=0
Light1.state=0
If Light50.state=1 then Light2.state=0 else Light2.state=1
If Light50.state=1 then Light3.state=0 else Light3.state=1
Light4.state=0
Light8.state=1
Light9.state=1
Light10.state=1
Light11.state=0
Light12.state=0
quickstep
End if
If wv=8 or wv=9 then
BumperLight1.state=0
LeftSlingLight.state=0
BumperLight2.state=0
BumperLight3.state=1
RightSlingLight.state=1
If Light50.state=1 then Mushroomlight1.state=0 else MushroomLight1.state=1
MushroomLight2.state=0
MushroomLight3.state=0
If Light50.state=1 then Mushroomlight4.state=0 else MushroomLight4.state=1
If Light50.state=1 then Mushroomlight5.state=0 else MushroomLight5.state=1
If Light50.state=1 then Light1.state=0 else Light1.state=1
Light2.state=0
Light3.state=0
If Light50.state=1 then Light4.state=0 else Light4.state=1
Light8.state=0
Light9.state=0
Light10.state=0
Light11.state=1
Light12.state=1
quickstep
End if
End Sub
Sub quickstep
If wv=1 and qs>=8 then
BumperLight1.state=0
LeftSlingLight.state=0
BumperLight2.state=0
BumperLight3.state=0
RightSlingLight.state=0
End if
If wv=3 and qs>=12 then
BumperLight1.state=0
LeftSlingLight.state=0
BumperLight2.state=0
BumperLight3.state=0
RightSlingLight.state=0
End if
If (wv=4 or wv=5) and qs>=16 then
BumperLight1.state=0
LeftSlingLight.state=0
BumperLight2.state=0
BumperLight3.state=0
RightSlingLight.state=0
End if
If wv=7 and qs>=20 then
BumperLight1.state=0
LeftSlingLight.state=0
BumperLight2.state=0
BumperLight3.state=0
RightSlingLight.state=0
End if
If wv=9 and qs>=24 then
BumperLight1.state=0
LeftSlingLight.state=0
BumperLight2.state=0
BumperLight3.state=0
RightSlingLight.state=0
End if
End Sub
Sub motorcheck
If mv>2 then mv=0
If mv=0 then
Light5.state=1
Light6.state=1
Light7.state=0
End if
If mv=1 then
Light5.state=1
Light6.state=0
Light7.state=1
End if
If mv=2 then
Light5.state=0
Light6.state=1
Light7.state=1
End if
End Sub
Sub Lightcheck
If sbv1>21 then Light22.State=0: End if
If sbv1=21 then Light22.state=1: Light21.state=0: Light20.state=0: Light19.state=0: End if
If sbv1=20 then Light21.state=1: Light20.state=0: Light19.state=0: Light18.state=0: End if
If sbv1=19 then Light20.state=1: Light19.state=0: Light18.state=0: Light17.state=0: End if
If sbv1=18 then Light19.state=1: Light18.state=0: Light17.state=0: End if
If sbv1=17 then Light18.state=1: Light17.state=0: End if
If sbv1=16 then Light17.state=1: End if
If sbv2>21 then Light28.State=0: End if
If sbv2=21 then Light28.state=1: Light27.state=0: Light26.state=0: Light25.state=0: End if
If sbv2=20 then Light27.state=1: Light26.state=0: Light25.state=0: Light24.state=0: End if
If sbv2=19 then Light26.state=1: Light25.state=0: Light24.state=0: Light23.state=0: End if
If sbv2=18 then Light25.state=1: Light24.state=0: Light23.state=0: End if
If sbv2=17 then Light24.state=1: Light23.state=0: End if
If sbv2=16 then Light23.state=1: End if
End Sub
sub wheelchange_timer
wn=wn+1
if tilt=false then
If points=1 or points=10 then wv=wv+1
if wv>9 then wv=0
wheelcheck
End if
End Sub
Sub CheckTilt
If Tilttimer.Enabled = True Then
TiltSens = TiltSens + 1
if TiltSens = 2 Then
Tilt = True
tilttext.text="TILT"
If B2SOn Then Controller.B2SSetTilt 1
tiltsens = 0
playsound "tilt"
turnoff
End if
Else
TiltSens = 0
Tilttimer.Enabled = True
End if
End Sub
Sub MechCheckTilt
Tilt = True
tilttext.text="TILT"
If B2SOn Then Controller.B2SSetTilt 1
tiltsens = 0
playsound "tilt"
LeftFlipper.RotateToStart
RightFlipper.RotateToStart
turnoff
End Sub
Sub Tilttimer_Timer()
Tilttimer.Enabled = False
End Sub
sub turnoff
tiltseq.play seqalloff
for i=0 to 10
next
End Sub
Sub Drain_Hit()
PlaySoundAt "drainshorter", Drain
Light50.state=0
Light51.state=0
wheelcheck
Drain.DestroyBall
nextball
End Sub
sub nextball
if tilt=true then
tilt=false
tilttext.text=" "
If B2SOn Then Controller.B2SSetTilt 0:Controller.B2SSetData 81,0
tiltseq.stopplay
pno.setvalue(playno)
End if
If B2SOn Then Controller.B2SSetData 81,0
ballreltimer.enabled=true
scntimer.enabled=False
scntimer1.enabled=False
scntimer2.enabled=False
currpl=currpl+1
if B2SOn then Controller.B2SSetPlayerUp currpl
if currpl>playno then
ballinplay=ballinplay+1
if ballinplay>5 then
PlaySoundAt "motorleer", Plunger
If B2SOn then Controller.B2SSetBallInPlay 0
if B2SOn then Controller.B2SSetPlayerUp 0
eg=1
if sbv1=21 then credit=credit+1: playsound "knocke": qs=qs+2: End if
if sbv2=21 then credit=credit+1: playsound "knocke": qs=qs+2: End if
credittxt.text=credit
If B2SOn Then
Controller.B2SSetCredits Credit
End if
ballreltimer.enabled=true
else
if state=true and tilt=false then
play(currpl-1).state=0
currpl=1
play(currpl).state=1
if B2SOn then Controller.B2SSetPlayerUp currpl
playsound "kickerkick"
ballreltimer.enabled=true
End if
If B2SOn then Controller.B2SSetBallInPlay ballinplay
select case (ballinplay)
case 1:
bip1.text="1"
case 2:
bip1.text=" "
bip2.text="2"
case 3:
bip2.text=" "
bip3.text="3"
case 4:
bip3.text=" "
bip4.text="4"
case 5:
bip4.text=" "
bip5.text="5"
end select
End if
End if
if currpl>1 and currpl<(playno+1) then
if state=true and tilt=false then
play(currpl-1).state=0
play(currpl).state=1
if B2SOn then Controller.B2SSetPlayerUp currpl
playsound "kickerkick"
ballreltimer.enabled=true
wheelcheck
lightcheck
End if
End if
End Sub
sub ballreltimer_timer
if eg=1 then
matchnum
bip3.text=" "
bip5.text=" "
state=false
for i=1 to 2
if truesc(i)>hisc then
hisc=truesc(i)
hisctxt.text=hisc
End if
next
pno.setvalue(0)
play(currpl-1).state=0
playno=0
gamov.text="GAME OVER"
If B2SOn Then
Controller.B2SSetGameOver 1
End if
savehs
ballreltimer.enabled=false
else
nb.CreateBall
nb.kick 90,6
ballreltimer.enabled=false
End if
End Sub
sub matchnum
select case(matchnumb)
case 0:
m0.text="0"
case 1:
m1.text="1"
case 2:
m2.text="2"
case 3:
m3.text="3"
case 4:
m4.text="4"
case 5:
m5.text="5"
case 6:
m6.text="6"
case 7:
m7.text="7"
case 8:
m8.text="8"
case 9:
m9.text="9"
end select
If B2SOn Then
if matchnumb=0 then
Controller.B2SSetMatch 10
else
Controller.B2SSetMatch matchnumb
End if
End if
for i=1 to playno
if matchnumb=(score(i) mod 10) then
credit=credit+1
If B2SOn Then
Controller.B2SSetCredits Credit
End if
qs=qs+2
playsound "knocke"
credittxt.text= credit
End if
next
End Sub
'**********Sling Shot Animations
' Rstep and Lstep are the variables that increment the animation
'****************
Dim RStep, Lstep, RStep1, LStep1
Sub RightSlingShot_Slingshot
PlaySoundAt "right_slingshot", Sling1
RSling.Visible = 0
RSling1.Visible = 1
sling1.TransZ = -20
RStep = 0
RightSlingShot.TimerEnabled = 1
If RightSlingLight.state=1 then Addscore 10 else Addscore 1
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 "left_slingshot", Sling2
LSling.Visible = 0
LSling1.Visible = 1
sling2.TransZ = -20
LStep = 0
LeftSlingShot.TimerEnabled = 1
If LeftSlingLight.state=1 then Addscore 10 else Addscore 1
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
Sub LeftSlingShot1_Slingshot
addscore 1
PlaySoundAt "left_slingshot", SLING4
LSling4.Visible = 0
LSling5.Visible = 1
sling4.TransZ = -20
LStep1 = 0
LeftSlingShot1.TimerEnabled = 1
End Sub
Sub LeftSlingShot1_Timer
Select Case LStep1
Case 3:LSLing4.Visible = 0:LSLing5.Visible = 1:sling4.TransZ = -10
Case 4:LSLing5.Visible = 0:LSLing3.Visible = 1:sling4.TransZ = 0:LeftSlingShot1.TimerEnabled = 0
End Select
LStep1 = LStep1 + 1
End Sub
' *********************************************************************
' Supporting Ball & Sound Functions
' *********************************************************************
Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
Vol = Csng(BallVel(ball) ^2 / 2000)
End Function
Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
Dim tmp
tmp = ball.x * 2 / table1.width-1
If tmp > 0 Then
Pan = Csng(tmp ^10)
Else
Pan = Csng(-((- tmp) ^10) )
End if
End Function