Advertisement
Guest User

Untitled

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