-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathCabaret (Williams 1968) DB HF 1.1.vbs
1502 lines (1315 loc) · 35 KB
/
Cabaret (Williams 1968) DB HF 1.1.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
'*** Cabaret ***'
Option Explicit 'Force explicit variable declaration.
Randomize
' Thalamus 2018-07-19
' Added/Updated "Positional Sound Playback Functions" and "Supporting Ball & Sound Functions"
' Thalamus 2018-08-09 : Improved directional sounds
' !! NOTE : Table not verified yet !!
' Options
' Volume devided by - lower gets higher sound
Const VolDiv = 2000 ' Lower number, louder ballrolling/collition sound
Const VolCol = 10 ' Ball collition divider ( voldiv/volcol )
' The rest of the values are multipliers
'
' .5 = lower volume
' 1.5 = higher volume
Const VolBump = 2 ' Bumpers volume.
Const VolGates = 1 ' Gates volume.
Const VolMetal = 1 ' Metals volume.
Const VolRH = 1 ' Rubber hits volume.
Const VolPo = 1 ' Rubber posts volume.
Const VolPi = 1 ' Rubber pins volume.
Const VolTarg = 1 ' Targets volume.
Const VolSpin = 1.5 ' Spinners volume.
Const VolFlip = 1 ' Flipper volume.
On Error Resume Next
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
On Error Goto 0
Const cGameName = "cabaret_1968"
dim score(4) 'Reel score
dim truesc(4) 'True reel score if overring the numer og digits
dim reel(5) 'Maximum number of scoring reels
dim state
dim credit 'Credits
dim eg 'End Game
dim currpl 'Current player status
dim playno 'Number of players
dim up(4) 'Player up
dim play(4) 'Player status
dim rst 'Reset Variable
dim bip 'Ball in play
dim ballrelenabled 'Used for shooter sound
dim match(10)
dim tilt
dim tiltsens
dim rep(4)
dim matchnumb
dim bell 'Global scoring sound variable
dim points
dim replay1
dim replay2
dim replay3
dim replay4
dim hisc 'High Score to date
dim wv 'Wheel Value (positiion)
dim wn 'Wheel Change animation steps
dim sbv 'Super Bonus value
dim i 'Indexing variable
dim scn 'Single points score timer
dim scn1 'Single points end score timer
dim scn2 'Multiple points score timer
dim scn3 'Multiple points end score timer
dim obj
dim bgl1,bgl2,bgl3,bgl4
ExecuteGlobal GetTextFile("core.vbs")
Sub Timer1_timer
if B2SOn then
if bgl1=0 Then
Controller.B2SSetData 10,1
bgl1=1
Else
Controller.B2SSetData 10,0
bgl1=0
end If
end If
end Sub
Sub Timer2_timer
if B2SOn then
if bgl2=0 Then
Controller.B2SSetData 11,1
bgl2=1
Else
Controller.B2SSetData 11,0
bgl2=0
end If
end If
end Sub
Sub Timer3_timer
if B2SOn then
if bgl3=0 Then
Controller.B2SSetData 12,1
bgl3=1
Else
Controller.B2SSetData 12,0
bgl3=0
end If
end If
end Sub
Sub Timer4_timer
if B2SOn then
if bgl4=0 Then
Controller.B2SSetData 13,1
bgl4=1
Else
Controller.B2SSetData 13,0
bgl4=0
end If
end If
end Sub
Sub Table1_Init
LoadEM
If ShowDT=false Then
for each obj in DesktopItems
obj.visible=False
Next
end If
bgl1=0
bgl2=0
bgl3=0
bgl4=0
set play(1)=up1
set play(2)=up2
set play(3)=up3
set play(4)=up4
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
set reel(5)=reel5
replay1=6500
replay2=9800
replay3=16500
replay4=19800
loadhs
if hisc="" then hisc=1000
reel5.setvalue(hisc)
if wv="" then wv=0
for i=0 to 19
wheel(i).isdropped=True
next
wheel(wv).isdropped=false
if credit="" then
credit=0
Else
DOF 130, DOFOn
End If
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 4
currpl=i
reel(i).setvalue(score(i))
sbreel.setvalue(sbv)
next
currpl=0
If B2SOn Then
timer1.enabled=True
timer2.enabled=True
timer3.enabled=True
timer4.enabled=True
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.B2SSetShootAgain 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
If B2SOn then Controller.B2SSetScorePlayer5 sbv
End Sub
Sub Table1_KeyDown(ByVal keycode)
If keycode = PlungerKey Then
Plunger.PullBack
End If
if keycode = 6 then
playsoundAtVol "coin3", drain, 1
coindelay.enabled=true
If B2SOn Then
Controller.B2SSetCredits Credit
end if
end if
if keycode = 5 then
playsoundAtVol "coin3", drain, 1
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
If credit < 1 Then DOF 130, DOFOff
credittxt.text=credit
eg=0
playno=1
playno1.state=1
currpl=1
play(currpl).state=1
playsound "click"
playsound "initialize"
rst=0
bip=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,1
Controller.B2SSetData 82,0
Controller.B2SSetData 83,0
Controller.B2SSetData 84,0
Controller.B2SSetScoreRolloverPlayer1 0
End If
end if
if keycode = 2 and credit>0 and state=true and playno>0 and playno<4 and bip<2 then
credit=credit-1
If credit < 1 Then DOF 130, DOFOff
credittxt.text=credit
playno=playno+1
if playno=2 then playno2.state=1
if playno=3 then playno3.state=1
if playno=4 then playno4.state=1
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
PlaySoundAtVol SoundFXDOF("FlipperUp",101,DOFOn,DOFFlippers), LeftFlipper, VolFlip
End If
If keycode = RightFlipperKey Then
RightFlipper.RotateToEnd
PlaySoundAtVol SoundFXDOF("FlipperUp",102,DOFOn,DOFFlippers), RightFlipper, VolFlip
End If
If keycode = LeftTiltKey Then
Nudge 90, 2
checktilt
End If
If keycode = RightTiltKey Then
Nudge 270, 2
checktilt
End If
If keycode = CenterTiltKey Then
Nudge 0, 2
checktilt
End If
If keycode = MechanicalTilt Then
Tilt=1
mechchecktilt
End If
end if
End Sub
Sub Table1_KeyUp(ByVal keycode)
If keycode = PlungerKey Then
Plunger.Fire
End If
If keycode = LeftFlipperKey Then
LeftFlipper.RotateToStart
stopsound "buzz"
if state=true and tilt=false then PlaySoundAtVol SoundFXDOF("FlipperDown",101,DOFOff,DOFFlippers), LeftFlipper, VolFlip
End If
If keycode = RightFlipperKey Then
RightFlipper.RotateToStart
stopsound "buzz"
if state=true and tilt=false then PlaySoundAtVol SoundFXDOF("FlipperDown",102,DOFOff,DOFFlippers), RightFlipper, VolFlip
End If
End Sub
sub flippertimer_timer()
LFlip.RotY = LeftFlipper.CurrentAngle+90
RFlip.RotY = RightFlipper.CurrentAngle+90
end sub
sub newgame
state=true
eg=0
sbv=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
wheelcheck
bip=1
nb.CreateBall
nb.kick 90,6
DOF 126, DOFPulse
If B2SOn then Controller.B2SSetBallInPlay 1
end sub
sub resettimer_timer
rst=rst+1
reel1.resettozero
reel2.resettozero
reel3.resettozero
reel4.resettozero
sbreel.resettozero
If B2SOn Then
Controller.B2SSetScorePlayer1 0
Controller.B2SSetScorePlayer2 0
Controller.B2SSetScorePlayer3 0
Controller.B2SSetScorePlayer4 0
Controller.B2SSetScorePlayer5 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
DOF 130, DOFOn
credittxt.text=credit
coindelay.enabled=false
If B2SOn Then
Controller.B2SSetCredits Credit
end if
end sub
sub coindelay1_timer
playsound "click"
credit=credit+1
DOF 130, DOFOn
credittxt.text=credit
coindelay1.enabled=false
If B2SOn Then
Controller.B2SSetCredits Credit
end if
end sub
'*** General points scoring ***
sub addscore(points)
if tilt=false then bell=0
if points=10 then matchnumb=matchnumb+1
if matchnumb=10 then matchnumb=0
if points = 1 or points = 10 or points = 100 then scn=1
if points = 300 then scn2=3
if points = 100 then
reel(currpl).addvalue(100)
bell=100
scn1=1
end if
if points = 10 then
reel(currpl).addvalue(10)
bell=10
scn1=1
end if
if points = 1 then
reel(currpl).addvalue(1)
bell=1
scn1=1
end if
if points = 300 then
reel(currpl).addvalue(300)
playsound "motorshort1s"
scn3=3
bell=100
end if
if points = 1 or points = 10 or points = 100 then scn1=0 : scntimer.enabled=true : end if
if points = 300 then scn3=0 : scntimer1.enabled=true : end if
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
DOF 130, DOFOn
playsound SoundFXDOF("knocke",129,DOFPulse,DOFKnocker)
DOF 128, DOFPulse
credittxt.text=credit
rep(currpl)=1
playsound "click"
end if
if score(currpl)=>replay2 and rep(currpl)=1 then
credit=credit+1
DOF 130, DOFOn
playsound SoundFXDOF("knocke",129,DOFPulse,DOFKnocker)
DOF 128, DOFPulse
credittxt.text=credit
rep(currpl)=2
playsound "click"
If B2SOn Then
Controller.B2SSetCredits Credit
end if
end if
if score(currpl)=>replay3 and rep(currpl)=2 then
credit=credit+1
DOF 130, DOFOn
playsound SoundFXDOF("knocke",129,DOFPulse,DOFKnocker)
DOF 128, DOFPulse
credittxt.text=credit
rep(currpl)=3
playsound "click"
If B2SOn Then
Controller.B2SSetCredits Credit
end if
end If
if score(currpl)=>replay4 and rep(currpl)=3 then
credit=credit+1
DOF 130, DOFOn
playsound SoundFXDOF("knocke",129,DOFPulse,DOFKnocker)
DOF 128, DOFPulse
credittxt.text=credit
rep(currpl)=4
playsound "click"
If B2SOn Then
Controller.B2SSetCredits Credit
end if
end if
end sub
' TODO
sub scntimer_timer
scn1=scn1 + 1
if bell=100 then playsound SoundFXDOF("bell100",143,DOFPulse,DOFChimes),0, 0.45, 0, 0
if bell=10 then playsound SoundFXDOF("bell10",142,DOFPulse,DOFChimes),0, 0.3, 0, 0
if bell=1 then playsound SoundFXDOF("bell1",141,DOFPulse,DOFChimes),0, 0.15, 0, 0
if scn1=scn then scntimer.enabled=false
end sub
sub scntimer1_timer
scn3=scn3 + 1
if bell=100 then playsound SoundFXDOF("bell1",143,DOFPulse,DOFChimes),0, 0.45, 0, 0
if bell=10 then playsound SoundFXDOF("bell10",142,DOFPulse,DOFChimes),0, 0.3, 0, 0
if bell=1 then playsound SoundFXDOF("bell1",141,DOFPulse,DOFChimes),0, 0.15, 0, 0
if scn3=scn2 then scntimer1.enabled=false
end sub
'*** Ball handling ***
sub ballhome_hit
ballrelenabled=1
sbv=0
sbreel.resettozero
If B2SOn Then
Controller.B2SSetScorePlayer5 0
Controller.B2SSetShootAgain 0
end if
Light3.State=0
end sub
sub ballhome_unhit
DOF 132, DOFPulse
end sub
sub ballrelease_hit
if ballrelenabled=1 then playsoundAtVol "launchball", ballrelease, 1: ballrelenabled=0: end if
end sub
Sub Drain_Hit()
DOF 131, DOFPulse
playsoundAtVol "drainshorter", drain, 1
Drain.DestroyBall
nextball
End Sub
sub nextball
if tilt=true then
tilt=false
tilttext.text=" "
If B2SOn Then Controller.B2SSetTilt 0:Controller.B2SSetShootAgain 0
tiltseq.stopplay
end if
if (Light3.state)=1 then
playsoundAtVol "kickerkick", plunger, 1
ballreltimer.enabled=true
else
currpl=currpl+1
If B2SOn Then
Controller.B2SSetData 81,0
Controller.B2SSetData 82,0
Controller.B2SSetData 83,0
Controller.B2SSetData 84,0
Controller.B2SSetData (80+currpl),1
end If
end if
if currpl>playno then
bip=bip+1
if bip>5 then
playsoundAtVol "motorleer", drain, 1
If B2SOn then Controller.B2SSetBallInPlay 0
eg=1
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.B2SSetData 81,0
Controller.B2SSetData 82,0
Controller.B2SSetData 83,0
Controller.B2SSetData 84,0
Controller.B2SSetData (80+currpl),1
end If
playsound "kickerkick"
ballreltimer.enabled=true
end if
If B2SOn then Controller.B2SSetBallInPlay bip
select case (bip)
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.B2SSetData 81,0
Controller.B2SSetData 82,0
Controller.B2SSetData 83,0
Controller.B2SSetData 84,0
Controller.B2SSetData (80+currpl),1
end If
playsound "kickerkick"
ballreltimer.enabled=true
end if
end if
end Sub
sub ballreltimer_timer
if eg=1 then
matchnum
bip3.text=" "
bip5.text=" "
state=false
for i=1 to 4
if truesc(i)>hisc then
hisc=truesc(i)
reel5.setvalue(hisc)
end if
next
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
DOF 130, DOFOn
If B2SOn Then
Controller.B2SSetCredits Credit
end if
playsound SoundFXDOF("knocke",129,DOFPulse,DOFKnocker)
DOF 128, DOFPulse
credittxt.text= credit
playsound "click"
end if
next
end sub
Sub CheckTilt
If Tilttimer.Enabled = True Then
TiltSens = TiltSens + 1
if TiltSens = 3 Then
Tilt = True
tilttext.text="TILT"
If B2SOn Then Controller.B2SSetTilt 1
post.isdropped=true
tiltsens = 0
playsound "tilt"
turnoff
End If
Else
TiltSens = 0
Tilttimer.Enabled = True
End If
End Sub
Sub MechCheckTilt
Tilt = True
LeftFlipper.RotateToStart
RightFlipper.RotateToStart
tilttext.text="TILT"
If B2SOn Then Controller.B2SSetTilt 1
post.isdropped=true
tiltsens = 0
playsound "tilt"
turnoff
End Sub
Sub Tilttimer_Timer()
Tilttimer.Enabled = False
End Sub
sub turnoff
if (post.isdropped)=false then playsound "postdown"
post.isdropped=true
tiltseq.play seqalloff
end sub
Sub Gate_hit()
PlaysoundAtVol "gate", gate, 1
End Sub
'**********Sling Shot Animations
' Rstep and Lstep are the variables that increment the animation
'****************
Dim RStep, Lstep
Sub RightSlingShot_Slingshot
if tilt = false then
PlaySoundAtVol SoundFXDOF("right_slingshot",105,DOFPulse,DOFContactors), sling1, 1
DOF 106, DOFPulse
RSling.Visible = 0
RSling1.Visible = 1
sling1.TransZ = -20
RStep = 0
RightSlingShot.TimerEnabled = 1
addscore 1
end if
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
if tilt=false then
PlaySoundAtVol SoundFXDOF("left_slingshot",103,DOFPulse,DOFContactors), sling2, 1
DOF 104, DOFPulse
LSling.Visible = 0
LSling1.Visible = 1
sling2.TransZ = -20
LStep = 0
LeftSlingShot.TimerEnabled = 1
addscore 1
end if
End Sub
Sub LeftSlingShot5_Slingshot
if tilt=false then
PlaySoundAtVol "left_slingshot", sling2, 1
LSling.Visible = 0
LSling1.Visible = 1
sling2.TransZ = -20
LStep = 0
LeftSlingShot.TimerEnabled = 1
addscore 1
end if
End Sub
' Thal - this doesn't make any sense - does it ?
Sub RightSlingShot5_Slingshot
if tilt=false then
PlaySoundAtVol "left_slingshot", sling2, 1
LSling.Visible = 0
LSling1.Visible = 1
sling2.TransZ = -20
LStep = 0
LeftSlingShot.TimerEnabled = 1
addscore 1
end if
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
'************************************
' What you need to add to your table
'************************************
' a timer called RollingTimer. With a fast interval, like 10
' one collision sound, in this script is called fx_collide
' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
'******************************************
' Explanation of the rolling sound routine
'******************************************
' sounds are played based on the ball speed and position
' the routine checks first for deleted balls and stops the rolling sound.
' The For loop goes through all the balls on the table and checks for the ball speed and
' if the ball is on the table (height lower than 30) then then it plays the sound
' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
' will change according to the ball speed, and the PAN function will change the stereo position according
' to the position of the ball on the table.
'**************************************
' Explanation of the collision routine
'**************************************
' The collision is built in VP.
' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
' depending of the speed of the collision.
Sub a_Pins_Hit (idx)
PlaySound "pinhit_low", 0, Vol(ActiveBall)*VolPi, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub a_Targets_Hit (idx)
PlaySound "target", 0, Vol(ActiveBall)*VolTarg, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
End Sub
Sub a_Metals_Thin_Hit (idx)
PlaySound "metalhit_thin", 0, Vol(ActiveBall)*VolMetal, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub a_Metals_Medium_Hit (idx)
PlaySound "metalhit_medium", 0, Vol(ActiveBall)*VolMetal, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub a_Metals2_Hit (idx)
PlaySound "metalhit2", 0, Vol(ActiveBall)*VolMetal, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub a_Gates_Hit (idx)
PlaySound "gate4", 0, Vol(ActiveBall)*VolGates, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Sub
Sub Spinner_Spin
PlaySoundAtVol "fx_spinner", Spinner, VolSpin
End Sub
Sub a_Rubbers_Hit(idx)
dim finalspeed
finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 20 then
PlaySound "fx_rubber2", 0, Vol(ActiveBall)*VolRH, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End if
If finalspeed >= 6 AND finalspeed <= 20 then
RandomSoundRubber()
End If
End Sub
Sub RubberWheel_hit
dim finalspeed
finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 20 then
PlaySound "fx_rubber2", 0, Vol(ActiveBall)*VolRH, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End if
If finalspeed >= 6 AND finalspeed <= 20 then
RandomSoundRubber()
End If
End sub
Sub a_Posts_Hit(idx)
dim finalspeed
finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
If finalspeed > 16 then
PlaySound "fx_rubber2", 0, Vol(ActiveBall)*VolPo, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End if
If finalspeed >= 6 AND finalspeed <= 16 then
RandomSoundRubber()
End If
End Sub
Sub RandomSoundRubber()
Select Case Int(Rnd*3)+1
Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall)*VolRH, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall)*VolRH, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall)*VolRH, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Select
End Sub
Sub LeftFlipper_Collide(parm)
RandomSoundFlipper()
End Sub
Sub RightFlipper_Collide(parm)
RandomSoundFlipper()
End Sub
Sub RandomSoundFlipper()
Select Case Int(Rnd*3)+1
Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall)*VolRH, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall)*VolRH, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall)*VolRH, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
End Select
End Sub
'*** Table specific scores and rules handling ***
sub bumper1_hit
if tilt=false then
playsoundAtVol SoundFXDOF("jet1",111,DOFPulse,DOFContactors), Bumper1, VolBump
DOF 112, DOFPulse
if Light14.state=1 then addscore 100 else addscore 10
end if
end sub
sub bumper2_hit
if tilt=false then
playsoundAtVol SoundFXDOF("jet1",107,DOFPulse,DOFContactors), Bumper2, VolBump
DOF 108, DOFPulse
if Light11.state=1 then addscore 10 else addscore 1
end if
end sub
sub bumper3_hit
if tilt=false then
playsoundAtVol SoundFXDOF("jet1",113,DOFPulse,DOFContactors), Bumper3, VolBump
DOF 114, DOFPulse
if Light15.state=1 then addscore 10 else addscore 1