Advertisement
Guest User

High Speed (before) - script by 32assassin

a guest
Sep 7th, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 26.62 KB | None | 0 0
  1. Option Explicit
  2. Randomize
  3.  
  4. On Error Resume Next
  5. ExecuteGlobal GetTextFile("controller.vbs")
  6. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  7. On Error Goto 0
  8.  
  9. Const cGameName="hs_l4",UseSolenoids=1,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
  10.  
  11. LoadVPM "01500000", "S11.VBS", 3.10
  12. Dim DesktopMode: DesktopMode = Table1.ShowDT
  13.  
  14. If DesktopMode = True Then 'Show Desktop components
  15. Ramp16.visible=1
  16. Ramp15.visible=1
  17. Primitive13.visible=1
  18. Else
  19. Ramp16.visible=0
  20. Ramp15.visible=0
  21. Primitive13.visible=0
  22. End if
  23.  
  24. '*************************************************************
  25. 'Solenoid Call backs
  26. '**********************************************************************************************************
  27. SolCallback(1)      = "bsTrough.SolIn"
  28. SolCallback(2)      = "bstrough.SolOut"
  29. SolCallback(3)      = "bsSaucer.SolOut"
  30. SolCallback(5)      = "SetLamp 105," 'PF Light
  31. SolCallback(6)      = "SetLamp 106," 'PF Light
  32. SolCallback(7)      = "bsLeftLock.SolOut"           ' Left Hideout Eject
  33. SolCallback(8)      = "bsRightLock.SolOut"          ' Right Hideout Eject
  34. SolCallBack(9)      = "SetLamp 109," 'X2 Left Dome Flasher
  35. SolCallback(11)     = "PFGI" 'General Illumination Relay
  36. SolCallBack(12)     = "SetLamp 112," 'X2 Right Dome Flasher
  37. SolCallback(13)     = "Divert"
  38. SolCallback(14)     = "SolKickback"
  39. SolCallback(15)=  "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  40.  
  41. SolCallback(sLRFlipper) = "SolRFlipper"
  42. SolCallback(sLLFlipper) = "SolLFlipper"
  43.  
  44. Sub SolLFlipper(Enabled)
  45.      If Enabled Then
  46.          PlaySound SoundFX("fx_Flipperup",DOFContactors):LeftFlipper.RotateToEnd
  47.      Else
  48.          PlaySound SoundFX("fx_Flipperdown",DOFContactors):LeftFlipper.RotateToStart
  49.      End If
  50.   End Sub
  51.  
  52. Sub SolRFlipper(Enabled)
  53.      If Enabled Then
  54.          PlaySound SoundFX("fx_Flipperup",DOFContactors):RightFlipper.RotateToEnd:RightFlipper1.RotateToEnd
  55.      Else
  56.          PlaySound SoundFX("fx_Flipperdown",DOFContactors):RightFlipper.RotateToStart:RightFlipper1.RotateToStart
  57.      End If
  58. End Sub
  59.  
  60. '**********************************************************************************************************
  61.  
  62. 'Solenoid Controlled toys
  63. '**********************************************************************************************************
  64.  
  65. Sub SolKickBack(enabled)
  66.     If enabled Then
  67.        Plunger1.Fire
  68.        PlaySound SoundFX("Popper",DOFContactors)
  69.     Else
  70.        Plunger1.PullBack
  71.     End If
  72. End Sub
  73.  
  74. Sub Divert(enabled)
  75.     If Enabled Then
  76.         Diverter1.IsDropped = 0  
  77.         Diverter2.IsDropped = 0
  78.         PrimFlipper1.transz = -90
  79.         PrimFlipper2.transz = -90
  80.         PlaySound SoundFX("popper_ball",DOFContactors)
  81.     Else
  82.         Diverter1.IsDropped = 1
  83.         Diverter2.IsDropped = 1
  84.         PrimFlipper1.transz = 0
  85.         PrimFlipper2.transz = 0
  86.         PlaySound SoundFX("popper_ball",DOFContactors)
  87.     End If
  88. End Sub
  89.  
  90. 'Playfield GI
  91. Sub PFGI(Enabled)
  92.     If Enabled Then
  93.         dim xx
  94.         For each xx in GI:xx.State = 0: Next
  95.         PlaySound "fx_relay"
  96.     Else
  97.         For each xx in GI:xx.State = 1: Next
  98.         PlaySound "fx_relay"
  99.     End If
  100. End Sub
  101.  
  102. '**********************************************************************************************************
  103.  
  104. 'Initiate Table
  105. '**********************************************************************************************************
  106.  
  107. Dim bsTrough, bsSaucer, bsLeftLock, bsRightLock, SubSpeed
  108.  
  109. Sub Table1_Init
  110.     vpmInit Me
  111.     On Error Resume Next
  112.         With Controller
  113.         .GameName = cGameName
  114.         If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  115.         .SplashInfoLine = "High Speed (Williams)"&chr(13)&"You Suck"
  116.         .HandleMechanics=0
  117.         .HandleKeyboard=0
  118.         .ShowDMDOnly=1
  119.         .ShowFrame=0
  120.         .ShowTitle=0
  121.         .hidden = 1
  122.          On Error Resume Next
  123.          .Run GetPlayerHWnd
  124.          If Err Then MsgBox Err.Description
  125.          On Error Goto 0
  126.      End With
  127.      On Error Goto 0
  128.  
  129.     PinMAMETimer.Interval=PinMAMEInterval  
  130.     PinMAMETimer.Enabled=1
  131.  
  132.     vpmNudge.TiltSwitch=1
  133.     vpmNudge.Sensitivity=3
  134.     vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
  135.    
  136.     Set bsTrough=New cvpmBallStack
  137.         bsTrough.InitSw 9,12,11,10,0,0,0,0
  138.         bsTrough.InitKick BallRelease,90,10
  139.         bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  140.         bsTrough.Balls=3
  141.  
  142.     Set bsSaucer = New cvpmBallStack
  143.         bsSaucer.InitSaucer sw16,16,96,5
  144.         bsSaucer.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  145.  
  146.     Set bsLeftLock = New cvpmBallStack
  147.         bsLeftLock.InitSw 0,0,39,0,0,0,0,0
  148.         bsLeftLock.InitSaucer LKick,40, 0,15
  149.         bsLeftLock.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  150.  
  151.     Set bsRightLock = New cvpmBallStack
  152.         bsRightLock.InitSw 0,0,47,0,0,0,0,0
  153.         bsRightLock.InitSaucer RKick,48,0,15
  154.         bsRightLock.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  155.  
  156.     Plunger1.Pullback
  157.     Diverter1.IsDropped = 1
  158.     Diverter2.IsDropped = 1
  159.  
  160.  End Sub
  161.  
  162. '**********************************************************************************************************
  163. 'Plunger code
  164. '**********************************************************************************************************
  165.  
  166. Sub Table1_KeyDown(ByVal KeyCode)
  167.     If KeyDownHandler(keycode) Then Exit Sub
  168.     If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  169. End Sub
  170.  
  171. Sub Table1_KeyUp(ByVal KeyCode)
  172.     If KeyUpHandler(keycode) Then Exit Sub
  173.     If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  174. End Sub
  175.  
  176. '**********************************************************************************************************
  177.  
  178.  ' Drain hole and kickers
  179. Sub Drain_Hit:bsTrough.addball me : playsound"drain" : End Sub
  180. Sub sw16_Hit:bsSaucer.addball 0 : playsound"popper_ball" : End Sub
  181. Sub LKick_Hit:bsLeftLock.AddBall 0 : playsound"Target" : End Sub
  182. Sub RKick_Hit:bsRightLock.AddBall 0 : playsound"Target" : End Sub
  183.  
  184. 'fake 180 turn wire Ramp
  185. Sub kicker1_Hit
  186.     SubSpeed=ABS(ActiveBall.VelY)
  187.     kicker1.DestroyBall
  188.     kicker2.CreateBall
  189.     kicker2.Kick 180,SQR(SubSpeed)
  190. End Sub
  191.  
  192. Sub kicker3_Hit
  193.     SubSpeed=ABS(ActiveBall.VelY)
  194.     kicker3.DestroyBall
  195.     kicker4.CreateBall
  196.     kicker4.Kick 180,SQR(SubSpeed)
  197. End Sub
  198.  
  199. 'Wire Triggers
  200. Sub SW20_Hit : Controller.Switch(20)=1 : playsound"rollover" : End Sub
  201. Sub SW20_unHit : Controller.Switch(20)=0:End Sub
  202. Sub SW21_Hit : Controller.Switch(21)=1 : playsound"rollover" : End Sub
  203. Sub SW21_unHit : Controller.Switch(21)=0:End Sub
  204. Sub SW31_Hit : Controller.Switch(31)=1 : playsound"rollover" : End Sub
  205. Sub SW31_unHit : Controller.Switch(31)=0 : End Sub
  206. Sub SW32_Hit : Controller.Switch(32)=1 : playsound"rollover" : End Sub
  207. Sub SW32_unHit : Controller.Switch(32)=0:End Sub
  208. Sub SW36_Hit : Controller.Switch(36)=1 : playsound"rollover" : End Sub
  209. Sub SW36_unHit : Controller.Switch(36)=0:End Sub
  210.  
  211. 'Stand Up Targets
  212. Sub sw13_Hit:vpmTimer.PulseSw 13 : End Sub
  213. Sub sw14_Hit:vpmTimer.PulseSw 14 : End Sub
  214. Sub sw15_Hit:vpmTimer.PulseSw 15 : End Sub
  215. Sub sw17_Hit:vpmTimer.PulseSw 17 : End Sub
  216. Sub sw18_Hit:vpmTimer.PulseSw 18 : End Sub
  217. Sub sw19_Hit:vpmTimer.PulseSw 19 : End Sub
  218. Sub sw22_Hit:vpmTimer.PulseSw 22 : End Sub
  219. Sub sw23_Hit:vpmTimer.PulseSw 23 : End Sub
  220. Sub sw24_Hit:vpmTimer.PulseSw 24 : End Sub
  221. Sub sw25_Hit:vpmTimer.PulseSw 25 : End Sub
  222. Sub sw26_Hit:vpmTimer.PulseSw 26 : End Sub
  223. Sub sw27_Hit:vpmTimer.PulseSw 27 : End Sub
  224. Sub sw28_Hit:vpmTimer.PulseSw 28 : End Sub
  225. Sub sw29_Hit:vpmTimer.PulseSw 29 : End Sub
  226. Sub sw30_Hit:vpmTimer.PulseSw 30 : End Sub
  227.  
  228. 'Bumpers
  229. Sub Bumper1_Hit:vpmTimer.PulseSw 33 : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  230. Sub Bumper2_Hit:vpmTimer.PulseSw 34 : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  231. Sub Bumper3_Hit:vpmTimer.PulseSw 35 : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  232.  
  233. 'Ramp Triggers
  234. Sub SW42_Hit:Controller.Switch(42)=1:End Sub
  235. Sub SW42_unHit:Controller.Switch(42)=0:End Sub
  236. Sub SW43_Hit:Controller.Switch(43)=1:End Sub
  237. Sub SW43_unHit:Controller.Switch(43)=0:End Sub
  238.  
  239. 'Spinner
  240. Sub sw44_Spin:vpmTimer.PulseSw 44 : playsound"fx_spinner" : End Sub
  241. Sub sw45_Spin:vpmTimer.PulseSw 45 : playsound"fx_spinner" : End Sub
  242. Sub sw46_Spin:vpmTimer.PulseSw 46 : playsound"fx_spinner" : End Sub
  243.  
  244. 'Star Triggers
  245. Sub SW51_Hit:Controller.Switch(51)=1 : playsound"rollover" : End Sub
  246. Sub SW51_unHit:Controller.Switch(51)=0:End Sub
  247. Sub SW52_Hit:Controller.Switch(52)=1 : playsound"rollover" : End Sub
  248. Sub SW52_unHit:Controller.Switch(52)=0:End Sub
  249.  
  250. 'Generic Ramp Sounds
  251. Sub Trigger1_Hit : playsound"Wire Ramp" : End Sub
  252. Sub Trigger2_Hit : playsound"Wire Ramp" : End Sub
  253. Sub Trigger3_Hit : playsound"Wire Ramp" : End Sub
  254. Sub Trigger4_Hit : playsound"Wire Ramp" : End Sub
  255.  
  256. Sub Trigger5_Hit : playsound"Ball Drop" : End Sub
  257. Sub Trigger6_Hit : playsound"Ball Drop" : End Sub
  258. Sub Trigger7_Hit : playsound"Ball Drop" : End Sub
  259. Sub Trigger8_Hit : playsound"Ball Drop" : End Sub
  260. Sub Trigger9_Hit : playsound"Ball Drop" : End Sub
  261.  
  262.  
  263.  '***************************************************
  264. '       JP's VP10 Fading Lamps & Flashers
  265. '       Based on PD's Fading Light System
  266. ' SetLamp 0 is Off
  267. ' SetLamp 1 is On
  268. ' fading for non opacity objects is 4 steps
  269. '***************************************************
  270.  
  271. Dim LampState(200), FadingLevel(200)
  272. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  273.  
  274. InitLamps()             ' turn off the lights and flashers and reset them to the default parameters
  275. LampTimer.Interval = 5 'lamp fading speed
  276. LampTimer.Enabled = 1
  277.  
  278. ' Lamp & Flasher Timers
  279.  
  280. Sub LampTimer_Timer()
  281.     Dim chgLamp, num, chg, ii
  282.     chgLamp = Controller.ChangedLamps
  283.     If Not IsEmpty(chgLamp) Then
  284.         For ii = 0 To UBound(chgLamp)
  285.             LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1)       'keep the real state in an array
  286.            FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  287.        Next
  288.     End If
  289.     UpdateLamps
  290. End Sub
  291.  
  292.  Sub UpdateLamps
  293.   'check to make sure that the kickback is disabled and didn't get re-enabled after a kick - from PacDude!
  294.    
  295. If DesktopMode = True Then
  296.     FadeReel 1 ,L1 'GameOver
  297.     FadeReel 2, L2 'Match Game
  298. end if
  299.  
  300.     NFadeLm 3, l3
  301.  
  302. If DesktopMode = True Then
  303.     FadeReel 3, L3a 'Shoot Again
  304. end if
  305.  
  306.     NFadeL 4, l4
  307.     NFadeL 5, l5
  308.  
  309. If DesktopMode = True Then
  310.     FadeReel 6, L6 'Ball In Play
  311. end if
  312.  
  313.     NFadeL 7, L7
  314.     NFadeL 8, L8
  315.     NFadeL 9, l9
  316.     NFadeL 10, l10
  317.     NFadeL 11, l11
  318.     NFadeL 12, l12
  319.     NFadeL 13, l13
  320.     NFadeL 14, l14
  321.     NFadeL 15, l15
  322.     NFadeL 16, l16
  323.     NFadeL 17, l17
  324.     NFadeL 18, l18
  325.     NFadeL 19, l19
  326.     NFadeL 20, l20
  327.     NFadeL 21, l21
  328.     NFadeL 22, l22
  329.     NFadeL 23, l23
  330.     NFadeL 24, l24
  331.     NFadeL 25, l25
  332.     NFadeL 26, l26
  333.     NFadeL 27, l27
  334.     NFadeL 28, l28
  335.     NFadeL 29, l29
  336.     NFadeL 30, l30
  337.     NFadeL 31, l31
  338.     NFadeL 32, l32
  339.     NFadeL 33, l33
  340.     NFadeL 34, l34
  341.     NFadeL 35, l35
  342.     NFadeL 36, l36
  343.     NFadeL 37, l37
  344.     NFadeL 38, l38
  345.     NFadeL 39, l39
  346.     NFadeL 40, l40
  347.     NFadeL 41, l41    
  348.     NFadeObjm 42, l42, "bulbcover1_redOn", "bulbcover1_red"
  349.     Flash 42, F42 'Ramp Traffic Light
  350.     NFadeObjm 43, l43, "bulbcover1_yellowOn", "bulbcover1_yellow"
  351.     Flash 43, F43 'Ramp Traffic Light
  352.     NFadeObjm 44, l44, "bulbcover1_greenOn", "bulbcover1_green"
  353.     Flash 44, F44 'Ramp Traffic Light
  354.     NFadeL 45, l45
  355.     NFadeL 46, l46
  356.     NFadeL 47, l47
  357.     NFadeL 48, l48
  358.     NFadeL 49, l49
  359.     NFadeL 50, l50
  360.     NFadeL 51, l51
  361.     NFadeL 52, l52
  362.     NFadeL 53, l53
  363.     NFadeL 54, l54
  364.     NFadeL 55, l55
  365.     NFadeL 56, l56
  366.     NFadeL 57, l57
  367.     NFadeL 58, l58
  368.     NFadeL 59, l59
  369.     NFadeL 60, l60
  370.     NFadeL 61, l61
  371.     NFadeL 62, l62
  372.     NFadeL 63, l63
  373.     NFadeL 64, l64
  374.  
  375.  'Solenoid Controlled Flashers
  376.   NFadeL 105, F105
  377.  
  378.    NFadeL 106, F106
  379.  
  380.    NFadeLm 109, F109
  381.    NFadeLm 109, F109a
  382.    NFadeLm 109, F109b
  383.    NFadeL 109, F109c
  384.  
  385.    NFadeLm 112, F112
  386.    NFadeLm 112, F112a
  387.    NFadeLm 112, F112b
  388.    NFadeL 112, F112c
  389.  
  390. End Sub
  391.  
  392. ' div lamp subs
  393.  
  394. Sub InitLamps()
  395.     Dim x
  396.     For x = 0 to 200
  397.         LampState(x) = 0        ' current light state, independent of the fading level. 0 is off and 1 is on
  398.        FadingLevel(x) = 4      ' used to track the fading state
  399.        FlashSpeedUp(x) = 0.4   ' faster speed when turning on the flasher
  400.        FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  401.        FlashMax(x) = 1         ' the maximum value when on, usually 1
  402.        FlashMin(x) = 0         ' the minimum value when off, usually 0
  403.        FlashLevel(x) = 0       ' the intensity of the flashers, usually from 0 to 1
  404.    Next
  405. End Sub
  406.  
  407. Sub AllLampsOff
  408.     Dim x
  409.     For x = 0 to 200
  410.         SetLamp x, 0
  411.     Next
  412. End Sub
  413.  
  414. Sub SetLamp(nr, value)
  415.     If value <> LampState(nr) Then
  416.         LampState(nr) = abs(value)
  417.         FadingLevel(nr) = abs(value) + 4
  418.     End If
  419. End Sub
  420.  
  421. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  422.  
  423. Sub NFadeL(nr, object)
  424.     Select Case FadingLevel(nr)
  425.         Case 4:object.state = 0:FadingLevel(nr) = 0
  426.         Case 5:object.state = 1:FadingLevel(nr) = 1
  427.     End Select
  428. End Sub
  429.  
  430. Sub NFadeLm(nr, object) ' used for multiple lights
  431.    Select Case FadingLevel(nr)
  432.         Case 4:object.state = 0
  433.         Case 5:object.state = 1
  434.     End Select
  435. End Sub
  436.  
  437. 'Lights, Ramps & Primitives used as 4 step fading lights
  438. 'a,b,c,d are the images used from on to off
  439.  
  440. Sub FadeObj(nr, object, a, b, c, d)
  441.     Select Case FadingLevel(nr)
  442.         Case 4:object.image = b:FadingLevel(nr) = 6                   'fading to off...
  443.        Case 5:object.image = a:FadingLevel(nr) = 1                   'ON
  444.        Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1             'wait
  445.        Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  446.        Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1         'wait
  447.        Case 13:object.image = d:FadingLevel(nr) = 0                  'Off
  448.    End Select
  449. End Sub
  450.  
  451. Sub FadeObjm(nr, object, a, b, c, d)
  452.     Select Case FadingLevel(nr)
  453.         Case 4:object.image = b
  454.         Case 5:object.image = a
  455.         Case 9:object.image = c
  456.         Case 13:object.image = d
  457.     End Select
  458. End Sub
  459.  
  460. Sub NFadeObj(nr, object, a, b)
  461.     Select Case FadingLevel(nr)
  462.         Case 4:object.image = b:FadingLevel(nr) = 0 'off
  463.        Case 5:object.image = a:FadingLevel(nr) = 1 'on
  464.    End Select
  465. End Sub
  466.  
  467. Sub NFadeObjm(nr, object, a, b)
  468.     Select Case FadingLevel(nr)
  469.         Case 4:object.image = b
  470.         Case 5:object.image = a
  471.     End Select
  472. End Sub
  473.  
  474. ' Flasher objects
  475.  
  476. Sub Flash(nr, object)
  477.     Select Case FadingLevel(nr)
  478.         Case 4 'off
  479.            FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  480.             If FlashLevel(nr) < FlashMin(nr) Then
  481.                 FlashLevel(nr) = FlashMin(nr)
  482.                 FadingLevel(nr) = 0 'completely off
  483.            End if
  484.             Object.IntensityScale = FlashLevel(nr)
  485.         Case 5 ' on
  486.            FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  487.             If FlashLevel(nr) > FlashMax(nr) Then
  488.                 FlashLevel(nr) = FlashMax(nr)
  489.                 FadingLevel(nr) = 1 'completely on
  490.            End if
  491.             Object.IntensityScale = FlashLevel(nr)
  492.     End Select
  493. End Sub
  494.  
  495. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  496.    Object.IntensityScale = FlashLevel(nr)
  497. End Sub
  498.  
  499.  'Reels
  500. Sub FadeReel(nr, reel)
  501.     Select Case FadingLevel(nr)
  502.         Case 2:FadingLevel(nr) = 0
  503.         Case 3:FadingLevel(nr) = 2
  504.         Case 4:reel.Visible = 0:FadingLevel(nr) = 3
  505.         Case 5:reel.Visible = 1:FadingLevel(nr) = 1
  506.     End Select
  507. End Sub
  508.  
  509. '**********************************************************************************************************
  510. 'Digital Display
  511. '**********************************************************************************************************
  512. Dim Digits(28)
  513.  Digits(0)=Array(a00, a05, a0c, a0d, a08, a01, a06, a0f, a02, a03, a04, a07, a0b, a0a, a09, a0e)
  514.  Digits(1)=Array(a10, a15, a1c, a1d, a18, a11, a16, a1f, a12, a13, a14, a17, a1b, a1a, a19, a1e)
  515.  Digits(2)=Array(a20, a25, a2c, a2d, a28, a21, a26, a2f, a22, a23, a24, a27, a2b, a2a, a29, a2e)
  516.  Digits(3)=Array(a30, a35, a3c, a3d, a38, a31, a36, a3f, a32, a33, a34, a37, a3b, a3a, a39, a3e)
  517.  Digits(4)=Array(a40, a45, a4c, a4d, a48, a41, a46, a4f, a42, a43, a44, a47, a4b, a4a, a49, a4e)
  518.  Digits(5)=Array(a50, a55, a5c, a5d, a58, a51, a56, a5f, a52, a53, a54, a57, a5b, a5a, a59, a5e)
  519.  Digits(6)=Array(a60, a65, a6c, a6d, a68, a61, a66, a6f, a62, a63, a64, a67, a6b, a6a, a69, a6e)
  520.  
  521.  Digits(7)=Array(a70, a75, a7c, a7d, a78, a71, a76, a7f, a72, a73, a74, a77, a7b, a7a, a79, a7e)
  522.  Digits(8)=Array(a80, a85, a8c, a8d, a88, a81, a86, a8f, a82, a83, a84, a87, a8b, a8a, a89, a8e)
  523.  Digits(9)=Array(a90, a95, a9c, a9d, a98, a91, a96, a9f, a92, a93, a94, a97, a9b, a9a, a99, a9e)
  524.  Digits(10)=Array(aa0, aa5, aac, aad, aa8, aa1, aa6, aaf, aa2, aa3, aa4, aa7, aab, aaa, aa9, aae)
  525.  Digits(11)=Array(ab0, ab5, abc, abd, ab8, ab1, ab6, abf, ab2, ab3, ab4, ab7, abb, aba, ab9, abe)
  526.  Digits(12)=Array(ac0, ac5, acc, acd, ac8, ac1, ac6, acf, ac2, ac3, ac4, ac7, acb, aca, ac9, ace)
  527.  Digits(13)=Array(ad0, ad5, adc, add, ad8, ad1, ad6, adf, ad2, ad3, ad4, ad7, adb, ada, ad9, ade)
  528.  
  529.  ' 3rd Player
  530. Digits(14) = Array(LED150,LED151,LED152,LED153,LED154,LED155,LED156)
  531. Digits(15) = Array(LED160,LED161,LED162,LED163,LED164,LED165,LED166)
  532. Digits(16) = Array(LED170,LED171,LED172,LED173,LED174,LED175,LED176)
  533. Digits(17) = Array(LED180,LED181,LED182,LED183,LED184,LED185,LED186)
  534. Digits(18) = Array(LED190,LED191,LED192,LED193,LED194,LED195,LED196)
  535. Digits(19) = Array(LED200,LED201,LED202,LED203,LED204,LED205,LED206)
  536. Digits(20) = Array(LED210,LED211,LED212,LED213,LED214,LED215,LED216)
  537.  
  538. ' 4th Player
  539. Digits(21) = Array(LED220,LED221,LED222,LED223,LED224,LED225,LED226)
  540. Digits(22) = Array(LED230,LED231,LED232,LED233,LED234,LED235,LED236)
  541. Digits(23) = Array(LED240,LED241,LED242,LED243,LED244,LED245,LED246)
  542. Digits(24) = Array(LED250,LED251,LED252,LED253,LED254,LED255,LED256)
  543. Digits(25) = Array(LED260,LED261,LED262,LED263,LED264,LED265,LED266)
  544. Digits(26) = Array(LED270,LED271,LED272,LED273,LED274,LED275,LED276)
  545. Digits(27) = Array(LED280,LED281,LED282,LED283,LED284,LED285,LED286)
  546.  
  547.  
  548.  Sub DisplayTimer_Timer
  549.     Dim ChgLED, ii, jj, num, chg, stat, obj, b, x
  550.     ChgLED=Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  551.     If Not IsEmpty(ChgLED)Then
  552.         If DesktopMode = True Then
  553.        For ii=0 To UBound(chgLED)
  554.           num=chgLED(ii, 0) : chg=chgLED(ii, 1) : stat=chgLED(ii, 2)
  555.             if (num < 28) then
  556.               For Each obj In Digits(num)
  557.                    If chg And 1 Then obj.State=stat And 1
  558.                    chg=chg\2 : stat=stat\2
  559.                   Next
  560.             Else
  561.                    end if
  562.         Next
  563.        end if
  564.     End If
  565.  End Sub
  566.  
  567. '**********************************************************************************************************
  568. '**********************************************************************************************************
  569.  
  570.  
  571. ' *********************************************************************
  572. ' *********************************************************************
  573.  
  574.                     'Start of VPX call back Functions
  575.  
  576. ' *********************************************************************
  577. ' *********************************************************************
  578.  
  579. '**********Sling Shot Animations
  580. ' Rstep and Lstep  are the variables that increment the animation
  581. '****************
  582. Dim RStep, Lstep
  583.  
  584. Sub RightSlingShot_Slingshot
  585.     vpmTimer.PulseSw 50
  586.     PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  587.     RSling.Visible = 0
  588.     RSling1.Visible = 1
  589.     sling1.TransZ = -20
  590.     RStep = 0
  591.     RightSlingShot.TimerEnabled = 1
  592. End Sub
  593.  
  594. Sub RightSlingShot_Timer
  595.     Select Case RStep
  596.         Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  597.         Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  598.     End Select
  599.     RStep = RStep + 1
  600. End Sub
  601.  
  602. Sub LeftSlingShot_Slingshot
  603.     vpmTimer.PulseSw 49
  604.     PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  605.     LSling.Visible = 0
  606.     LSling1.Visible = 1
  607.     sling2.TransZ = -20
  608.     LStep = 0
  609.     LeftSlingShot.TimerEnabled = 1
  610. End Sub
  611.  
  612. Sub LeftSlingShot_Timer
  613.     Select Case LStep
  614.         Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  615.         Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  616.     End Select
  617.     LStep = LStep + 1
  618. End Sub
  619.  
  620.  
  621.  
  622. ' *********************************************************************
  623. '                      Supporting Ball & Sound Functions
  624. ' *********************************************************************
  625.  
  626. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  627.    Vol = Csng(BallVel(ball) ^2 / 2000)
  628. End Function
  629.  
  630. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  631.    Dim tmp
  632.     tmp = ball.x * 2 / table1.width-1
  633.     If tmp > 0 Then
  634.         Pan = Csng(tmp ^10)
  635.     Else
  636.         Pan = Csng(-((- tmp) ^10) )
  637.     End If
  638. End Function
  639.  
  640. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  641.    Pitch = BallVel(ball) * 20
  642. End Function
  643.  
  644. Function BallVel(ball) 'Calculates the ball speed
  645.    BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  646. End Function
  647.  
  648. '*****************************************
  649. '      JP's VP10 Rolling Sounds
  650. '*****************************************
  651.  
  652. Const tnob = 5 ' total number of balls
  653. ReDim rolling(tnob)
  654. InitRolling
  655.  
  656. Sub InitRolling
  657.     Dim i
  658.     For i = 0 to tnob
  659.         rolling(i) = False
  660.     Next
  661. End Sub
  662.  
  663. Sub RollingTimer_Timer()
  664.     Dim BOT, b
  665.     BOT = GetBalls
  666.  
  667.     ' stop the sound of deleted balls
  668.    For b = UBound(BOT) + 1 to tnob
  669.         rolling(b) = False
  670.         StopSound("fx_ballrolling" & b)
  671.     Next
  672.  
  673.     ' exit the sub if no balls on the table
  674.    If UBound(BOT) = -1 Then Exit Sub
  675.  
  676.     ' play the rolling sound for each ball
  677.    For b = 0 to UBound(BOT)
  678.         If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  679.             rolling(b) = True
  680.             PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  681.         Else
  682.             If rolling(b) = True Then
  683.                 StopSound("fx_ballrolling" & b)
  684.                 rolling(b) = False
  685.             End If
  686.         End If
  687.     Next
  688. End Sub
  689.  
  690. '**********************
  691. ' Ball Collision Sound
  692. '**********************
  693.  
  694. Sub OnBallBallCollision(ball1, ball2, velocity)
  695.     PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  696. End Sub
  697.  
  698.  
  699.  
  700. '************************************
  701. ' What you need to add to your table
  702. '************************************
  703.  
  704. ' a timer called RollingTimer. With a fast interval, like 10
  705. ' one collision sound, in this script is called fx_collide
  706. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  707. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  708.  
  709.  
  710. '******************************************
  711. ' Explanation of the rolling sound routine
  712. '******************************************
  713.  
  714. ' sounds are played based on the ball speed and position
  715.  
  716. ' the routine checks first for deleted balls and stops the rolling sound.
  717.  
  718. ' The For loop goes through all the balls on the table and checks for the ball speed and
  719. ' if the ball is on the table (height lower than 30) then then it plays the sound
  720. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  721.  
  722. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  723. ' will change according to the ball speed, and the PAN function will change the stereo position according
  724. ' to the position of the ball on the table.
  725.  
  726.  
  727. '**************************************
  728. ' Explanation of the collision routine
  729. '**************************************
  730.  
  731. ' The collision is built in VP.
  732. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  733. ' 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
  734. ' depending of the speed of the collision.
  735.  
  736.  
  737. Sub Pins_Hit (idx)
  738.     PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  739. End Sub
  740.  
  741. Sub Targets_Hit (idx)
  742.     PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  743. End Sub
  744.  
  745. Sub Metals_Thin_Hit (idx)
  746.     PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  747. End Sub
  748.  
  749. Sub Metals_Medium_Hit (idx)
  750.     PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  751. End Sub
  752.  
  753. Sub Metals2_Hit (idx)
  754.     PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  755. End Sub
  756.  
  757. Sub Gates_Hit (idx)
  758.     PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  759. End Sub
  760.  
  761. Sub Spinner_Spin
  762.     PlaySound "fx_spinner",0,.25,0,0.25
  763. End Sub
  764.  
  765. Sub Rubbers_Hit(idx)
  766.     dim finalspeed
  767.     finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  768.     If finalspeed > 20 then
  769.         PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  770.     End if
  771.     If finalspeed >= 6 AND finalspeed <= 20 then
  772.         RandomSoundRubber()
  773.     End If
  774. End Sub
  775.  
  776. Sub Posts_Hit(idx)
  777.     dim finalspeed
  778.     finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  779.     If finalspeed > 16 then
  780.         PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  781.     End if
  782.     If finalspeed >= 6 AND finalspeed <= 16 then
  783.         RandomSoundRubber()
  784.     End If
  785. End Sub
  786.  
  787. Sub RandomSoundRubber()
  788.     Select Case Int(Rnd*3)+1
  789.         Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  790.         Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  791.         Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  792.     End Select
  793. End Sub
  794.  
  795. Sub LeftFlipper_Collide(parm)
  796.     RandomSoundFlipper()
  797. End Sub
  798.  
  799. Sub RightFlipper_Collide(parm)
  800.     RandomSoundFlipper()
  801. End Sub
  802.  
  803. Sub RandomSoundFlipper()
  804.     Select Case Int(Rnd*3)+1
  805.         Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  806.         Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  807.         Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  808.     End Select
  809. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement