Outhere

New World jpsalas_(Playmatic 1976)1.0.1

Oct 5th, 2021 (edited)
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 57.71 KB | None | 0 0
  1. ' ***********************************************************************
  2. ' VISUAL PINBALL X EM Script by JPSalas
  3. ' Basic EM script up to 4 players
  4. ' uses core.vbs for extra functions
  5. '
  6. ' New World / Playmatic / IPD No. 1672 / October, 1976 / 4 Players
  7. ' VPX version by JPSalas and pedator. Build in 2020, version 1.0.1
  8. ' ***********************************************************************
  9.  
  10. 'DOF Updated by Outhere
  11. '101 Left Flipper
  12. '102 Right Flipper
  13. '103 Left Slingshot
  14. '104
  15. '105 Right Slingshot
  16. '106
  17. '107 Bumper Left
  18. '108
  19. '109 Bumper Right
  20. '110 Ball Release
  21. '111 Drop Target Reset
  22. '121 Knocker
  23. '122 Shaker = Spinner1 & Spinner2
  24. '123 Targets
  25. '124 Drop Targets
  26. '201 Chime Unit Low Tone
  27. '202 Chime Unit Mid Tone
  28. '203 Chime Unit High Tone
  29.  
  30. Option Explicit
  31. Randomize
  32.  
  33. ' core.vbs constants
  34. Const BallSize = 50 ' 50 is the normal size
  35. Const BallMass = 1 ' 1 is the normal ball mass.
  36.  
  37. ' load extra vbs files
  38. LoadCoreFiles
  39.  
  40. Sub LoadCoreFiles
  41. On Error Resume Next
  42. ExecuteGlobal GetTextFile("core.vbs")
  43. If Err Then MsgBox "Can't open core.vbs"
  44. On Error Resume Next
  45. ExecuteGlobal GetTextFile("controller.vbs")
  46. If Err Then MsgBox "Can't open controller.vbs"
  47. End Sub
  48.  
  49. ' Valores Constants
  50. Const TableName = "NewWorld" ' file name to save highscores and other variables
  51. Const cGameName = "NewWorld" ' B2S name
  52. Const MaxPlayers = 4 ' 1 to 4 can play
  53. Const MaxMultiplier = 3 ' limit bonus multiplier
  54. Const BallsPerGame = 5 ' 3 or 5
  55. Const FreePlay = False ' Free play or coins
  56.  
  57. Dim Special1, Special2
  58.  
  59. ' extra ball or credit
  60. If BallsPerGame = 5 Then
  61. Special1 = 810000
  62. Special2 = 900000
  63. End If
  64.  
  65. If BallsPerGame = 3 Then
  66. Special1 = 750000
  67. Special2 = 860000
  68. End If
  69.  
  70. ' Global variables
  71. Dim PlayersPlayingGame
  72. Dim CurrentPlayer
  73. Dim Credits
  74. Dim Bonus
  75. Dim BallsRemaining(4)
  76. Dim BonusMultiplier
  77. Dim ExtraBallsAwards(4)
  78. Dim Special1Awarded(4)
  79. Dim Special2Awarded(4)
  80. Dim Score(4)
  81. Dim HighScore
  82. Dim Match
  83. Dim Tilt
  84. Dim TiltSensitivity
  85. Dim Tilted
  86. Dim Add10
  87. Dim Add100
  88. Dim Add1000
  89. Dim Add10000
  90.  
  91. ' Control variables
  92. Dim BallsOnPlayfield
  93.  
  94. ' Boolean variables
  95. Dim bAttractMode
  96. Dim bFreePlay
  97. Dim bGameInPlay
  98. Dim bOnTheFirstBall
  99. Dim bExtraBallWonThisBall
  100. Dim bJustStarted
  101. Dim bBallInPlungerLane
  102. Dim bBallSaverActive
  103.  
  104. ' core.vbs variables
  105.  
  106. ' *********************************************************************
  107. ' Common rutines to all the tables
  108. ' *********************************************************************
  109.  
  110. Sub Table1_Init()
  111. Dim x
  112. LoadEM
  113.  
  114. ' load highscore and credits
  115. Loadhs
  116. ScoreReel1.SetValue HSScore(1)
  117. If B2SOn then
  118. Controller.B2SSetScorePlayer 1, HSScore(1)
  119. End If
  120. UpdateCredits
  121.  
  122. ' init all the global variables
  123. bFreePlay = FreePlay
  124. bAttractMode = False
  125. bOnTheFirstBall = False
  126. bGameInPlay = False
  127. bBallInPlungerLane = False
  128. BallsOnPlayfield = 0
  129. CurrentPlayer = 0
  130. Tilt = 0
  131. TiltSensitivity = 6
  132. Tilted = False
  133. Match = 0
  134. bJustStarted = True
  135. Add10 = 0
  136. Add100 = 0
  137. Add1000 = 0
  138. Add10000 = 0
  139.  
  140. 'turn on GI lights
  141. vpmtimer.addtimer 1500, "GiOn '"
  142.  
  143. ' Init som objects, like walls, targets
  144. VPObjects_Init
  145.  
  146. ' setup table in game over mode
  147. EndOfGame
  148.  
  149. ' Remove desktop items in FS mode
  150. If Table1.ShowDT then
  151. For each x in aReels
  152. x.Visible = 1
  153. Next
  154. Else
  155. For each x in aReels
  156. x.Visible = 0
  157. Next
  158. End If
  159. End Sub
  160.  
  161. '******
  162. ' Keys
  163. '******
  164.  
  165. Sub Table1_KeyDown(ByVal Keycode)
  166.  
  167. If EnteringInitials then
  168. CollectInitials(keycode)
  169. Exit Sub
  170. End If
  171.  
  172. ' add coins
  173. If Keycode = AddCreditKey Then
  174. If(Tilted = False)Then
  175. AddCredits 1
  176. PlaySound "fx_coin"
  177. End If
  178. End If
  179.  
  180. ' plunger
  181. If keycode = PlungerKey Then
  182. Plunger.Pullback
  183. PlaySoundAt "fx_plungerpull", plunger
  184. End If
  185.  
  186. ' tilt keys
  187. If keycode = LeftTiltKey Then Nudge 90, 8:PlaySound "fx_nudge", 0, 1, -0.1, 0.25:CheckTilt
  188. If keycode = RightTiltKey Then Nudge 270, 8:PlaySound "fx_nudge", 0, 1, 0.1, 0.25:CheckTilt
  189. If keycode = CenterTiltKey Then Nudge 0, 9:PlaySound "fx_nudge", 0, 1, 1, 0.25:CheckTilt
  190.  
  191. ' keys during game
  192.  
  193. If bGameInPlay AND NOT Tilted Then
  194. If keycode = LeftFlipperKey Then SolLFlipper 1
  195. If keycode = RightFlipperKey Then SolRFlipper 1
  196.  
  197. If keycode = StartGameKey Then
  198. If((PlayersPlayingGame <MaxPlayers)AND(bOnTheFirstBall = True))Then
  199.  
  200. If(bFreePlay = True)Then
  201. PlayersPlayingGame = PlayersPlayingGame + 1
  202. UpdateBallInPlay
  203. UpdatePlayersCanPlay
  204. Else
  205. If(Credits> 0)then
  206. PlayersPlayingGame = PlayersPlayingGame + 1
  207. Credits = Credits - 1
  208. UpdateCredits
  209. UpdateBallInPlay
  210. UpdatePlayersCanPlay
  211. Else
  212. ' Not Enough Credits to start a game.
  213. 'PlaySound "so_nocredits"
  214. End If
  215. End If
  216. End If
  217. End If
  218. Else
  219.  
  220. If keycode = StartGameKey Then
  221. If(bFreePlay = True)Then
  222. If(BallsOnPlayfield = 0)Then
  223. ResetScores
  224. ResetForNewGame()
  225. UpdatePlayersCanPlay
  226. End If
  227. Else
  228. If(Credits> 0)Then
  229. If(BallsOnPlayfield = 0)Then
  230. Credits = Credits - 1
  231. UpdateCredits
  232. ResetScores
  233. ResetForNewGame()
  234. UpdatePlayersCanPlay
  235. End If
  236. Else
  237. ' Not Enough Credits to start a game.
  238. 'PlaySound "so_nocredits"
  239. End If
  240. End If
  241. End If
  242. End If ' If (GameInPlay)
  243. End Sub
  244.  
  245. Sub Table1_KeyUp(ByVal keycode)
  246.  
  247. If EnteringInitials then
  248. Exit Sub
  249. End If
  250.  
  251. If bGameInPlay AND NOT Tilted Then
  252. ' teclas de los flipers
  253. If keycode = LeftFlipperKey Then SolLFlipper 0
  254. If keycode = RightFlipperKey Then SolRFlipper 0
  255. End If
  256.  
  257. If keycode = PlungerKey Then
  258. Plunger.Fire
  259. If bBallInPlungerLane Then
  260. PlaySoundAt "fx_plunger", plunger
  261. Else
  262. PlaySoundAt "fx_plunger_empty", plunger
  263. End If
  264. End If
  265. End Sub
  266.  
  267. '******************
  268. ' Table stop/pause
  269. '******************
  270.  
  271. Sub table1_Paused
  272. End Sub
  273.  
  274. Sub table1_unPaused
  275. End Sub
  276.  
  277. Sub table1_Exit
  278. Savehs
  279. 'Controller.Stop
  280. End Sub
  281.  
  282. '********************
  283. ' Flippers
  284. '********************
  285.  
  286. Sub SolLFlipper(Enabled)
  287. If Enabled Then
  288. PlaySoundAt SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers), LeftFlipper:LeftFlipper.EOSTorque = 0.85:LeftFlipper.RotateToEnd
  289. Else
  290. PlaySoundAt SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers), LeftFlipper:LeftFlipper.EOSTorque = .25:LeftFlipper.RotateToStart
  291. End If
  292. End Sub
  293.  
  294. Sub SolRFlipper(Enabled)
  295. If Enabled Then
  296. PlaySoundAt SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers), RightFlipper:RightFlipper.EOSTorque = 0.85:RightFlipper.RotateToEnd
  297. Else
  298. PlaySoundAt SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers), RightFlipper:RightFlipper.EOSTorque = 0.25:RightFlipper.RotateToStart
  299. End If
  300. End Sub
  301.  
  302. Sub LeftFlipper_Collide(parm)
  303. PlaySoundAtBall "fx_rubber_flipper"
  304. End Sub
  305.  
  306. Sub RightFlipper_Collide(parm)
  307. PlaySoundAtBall "fx_rubber_flipper"
  308. End Sub
  309.  
  310. '***********
  311. ' GI lights
  312. '***********
  313.  
  314. Sub GiOn 'enciende las luces GI
  315. Dim bulb
  316. For each bulb in aGiLights
  317. bulb.State = 1
  318. Next
  319. End Sub
  320.  
  321. Sub GiOff 'apaga las luces GI
  322. Dim bulb
  323. For each bulb in aGiLights
  324. bulb.State = 0
  325. Next
  326. End Sub
  327.  
  328. '**************
  329. ' TILT
  330. '**************
  331.  
  332. Sub CheckTilt
  333. Tilt = Tilt + TiltSensitivity
  334. TiltDecreaseTimer.Enabled = True
  335. If Tilt> 15 Then
  336. Tilted = True
  337. TiltReel.SetValue 1
  338. If B2SOn then
  339. Controller.B2SSetTilt 1
  340. end if
  341. DisableTable True
  342. ' BallsRemaining(CurrentPlayer) = 0 'player looses the game
  343. TiltRecoveryTimer.Enabled = True 'wait for all the balls to drain
  344. End If
  345. End Sub
  346.  
  347. Sub TiltDecreaseTimer_Timer
  348. If Tilt> 0 Then
  349. Tilt = Tilt - 0.1
  350. Else
  351. TiltDecreaseTimer.Enabled = False
  352. End If
  353. End Sub
  354.  
  355. Sub DisableTable(Enabled)
  356. If Enabled Then
  357. GiOff
  358. LeftFlipper.RotateToStart
  359. RightFlipper.RotateToStart
  360. Bumper001.Force = 0
  361. Bumper002.Force = 0
  362. LeftSlingshot.Disabled = 1
  363. RightSlingshot.Disabled = 1
  364. Else
  365. GiOn
  366. Bumper001.Force = 8
  367. Bumper002.Force = 8
  368. LeftSlingshot.Disabled = 0
  369. RightSlingshot.Disabled = 0
  370. End If
  371. End Sub
  372.  
  373. Sub TiltRecoveryTimer_Timer()
  374. ' all the balls have drained
  375. If(BallsOnPlayfield = 0)Then
  376. EndOfBall()
  377. TiltRecoveryTimer.Enabled = False
  378. End If
  379. ' otherwise repeat
  380. End Sub
  381.  
  382. ' *********************************************************************
  383. ' Supporting Ball & Sound Functions
  384. ' *********************************************************************
  385.  
  386. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  387. Vol = Csng(BallVel(ball) ^2 / 2000)
  388. End Function
  389.  
  390. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  391. Dim tmp
  392. tmp = ball.x * 2 / table1.width-1
  393. If tmp> 0 Then
  394. Pan = Csng(tmp ^10)
  395. Else
  396. Pan = Csng(-((- tmp) ^10))
  397. End If
  398. End Function
  399.  
  400. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  401. Pitch = BallVel(ball) * 20
  402. End Function
  403.  
  404. Function BallVel(ball) 'Calculates the ball speed
  405. BallVel = (SQR((ball.VelX ^2) + (ball.VelY ^2)))
  406. End Function
  407.  
  408. Function AudioFade(ball) 'only on VPX 10.4 and newer
  409. Dim tmp
  410. tmp = ball.y * 2 / Table1.height-1
  411. If tmp> 0 Then
  412. AudioFade = Csng(tmp ^10)
  413. Else
  414. AudioFade = Csng(-((- tmp) ^10))
  415. End If
  416. End Function
  417.  
  418. Sub PlaySoundAt(soundname, tableobj) 'play sound at X and Y position of an object, mostly bumpers, flippers and other fast objects
  419. PlaySound soundname, 0, 1, Pan(tableobj), 0.06, 0, 0, 0, AudioFade(tableobj)
  420. End Sub
  421.  
  422. Sub PlaySoundAtBall(soundname) ' play a sound at the ball position, like rubbers, targets, metals, plastics
  423. PlaySound soundname, 0, Vol(ActiveBall), pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
  424. End Sub
  425.  
  426. '********************************************
  427. ' JP's VP10 Rolling Sounds + Ballshadow
  428. ' uses a collection of shadows, aBallShadow
  429. '********************************************
  430.  
  431. Const tnob = 20 ' total number of balls
  432. Const lob = 0 'number of locked balls
  433. ReDim rolling(tnob)
  434. InitRolling
  435.  
  436. Sub InitRolling
  437. Dim i
  438. For i = 0 to tnob
  439. rolling(i) = False
  440. Next
  441. End Sub
  442.  
  443. Sub RollingUpdate()
  444. Dim BOT, b, ballpitch, ballvol
  445. BOT = GetBalls
  446.  
  447. ' stop the sound of deleted balls
  448. For b = UBound(BOT) + 1 to tnob
  449. rolling(b) = False
  450. StopSound("fx_ballrolling" & b)
  451. Next
  452.  
  453. ' exit the sub if no balls on the table
  454. If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table
  455.  
  456. ' play the rolling sound for each ball and draw the shadow
  457. For b = lob to UBound(BOT)
  458. aBallShadow(b).X = BOT(b).X
  459. aBallShadow(b).Y = BOT(b).Y
  460.  
  461. If BallVel(BOT(b))> 1 Then
  462. If BOT(b).z <30 Then
  463. ballpitch = Pitch(BOT(b))
  464. ballvol = Vol(BOT(b))
  465. Else
  466. ballpitch = Pitch(BOT(b)) + 25000 'increase the pitch on a ramp
  467. ballvol = Vol(BOT(b)) * 10
  468. End If
  469. rolling(b) = True
  470. PlaySound("fx_ballrolling" & b), -1, ballvol, Pan(BOT(b)), 0, ballpitch, 1, 0, AudioFade(BOT(b))
  471. Else
  472. If rolling(b) = True Then
  473. StopSound("fx_ballrolling" & b)
  474. rolling(b) = False
  475. End If
  476. End If
  477. ' rothbauerw's Dropping Sounds
  478. If BOT(b).VelZ <-1 and BOT(b).z <55 and BOT(b).z> 27 Then 'height adjust for ball drop sounds
  479. PlaySound "fx_balldrop", 0, ABS(BOT(b).velz) / 17, Pan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  480. End If
  481. Next
  482. End Sub
  483.  
  484. '**********************
  485. ' Ball Collision Sound
  486. '**********************
  487.  
  488. Sub OnBallBallCollision(ball1, ball2, velocity)
  489. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  490. End Sub
  491.  
  492. '***************************************
  493. ' Collection collision sounds
  494. '***************************************
  495.  
  496. Sub aMetals_Hit(idx):PlaySoundAtBall "fx_MetalHit":End Sub
  497. Sub aRubber_Bands_Hit(idx):PlaySoundAtBall "fx_rubber_band":End Sub
  498. Sub aRubber_Posts_Hit(idx):PlaySoundAtBall "fx_rubber_post":End Sub
  499. Sub aRubber_Pins_Hit(idx):PlaySoundAtBall "fx_rubber_pin":End Sub
  500. Sub aPlastics_Hit(idx):PlaySoundAtBall "fx_PlasticHit":End Sub
  501. Sub aGates_Hit(idx):PlaySoundAtBall "fx_Gate":End Sub
  502. Sub aWoods_Hit(idx):PlaySoundAtBall "fx_Woodhit":End Sub
  503.  
  504. '************************************************************************************************************************
  505. ' Only for VPX 10.2 and higher.
  506. ' FlashForMs will blink light or a flasher for TotalPeriod(ms) at rate of BlinkPeriod(ms)
  507. ' When TotalPeriod done, light or flasher will be set to FinalState value where
  508. ' Final State values are: 0=Off, 1=On, 2=Return to previous State
  509. '************************************************************************************************************************
  510.  
  511. Sub FlashForMs(MyLight, TotalPeriod, BlinkPeriod, FinalState)
  512.  
  513. If TypeName(MyLight) = "Light" Then
  514. If FinalState = 2 Then
  515. FinalState = MyLight.State
  516. End If
  517. MyLight.BlinkInterval = BlinkPeriod
  518. MyLight.Duration 2, TotalPeriod, FinalState
  519. ElseIf TypeName(MyLight) = "Flasher" Then
  520. Dim steps
  521. steps = Int(TotalPeriod / BlinkPeriod + .5)
  522. If FinalState = 2 Then
  523. FinalState = ABS(MyLight.Visible)
  524. End If
  525. MyLight.UserValue = steps * 10 + FinalState
  526. MyLight.TimerInterval = BlinkPeriod
  527. MyLight.TimerEnabled = 0
  528. MyLight.TimerEnabled = 1
  529. ExecuteGlobal "Sub " & MyLight.Name & "_Timer:" & "Dim tmp, steps, fstate:tmp=me.UserValue:fstate = tmp MOD 10:steps= tmp\10 -1:Me.Visible = steps MOD 2:me.UserValue = steps *10 + fstate:If Steps = 0 then Me.Visible = fstate:Me.TimerEnabled=0:End if:End Sub"
  530. End If
  531. End Sub
  532.  
  533. '****************************************
  534. ' Init table for a new game
  535. '****************************************
  536.  
  537. Sub ResetForNewGame()
  538. 'debug.print "ResetForNewGame"
  539. Dim i
  540.  
  541. bGameInPLay = True
  542. bBallSaverActive = False
  543.  
  544. StopAttractMode
  545. If B2SOn then
  546. Controller.B2SSetGameOver 0
  547. end if
  548.  
  549. GiOn
  550.  
  551. CurrentPlayer = 1
  552. PlayersPlayingGame = 1
  553. bOnTheFirstBall = True
  554. For i = 1 To MaxPlayers
  555. Score(i) = 0
  556. ExtraBallsAwards(i) = 0
  557. Special1Awarded(i) = False
  558. Special2Awarded(i) = False
  559. BallsRemaining(i) = BallsPerGame
  560. Next
  561. BonusMultiplier = 1
  562. Bonus = 0
  563. UpdateBallInPlay
  564.  
  565. Clear_Match
  566.  
  567. ' init other variables
  568. Tilt = 0
  569.  
  570. ' init game variables
  571. Game_Init()
  572.  
  573. ' start a music?
  574. ' first ball
  575. vpmtimer.addtimer 2000, "FirstBall '"
  576. End Sub
  577.  
  578. Sub FirstBall
  579. 'debug.print "FirstBall"
  580. ' reset table for a new ball, rise droptargets ++
  581. ResetForNewPlayerBall()
  582. CreateNewBall()
  583. End Sub
  584.  
  585. ' (Re-)init table for a new ball or player
  586.  
  587. Sub ResetForNewPlayerBall()
  588. 'debug.print "ResetForNewPlayerBall"
  589. AddScore 0
  590.  
  591. ' reset multiplier to 1x
  592.  
  593. ' turn on lights, and variables
  594. bExtraBallWonThisBall = False
  595. ResetNewBallLights
  596. ResetNewBallVariables
  597. End Sub
  598.  
  599. ' Crete new ball
  600.  
  601. Sub CreateNewBall()
  602. BallRelease.CreateSizedBallWithMass BallSize / 2, BallMass
  603. BallsOnPlayfield = BallsOnPlayfield + 1
  604. UpdateBallInPlay
  605. PlaySoundAt SoundFXDOF("fx_Ballrel", 110, DOFPulse, DOFContactors), BallRelease
  606. BallRelease.Kick 90, 4
  607. End Sub
  608.  
  609. ' player lost the ball
  610.  
  611. Sub EndOfBall()
  612. 'debug.print "EndOfBall"
  613. Dim AwardPoints, TotalBonus, ii
  614. AwardPoints = 0
  615. TotalBonus = 0
  616. ' Lost the first ball, now it cannot accept more players
  617. bOnTheFirstBall = False
  618.  
  619. ' add bonus if no tilt
  620. ' tilt system will take care of the next ball
  621.  
  622. If NOT Tilted Then
  623. Select Case BonusMultiplier
  624. Case 1:BonusCountTimer.Interval = 250
  625. Case 2:BonusCountTimer.Interval = 400
  626. Case 3:BonusCountTimer.Interval = 550
  627. End Select
  628. BonusCountTimer.Enabled = 1
  629. Else
  630. vpmtimer.addtimer 400, "EndOfBall2 '"
  631. End If
  632. End Sub
  633.  
  634. Sub BonusCountTimer_Timer
  635. 'debug.print "BonusCount_Timer"
  636. If Bonus = 11 Then Bonus = 10
  637. If Bonus> 0 Then
  638. Bonus = Bonus -1
  639. AddScore 10000 * BonusMultiplier
  640. UpdateBonusLights
  641. Else
  642. BonusCountTimer.Enabled = 0
  643. vpmtimer.addtimer 1000, "EndOfBall2 '"
  644. End If
  645. End Sub
  646.  
  647. Sub UpdateBonusLights
  648. Select Case Bonus
  649. Case 0:bl001.State = 0:bl002.State = 0:bl003.State = 0:bl004.State = 0:bl005.State = 0:bl006.State = 0:bl007.State = 0:bl008.State = 0:bl009.State = 0:bl010.State = 0:light022.State = 0
  650. Case 1:bl001.State = 1:bl002.State = 0:bl003.State = 0:bl004.State = 0:bl005.State = 0:bl006.State = 0:bl007.State = 0:bl008.State = 0:bl009.State = 0:bl010.State = 0:light022.State = 0
  651. Case 2:bl001.State = 0:bl002.State = 1:bl003.State = 0:bl004.State = 0:bl005.State = 0:bl006.State = 0:bl007.State = 0:bl008.State = 0:bl009.State = 0:bl010.State = 0:light022.State = 0
  652. Case 3:bl001.State = 0:bl002.State = 0:bl003.State = 1:bl004.State = 0:bl005.State = 0:bl006.State = 0:bl007.State = 0:bl008.State = 0:bl009.State = 0:bl010.State = 0:light022.State = 0
  653. Case 4:bl001.State = 0:bl002.State = 0:bl003.State = 0:bl004.State = 1:bl005.State = 0:bl006.State = 0:bl007.State = 0:bl008.State = 0:bl009.State = 0:bl010.State = 0:light022.State = 0
  654. Case 5:bl001.State = 0:bl002.State = 0:bl003.State = 0:bl004.State = 0:bl005.State = 1:bl006.State = 0:bl007.State = 0:bl008.State = 0:bl009.State = 0:bl010.State = 0:light022.State = 0
  655. Case 6:bl001.State = 0:bl002.State = 0:bl003.State = 0:bl004.State = 0:bl005.State = 0:bl006.State = 1:bl007.State = 0:bl008.State = 0:bl009.State = 0:bl010.State = 0:light022.State = 0
  656. Case 7:bl001.State = 0:bl002.State = 0:bl003.State = 0:bl004.State = 0:bl005.State = 0:bl006.State = 0:bl007.State = 1:bl008.State = 0:bl009.State = 0:bl010.State = 0:light022.State = 0
  657. Case 8:bl001.State = 0:bl002.State = 0:bl003.State = 0:bl004.State = 0:bl005.State = 0:bl006.State = 0:bl007.State = 0:bl008.State = 1:bl009.State = 0:bl010.State = 0:light022.State = 0
  658. Case 9:bl001.State = 0:bl002.State = 0:bl003.State = 0:bl004.State = 0:bl005.State = 0:bl006.State = 0:bl007.State = 0:bl008.State = 0:bl009.State = 1:bl010.State = 0:light022.State = 0
  659. Case 10:bl001.State = 0:bl002.State = 0:bl003.State = 0:bl004.State = 0:bl005.State = 0:bl006.State = 0:bl007.State = 0:bl008.State = 0:bl009.State = 0:bl010.State = 1:light022.State = 0
  660. Case 11:bl001.State = 0:bl002.State = 0:bl003.State = 0:bl004.State = 0:bl005.State = 0:bl006.State = 0:bl007.State = 0:bl008.State = 0:bl009.State = 0:bl010.State = 1:light022.State = 1
  661. End Select
  662. End Sub
  663.  
  664. ' After bonus count go to the next step
  665. '
  666. Sub EndOfBall2()
  667. 'debug.print "EndOfBall2"
  668.  
  669. Tilted = False
  670. Tilt = 0
  671. TiltReel.SetValue 0
  672. If B2SOn then
  673. Controller.B2SSetTilt 0
  674. end if
  675. DisableTable False
  676.  
  677. ' win extra ball?
  678. If(ExtraBallsAwards(CurrentPlayer)> 0)Then
  679. 'debug.print "Extra Ball"
  680.  
  681. ' if so then give it
  682. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer)- 1
  683.  
  684. ' turn off light if no more extra balls
  685. If(ExtraBallsAwards(CurrentPlayer) = 0)Then
  686. LightShootAgain.State = 0
  687. If B2SOn then
  688. Controller.B2SSetShootAgain 0
  689. end if
  690. End If
  691.  
  692. ' extra ball sound?
  693.  
  694. ' reset as in a new ball
  695. ResetForNewPlayerBall()
  696. CreateNewBall()
  697. Else ' no extra ball
  698.  
  699. BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer)- 1
  700.  
  701. ' last ball?
  702. If(BallsRemaining(CurrentPlayer) <= 0)Then
  703. CheckHighScore()
  704. End If
  705.  
  706. ' this is not the last ball, chack for new player
  707. EndOfBallComplete()
  708. End If
  709. End Sub
  710.  
  711. Sub EndOfBallComplete()
  712. 'debug.print "EndOfBallComplete"
  713. Dim NextPlayer
  714.  
  715. ' other players?
  716. If(PlayersPlayingGame> 1)Then
  717. NextPlayer = CurrentPlayer + 1
  718. ' if it is the last player then go to the first one
  719. If(NextPlayer> PlayersPlayingGame)Then
  720. NextPlayer = 1
  721. End If
  722. Else
  723. NextPlayer = CurrentPlayer
  724. End If
  725.  
  726. 'debug.print "Next Player = " & NextPlayer
  727.  
  728. ' end of game?
  729. If((BallsRemaining(CurrentPlayer) <= 0)AND(BallsRemaining(NextPlayer) <= 0))Then
  730.  
  731. ' match if playing with coins
  732. If bFreePlay = False Then
  733. Verification_Match
  734. End If
  735.  
  736. ' end of game
  737. EndOfGame()
  738. Else
  739. ' next player
  740. CurrentPlayer = NextPlayer
  741.  
  742. ' update score
  743. AddScore 0
  744.  
  745. ' reset table for new player
  746.  
  747. ResetForNewPlayerBall()
  748. CreateNewBall()
  749. End If
  750. End Sub
  751.  
  752. ' Called at the end of the game
  753.  
  754. Sub EndOfGame()
  755. 'debug.print "EndOfGame"
  756. bGameInPLay = False
  757. bJustStarted = False
  758. If B2SOn then
  759. Controller.B2SSetGameOver 1
  760. Controller.B2SSetBallInPlay 0
  761. Controller.B2SSetPlayerUp 0
  762. Controller.B2SSetCanPlay 0
  763. Controller.B2SSetData 110, 0 'Jackpot
  764. end if
  765. ' turn off flippers
  766. SolLFlipper 0
  767. SolRFlipper 0
  768.  
  769. ' start the attract mode
  770. StartAttractMode
  771. End Sub
  772.  
  773. ' Fuction to calculate the balls left
  774. Function Balls
  775. Dim tmp
  776. If CurrentPlayer = 0 Then
  777. Balls = 0
  778. Else
  779. tmp = BallsPerGame - BallsRemaining(CurrentPlayer) + 1
  780. If tmp> BallsPerGame Then
  781. Balls = BallsPerGame
  782. Else
  783. Balls = tmp
  784. End If
  785. End If
  786. End Function
  787.  
  788. ' check the highscore
  789. Sub CheckHighscore
  790. Dim playertops, si, sj, i, stemp, stempplayers
  791. For i = 1 to 4
  792. sortscores(i) = 0
  793. sortplayers(i) = 0
  794. Next
  795. playertops = 0
  796. For i = 1 to PlayersPlayingGame
  797. sortscores(i) = Score(i)
  798. sortplayers(i) = i
  799. Next
  800. For si = 1 to PlayersPlayingGame
  801. For sj = 1 to PlayersPlayingGame-1
  802. If sortscores(sj)> sortscores(sj + 1)then
  803. stemp = sortscores(sj + 1)
  804. stempplayers = sortplayers(sj + 1)
  805. sortscores(sj + 1) = sortscores(sj)
  806. sortplayers(sj + 1) = sortplayers(sj)
  807. sortscores(sj) = stemp
  808. sortplayers(sj) = stempplayers
  809. End If
  810. Next
  811. Next
  812. HighScoreTimer.interval = 100
  813. HighScoreTimer.enabled = True
  814. ScoreChecker = 4
  815. CheckAllScores = 1
  816. NewHighScore sortscores(ScoreChecker), sortplayers(ScoreChecker)
  817. End Sub
  818.  
  819. '******************
  820. ' Match
  821. '******************
  822.  
  823. Sub Verification_Match()
  824. PlaySound "fx_match"
  825. Match = INT(RND(1) * 10) * 100 ' random between 10 and 90
  826. Display_Match
  827. If(Score(CurrentPlayer)MOD 1000) = Match Then
  828. PlaySound SoundFXDOF("fx_knocker", 121, DOFPulse, DOFContactors)
  829. AddCredits 1
  830. End If
  831. End Sub
  832.  
  833. Sub Clear_Match()
  834. MatchReel.SetValue 0
  835. If B2SOn then
  836. Controller.B2SSetMatch 34, 100
  837. end if
  838. End Sub
  839.  
  840. Sub Display_Match()
  841. MatchReel.SetValue(Match \ 100)
  842. If B2SOn then
  843. If Match = 0 then
  844. Controller.B2SSetMatch 34, 100
  845. else
  846. Controller.B2SSetMatch 34, Match\10
  847. end if
  848. end if
  849. End Sub
  850.  
  851. ' *********************************************************************
  852. ' Drain / Plunger Functions
  853. ' *********************************************************************
  854.  
  855. Sub Drain_Hit()
  856. Drain.DestroyBall
  857. BallsOnPlayfield = BallsOnPlayfield - 1
  858. PlaySoundAt "fx_drain", Drain
  859. ' turn off Gi lights
  860. GiOff
  861.  
  862. 'tilted?
  863. If Tilted Then
  864. StopEndOfBallMode
  865. End If
  866.  
  867. ' if still playing and not tilted
  868. If(bGameInPLay = True)AND(Tilted = False)Then
  869.  
  870. ' ballsaver?
  871. If(bBallSaverActive = True)Then
  872. CreateNewBall()
  873. Else
  874. ' last ball?
  875. If(BallsOnPlayfield = 0)Then
  876. StopEndOfBallMode
  877. vpmtimer.addtimer 500, "EndOfBall '"
  878. Exit Sub
  879. End If
  880. End If
  881. End If
  882. End Sub
  883.  
  884. Sub swPlungerRest_Hit()
  885. bBallInPlungerLane = True
  886. End Sub
  887.  
  888. Sub swPlungerRest_UnHit()
  889. bBallInPlungerLane = False
  890. End Sub
  891.  
  892. ' ****************************************
  893. ' Score functions
  894. ' ****************************************
  895.  
  896. 'Sub AddScore(Points)
  897. ' If Tilted Then Exit Sub
  898. ' Select Case Points
  899. ' Case 10, 100, 1000, 10000
  900. ' Score(CurrentPlayer) = Score(CurrentPlayer) + points
  901. ' UpdateScore points
  902. ' ' sounds
  903. ' If Points = 100 AND(Score(CurrentPlayer)MOD 10000) \ 1000 = 0 Then 'new reel 10000
  904. ' PlaySound SoundFXDOF("10000", 202, DOFPulse, DOFChimes)
  905. ' ElseIf Points = 10 AND(Score(CurrentPlayer)MOD 1000) \ 100 = 0 Then 'new reel 1000
  906. ' PlaySound SoundFXDOF("1000", 201, DOFPulse, DOFChimes)
  907. ' Else
  908. ' PlaySound Points
  909. ' End If
  910. ' Case 20, 30, 40, 50
  911. ' Add10 = Add10 + Points \ 10
  912. ' AddScore10Timer.Enabled = TRUE
  913. ' Case 200, 300, 400, 500
  914. ' Add100 = Add100 + Points \ 100
  915. ' AddScore100Timer.Enabled = TRUE
  916. ' Case 2000, 3000, 4000, 5000
  917. ' Add1000 = Add1000 + Points \ 1000
  918. ' AddScore1000Timer.Enabled = TRUE
  919. ' Case 20000, 30000, 40000, 50000
  920. ' Add10000 = Add10000 + Points \ 10000
  921. ' AddScore10000Timer.Enabled = TRUE
  922. ' End Select
  923. '
  924. ' ' check for higher score and specials
  925. ' If Score(CurrentPlayer) >= Special1 AND Special1Awarded(CurrentPlayer) = False Then
  926. ' AwardSpecial
  927. ' Special1Awarded(CurrentPlayer) = True
  928. ' End If
  929. ' If Score(CurrentPlayer) >= Special2 AND Special2Awarded(CurrentPlayer) = False Then
  930. ' AwardSpecial
  931. ' Special2Awarded(CurrentPlayer) = True
  932. ' End If
  933.  
  934. Sub AddScore(Points)
  935. If Tilted Then Exit Sub
  936. Select Case Points
  937. Case 100, 1000, 10000
  938. Score(CurrentPlayer) = Score(CurrentPlayer) + points
  939. UpdateScore points
  940. ' sounds
  941. If Points = 1000 AND(Score(CurrentPlayer)MOD 10000) \ 1000 = 0 Then 'new reel 10000
  942. PlaySound SoundFXDOF("chime_10000", 203, DOFPulse, DOFChimes)
  943. ' PlaySound "chime_10000"
  944. ElseIf Points = 100 AND(Score(CurrentPlayer)MOD 1000) \ 100 = 0 Then 'new reel 1000
  945. PlaySound SoundFXDOF("chime_1000", 202, DOFPulse, DOFChimes)
  946. ' PlaySound "chime_1000"
  947. Else
  948. PlaySound SoundFXDOF("chime_", 201, DOFPulse, DOFChimes)
  949. ' PlaySound "chime_" &Points
  950. End If
  951. Case 200, 300, 400, 500
  952. Add100 = Add100 + Points \ 100
  953. AddScore100Timer.Enabled = TRUE
  954. Case 2000, 3000, 4000, 5000
  955. Add1000 = Add1000 + Points \ 1000
  956. AddScore1000Timer.Enabled = TRUE
  957. Case 20000, 30000, 40000, 50000
  958. Add10000 = Add10000 + Points \ 10000
  959. AddScore10000Timer.Enabled = TRUE
  960. End Select
  961.  
  962. ' check for higher score and specials
  963. If Score(CurrentPlayer) >= Special1 AND Special1Awarded(CurrentPlayer) = False Then
  964. AwardSpecial
  965. Special1Awarded(CurrentPlayer) = True
  966. End If
  967. If Score(CurrentPlayer) >= Special2 AND Special2Awarded(CurrentPlayer) = False Then
  968. AwardSpecial
  969. Special2Awarded(CurrentPlayer) = True
  970. End If
  971. End Sub
  972.  
  973. '************************************
  974. ' Score sound Timers
  975. '************************************
  976.  
  977. Sub AddScore10Timer_Timer()
  978. if Add10> 0 then
  979. AddScore 10
  980. Add10 = Add10 - 1
  981. Else
  982. Me.Enabled = FALSE
  983. End If
  984. End Sub
  985.  
  986. Sub AddScore100Timer_Timer()
  987. if Add100> 0 then
  988. AddScore 100
  989. Add100 = Add100 - 1
  990. Else
  991. Me.Enabled = FALSE
  992. End If
  993. End Sub
  994.  
  995. Sub AddScore1000Timer_Timer()
  996. if Add1000> 0 then
  997. AddScore 1000
  998. Add1000 = Add1000 - 1
  999. Else
  1000. Me.Enabled = FALSE
  1001. End If
  1002. End Sub
  1003.  
  1004. Sub AddScore10000Timer_Timer()
  1005. if Add10000> 0 then
  1006. AddScore 10000
  1007. Add10000 = Add10000 - 1
  1008. Else
  1009. Me.Enabled = FALSE
  1010. End If
  1011. End Sub
  1012.  
  1013. '*******************
  1014. ' BONUS
  1015. '*******************
  1016.  
  1017. Sub AddBonus(bonuspoints)
  1018. If(Tilted = False)Then
  1019. Bonus = Bonus + bonuspoints
  1020. 'PlaySound "Bell2"
  1021. If Bonus> 11 Then
  1022. Bonus = 11
  1023. End If
  1024. UpdateBonusLights
  1025. End if
  1026. End Sub
  1027.  
  1028. Sub AddBonusMultiplier(multi)
  1029. If(Tilted = False)Then
  1030. BonusMultiplier = BonusMultiplier + multi
  1031. If BonusMultiplier> MaxMultiplier Then
  1032. BonusMultiplier = MaxMultiplier
  1033. End If
  1034. UpdateMultiplierLights
  1035. End if
  1036. End Sub
  1037.  
  1038. Sub UpdateMultiplierLights
  1039. Select Case BonusMultiplier
  1040. Case 1:light005.State = 0:light004.State = 0
  1041. Case 2:light005.State = 1:light004.State = 0
  1042. Case 3:light005.State = 0:light004.State = 1
  1043. End Select
  1044. End Sub
  1045.  
  1046. '**********************************
  1047. ' Score EM reels
  1048. '**********************************
  1049.  
  1050. Sub UpdateScore(playerpoints)
  1051. Select Case CurrentPlayer
  1052. Case 1:ScoreReel1.Addvalue playerpoints
  1053. Case 2:ScoreReel2.Addvalue playerpoints
  1054. Case 3:ScoreReel3.Addvalue playerpoints
  1055. Case 4:ScoreReel4.Addvalue playerpoints
  1056. End Select
  1057. If B2SOn then
  1058. Controller.B2SSetScorePlayer CurrentPlayer, Score(CurrentPlayer)
  1059. If Score(CurrentPlayer) >= 100000 then
  1060. Controller.B2SSetScoreRollover 24 + CurrentPlayer, 1
  1061. end if
  1062. end if
  1063. End Sub
  1064.  
  1065. Sub ResetScores
  1066. ' play EM reel reset
  1067. ' PlaySound"ReelStartup"
  1068. ScoreReel1.ResetToZero
  1069. ScoreReel2.ResetToZero
  1070. ScoreReel3.ResetToZero
  1071. ScoreReel4.ResetToZero
  1072. If B2SOn then
  1073. Controller.B2SSetScorePlayer1 0
  1074. Controller.B2SSetScoreRolloverPlayer1 0
  1075. Controller.B2SSetScorePlayer2 0
  1076. Controller.B2SSetScoreRolloverPlayer2 0
  1077. Controller.B2SSetScorePlayer3 0
  1078. Controller.B2SSetScoreRolloverPlayer3 0
  1079. Controller.B2SSetScorePlayer4 0
  1080. Controller.B2SSetScoreRolloverPlayer4 0
  1081. end if
  1082. End Sub
  1083.  
  1084. Sub AddCredits(value) 'limit to 15 credits
  1085. If Credits <9 Then
  1086. Credits = Credits + value
  1087. CreditsReel.SetValue Credits
  1088. UpdateCredits
  1089. end if
  1090. End Sub
  1091.  
  1092. Sub UpdateCredits
  1093. 'If Credits> 0 Then 'in Bally tables
  1094. ' CreditLight.State = 1
  1095. 'Else
  1096. ' CreditLight.State = 0
  1097. 'End If
  1098. PlaySound "fx_relay"
  1099. CreditsReel.SetValue credits
  1100. If B2SOn then
  1101. Controller.B2SSetCredits Credits
  1102. end if
  1103. End Sub
  1104.  
  1105. Sub UpdateBallInPlay
  1106. Select Case Balls
  1107. Case 0:bip1.State = 0:bip2.State = 0:bip3.State = 0:bip4.State = 0:bip5.State = 0
  1108. Case 1:bip1.State = 1:bip2.State = 0:bip3.State = 0:bip4.State = 0:bip5.State = 0
  1109. Case 2:bip1.State = 0:bip2.State = 1:bip3.State = 0:bip4.State = 0:bip5.State = 0
  1110. Case 3:bip1.State = 0:bip2.State = 0:bip3.State = 1:bip4.State = 0:bip5.State = 0
  1111. Case 4:bip1.State = 0:bip2.State = 0:bip3.State = 0:bip4.State = 1:bip5.State = 0
  1112. Case 5:bip1.State = 0:bip2.State = 0:bip3.State = 0:bip4.State = 0:bip5.State = 1
  1113. End Select
  1114. If B2SOn then
  1115. Controller.B2SSetBallInPlay Balls
  1116. End If
  1117. ' Update player light
  1118. Select Case CurrentPlayer
  1119. Case 0:pl1.State = 0:pl2.State = 0:pl3.State = 0:pl4.State = 0
  1120. Case 1:pl1.State = 1:pl2.State = 0:pl3.State = 0:pl4.State = 0
  1121. Case 2:pl1.State = 0:pl2.State = 1:pl3.State = 0:pl4.State = 0
  1122. Case 3:pl1.State = 0:pl2.State = 0:pl3.State = 1:pl4.State = 0
  1123. Case 4:pl1.State = 0:pl2.State = 0:pl3.State = 0:pl4.State = 1
  1124. End Select
  1125. If B2SOn then
  1126. Controller.B2SSetPlayerUp CurrentPlayer
  1127. End If
  1128. End Sub
  1129.  
  1130. Sub UpdatePlayersCanPlay
  1131. Select Case PlayersPlayingGame
  1132. Case 0:cp1.State = 0:cp2.State = 0:cp3.State = 0:cp4.State = 0
  1133. Case 1:cp1.State = 1:cp2.State = 0:cp3.State = 0:cp4.State = 0
  1134. Case 2:cp1.State = 0:cp2.State = 1:cp3.State = 0:cp4.State = 0
  1135. Case 3:cp1.State = 0:cp2.State = 0:cp3.State = 1:cp4.State = 0
  1136. Case 4:cp1.State = 0:cp2.State = 0:cp3.State = 0:cp4.State = 1
  1137. End Select
  1138. If B2SOn then
  1139. Controller.B2SSetCanPlay PlayersPlayingGame
  1140. end if
  1141. End Sub
  1142.  
  1143. '*************************
  1144. ' Specials
  1145. '*************************
  1146.  
  1147. Sub AwardExtraBall()
  1148. If NOT bExtraBallWonThisBall Then
  1149. PlaySound SoundFXDOF("fx_knocker", 121, DOFPulse, DOFContactors)
  1150. ExtraBallsAwards(CurrentPlayer) = ExtraBallsAwards(CurrentPlayer) + 1
  1151. bExtraBallWonThisBall = True
  1152. LightShootAgain.State = 1
  1153. Else
  1154. Addscore 5000
  1155. END If
  1156. End Sub
  1157.  
  1158. Sub AwardSpecial()
  1159. PlaySound SoundFXDOF("fx_knocker", 121, DOFPulse, DOFContactors)
  1160. AddCredits 1
  1161. End Sub
  1162.  
  1163. ' ********************************
  1164. ' Attract Mode
  1165. ' ********************************
  1166. ' use the"Blink Pattern" of each light
  1167.  
  1168. Sub StartAttractMode()
  1169. Dim x
  1170. bAttractMode = True
  1171. For each x in aLights
  1172. x.State = 2
  1173. Next
  1174. GameOverR.SetValue 1
  1175. For each x in aBackdropLights
  1176. x.State = 0
  1177. Next
  1178. End Sub
  1179.  
  1180. Sub StopAttractMode()
  1181. Dim x
  1182. bAttractMode = False
  1183. TurnOffPlayfieldLights
  1184. ResetScores
  1185. GameOverR.SetValue 0
  1186. End Sub
  1187.  
  1188. '*********************************
  1189. ' Load / Save / Highscore
  1190. '*********************************
  1191.  
  1192. Sub Loadhs
  1193. ' Based on Black's Highscore routines
  1194. Dim FileObj
  1195. Dim ScoreFile, TextStr
  1196. Dim temp1
  1197. Dim temp2
  1198. Dim temp3
  1199. Dim temp4
  1200. Dim temp5
  1201. Dim temp6
  1202. Dim temp8
  1203. Dim temp9
  1204. Dim temp10
  1205. Dim temp11
  1206. Dim temp12
  1207. Dim temp13
  1208. Dim temp14
  1209. Dim temp15
  1210. Dim temp16
  1211. Dim temp17
  1212.  
  1213. Set FileObj = CreateObject("Scripting.FileSystemObject")
  1214. If Not FileObj.FolderExists(UserDirectory)then
  1215. Credits = 0
  1216. Exit Sub
  1217. End If
  1218. If Not FileObj.FileExists(UserDirectory & TableName& ".txt")then
  1219. Credits = 0
  1220. Exit Sub
  1221. End If
  1222. Set ScoreFile = FileObj.GetFile(UserDirectory & TableName& ".txt")
  1223. Set TextStr = ScoreFile.OpenAsTextStream(1, 0)
  1224. If(TextStr.AtEndOfStream = True)then
  1225. Exit Sub
  1226. End If
  1227. temp1 = TextStr.ReadLine
  1228. temp2 = textstr.readline
  1229.  
  1230. HighScore = cdbl(temp1)
  1231. If HighScore <1 then
  1232. temp8 = textstr.readline
  1233. temp9 = textstr.readline
  1234. temp10 = textstr.readline
  1235. temp11 = textstr.readline
  1236. temp12 = textstr.readline
  1237. temp13 = textstr.readline
  1238. temp14 = textstr.readline
  1239. temp15 = textstr.readline
  1240. temp16 = textstr.readline
  1241. temp17 = textstr.readline
  1242. End If
  1243. TextStr.Close
  1244. Credits = cdbl(temp2)
  1245.  
  1246. If HighScore <1 then
  1247. HSScore(1) = int(temp8)
  1248. HSScore(2) = int(temp9)
  1249. HSScore(3) = int(temp10)
  1250. HSScore(4) = int(temp11)
  1251. HSScore(5) = int(temp12)
  1252.  
  1253. HSName(1) = temp13
  1254. HSName(2) = temp14
  1255. HSName(3) = temp15
  1256. HSName(4) = temp16
  1257. HSName(5) = temp17
  1258. End If
  1259. Set ScoreFile = Nothing
  1260. Set FileObj = Nothing
  1261. SortHighscore 'added to fix a previous error
  1262. End Sub
  1263.  
  1264. Sub Savehs
  1265. ' Based on Black's Highscore routines
  1266. Dim FileObj
  1267. Dim ScoreFile
  1268. Dim xx
  1269. Set FileObj = CreateObject("Scripting.FileSystemObject")
  1270. If Not FileObj.FolderExists(UserDirectory)then
  1271. Exit Sub
  1272. End If
  1273. Set ScoreFile = FileObj.CreateTextFile(UserDirectory & TableName& ".txt", True)
  1274. ScoreFile.WriteLine 0
  1275. ScoreFile.WriteLine Credits
  1276. For xx = 1 to 5
  1277. scorefile.writeline HSScore(xx)
  1278. Next
  1279. For xx = 1 to 5
  1280. scorefile.writeline HSName(xx)
  1281. Next
  1282. ScoreFile.Close
  1283. Set ScoreFile = Nothing
  1284. Set FileObj = Nothing
  1285. End Sub
  1286.  
  1287. Sub SortHighscore
  1288. Dim tmp, tmp2, i, j
  1289. For i = 1 to 5
  1290. For j = 1 to 4
  1291. If HSScore(j) <HSScore(j + 1)Then
  1292. tmp = HSScore(j + 1)
  1293. tmp2 = HSName(j + 1)
  1294. HSScore(j + 1) = HSScore(j)
  1295. HSName(j + 1) = HSName(j)
  1296. HSScore(j) = tmp
  1297. HSName(j) = tmp2
  1298. End If
  1299. Next
  1300. Next
  1301. End Sub
  1302.  
  1303. '*******************
  1304. ' Realtime updates
  1305. '*******************
  1306.  
  1307. Sub GameTimer_Timer
  1308. RollingUpdate
  1309. LeftFlipperTop.RotZ = LeftFlipper.CurrentAngle
  1310. RightFlipperTop.RotZ = RightFlipper.CurrentAngle
  1311. dt1p.z = -(20 + dt1f.CurrentAngle)
  1312. dt2p.z = -(20 + dt2f.CurrentAngle)
  1313. End Sub
  1314.  
  1315. '***********************************************************************
  1316. ' *********************************************************************
  1317. ' ********* G A M E C O D E S T A R T S H E R E *********
  1318. ' *********************************************************************
  1319. '***********************************************************************
  1320.  
  1321. Sub VPObjects_Init 'init objects
  1322. TurnOffPlayfieldLights()
  1323. End Sub
  1324.  
  1325. ' Dim all the variables
  1326. Dim SpinValue
  1327.  
  1328. Sub Game_Init() 'called at the start of a new game
  1329. 'Start music?
  1330. 'Init variables?
  1331. SpinValue = 0
  1332. 'Start or init timers
  1333. 'Init lights?
  1334. TurnOffPlayfieldLights()
  1335. End Sub
  1336.  
  1337. Sub StopEndOfBallMode() 'called when the last ball is drained
  1338. End Sub
  1339.  
  1340. Sub ResetNewBallVariables() 'init variables new ball/player
  1341. BonusMultiplier = 1:UpdateMultiplierLights
  1342. Bonus = 1:UpdateBonusLights
  1343. ResetDropTargets
  1344. End Sub
  1345.  
  1346. Sub ResetNewBallLights() 'init lights for new ball/player
  1347. TurnOffPlayfieldLights
  1348. Light010.State = 1
  1349. light013.State = 1
  1350. light014.State = 1
  1351. light015.State = 1
  1352. UpdateSpin
  1353. End Sub
  1354.  
  1355. Sub TurnOffPlayfieldLights()
  1356. Dim a
  1357. For each a in aLights
  1358. a.State = 0
  1359. Next
  1360. End Sub
  1361.  
  1362. ' *********************************************************************
  1363. ' Table Object Hit Events
  1364. ' *********************************************************************
  1365. ' Any target hit Sub will do this:
  1366. ' - play a sound
  1367. ' - do some physical movement
  1368. ' - add a score, bonus
  1369. ' - check some variables/modes this trigger is a member of
  1370. ' - set the "LastSwicthHit" variable in case it is needed later
  1371. ' *********************************************************************
  1372.  
  1373. ' Slingshots
  1374. Dim LStep, RStep
  1375.  
  1376. Sub LeftSlingShot_Slingshot
  1377. If Tilted Then Exit Sub
  1378. PlaySoundAt SoundFXDOF("fx_slingshot", 103, DOFPulse, DOFContactors), Lemk
  1379. DOF 203,2
  1380. LeftSling4.Visible = 1
  1381. Lemk.RotX = 26
  1382. LStep = 0
  1383. LeftSlingShot.TimerEnabled = True
  1384. ' add points
  1385. AddScore 5000
  1386. ' some effect?
  1387. End Sub
  1388.  
  1389. Sub LeftSlingShot_Timer
  1390. Select Case LStep
  1391. Case 1:LeftSLing4.Visible = 0:LeftSLing3.Visible = 1:Lemk.RotX = 14
  1392. Case 2:LeftSLing3.Visible = 0:LeftSLing2.Visible = 1:Lemk.RotX = 2
  1393. Case 3:LeftSLing2.Visible = 0:Lemk.RotX = -20:LeftSlingShot.TimerEnabled = 0
  1394. End Select
  1395. LStep = LStep + 1
  1396. End Sub
  1397.  
  1398. Sub RightSlingShot_Slingshot
  1399. If Tilted Then Exit Sub
  1400. PlaySoundAt SoundFXDOF("fx_slingshot", 105, DOFPulse, DOFContactors), Remk
  1401. DOF 203,2
  1402. RightSling4.Visible = 1
  1403. Remk.RotX = 26
  1404. RStep = 0
  1405. RightSlingShot.TimerEnabled = True
  1406. ' add points
  1407. AddScore 100
  1408. ' add effect?
  1409. End Sub
  1410.  
  1411. Sub RightSlingShot_Timer
  1412. Select Case RStep
  1413. Case 1:RightSLing4.Visible = 0:RightSLing3.Visible = 1:Remk.RotX = 14
  1414. Case 2:RightSLing3.Visible = 0:RightSLing2.Visible = 1:Remk.RotX = 2
  1415. Case 3:RightSLing2.Visible = 0:Remk.RotX = -20:RightSlingShot.TimerEnabled = 0
  1416. End Select
  1417. RStep = RStep + 1
  1418. End Sub
  1419.  
  1420. '***********************
  1421. ' Rubbers
  1422. '***********************
  1423.  
  1424. Dim Rub10, Rub08, Rub07, Rub01, Rub04, Rub06
  1425.  
  1426. Sub RubberBand010_Hit
  1427. If Tilted then Exit Sub
  1428. AddScore 100
  1429. Rub10 = 1:RubberBand010_Timer
  1430. End Sub
  1431. Sub RubberBand010_Timer
  1432. Select Case Rub10
  1433. Case 1:r021.Visible = 0:r022.Visible = 1:RubberBand010.TimerEnabled = 1
  1434. Case 2:r022.Visible = 0:r023.Visible = 1
  1435. Case 3:r023.Visible = 0:r021.Visible = 1:RubberBand010.TimerEnabled = 0
  1436. End Select
  1437. Rub10 = Rub10 + 1
  1438. End Sub
  1439.  
  1440. Sub RubberBand008_Hit
  1441. If Tilted then Exit Sub
  1442. AddScore 100
  1443. Rub08 = 1:RubberBand008_Timer
  1444. End Sub
  1445. Sub RubberBand008_Timer
  1446. Select Case Rub08
  1447. Case 1:r018.Visible = 0:r019.Visible = 1:RubberBand008.TimerEnabled = 1
  1448. Case 2:r019.Visible = 0:r020.Visible = 1
  1449. Case 3:r020.Visible = 0:r018.Visible = 1:RubberBand008.TimerEnabled = 0
  1450. End Select
  1451. Rub08 = Rub08 + 1
  1452. End Sub
  1453.  
  1454. Sub RubberBand007_Hit
  1455. If Tilted then Exit Sub
  1456. AddScore 100
  1457. Rub07 = 1:RubberBand007_Timer
  1458. End Sub
  1459. Sub RubberBand007_Timer
  1460. Select Case Rub07
  1461. Case 1:r006.Visible = 0:r007.Visible = 1:RubberBand007.TimerEnabled = 1
  1462. Case 2:r007.Visible = 0:r008.Visible = 1
  1463. Case 3:r008.Visible = 0:r006.Visible = 1:RubberBand007.TimerEnabled = 0
  1464. End Select
  1465. Rub07 = Rub07 + 1
  1466. End Sub
  1467.  
  1468. Sub RubberBand001_Hit
  1469. If Tilted then Exit Sub
  1470. AddScore 100
  1471. Rub01 = 1:RubberBand001_Timer
  1472. End Sub
  1473. Sub RubberBand001_Timer
  1474. Select Case Rub01
  1475. Case 1:r015.Visible = 0:r016.Visible = 1:RubberBand001.TimerEnabled = 1
  1476. Case 2:r016.Visible = 0:r017.Visible = 1
  1477. Case 3:r017.Visible = 0:r015.Visible = 1:RubberBand001.TimerEnabled = 0
  1478. End Select
  1479. Rub01 = Rub01 + 1
  1480. End Sub
  1481.  
  1482. Sub RubberBand004_Hit
  1483. If Tilted then Exit Sub
  1484. AddScore 100
  1485. Rub04 = 1:RubberBand004_Timer
  1486. End Sub
  1487. Sub RubberBand004_Timer
  1488. Select Case Rub04
  1489. Case 1:r012.Visible = 0:r013.Visible = 1:RubberBand004.TimerEnabled = 1
  1490. Case 2:r013.Visible = 0:r014.Visible = 1
  1491. Case 3:r014.Visible = 0:r012.Visible = 1:RubberBand004.TimerEnabled = 0
  1492. End Select
  1493. Rub04 = Rub04 + 1
  1494. End Sub
  1495.  
  1496. Sub RubberBand006_Hit
  1497. If Tilted then Exit Sub
  1498. AddScore 100
  1499. Rub06 = 1:RubberBand006_Timer
  1500. End Sub
  1501. Sub RubberBand006_Timer
  1502. Select Case Rub06
  1503. Case 1:r009.Visible = 0:r010.Visible = 1:RubberBand006.TimerEnabled = 1
  1504. Case 2:r010.Visible = 0:r011.Visible = 1
  1505. Case 3:r011.Visible = 0:r009.Visible = 1:RubberBand006.TimerEnabled = 0
  1506. End Select
  1507. Rub06 = Rub06 + 1
  1508. End Sub
  1509.  
  1510. '*********
  1511. ' Bumpers
  1512. '*********
  1513.  
  1514. Sub Bumper001_Hit
  1515. If Tilted Then Exit Sub
  1516. PlaySoundAt SoundFXDOF("fx_Bumper",107,DOFPulse,DOFContactors), bumper001
  1517. AddScore 100 + 900 * LightBumper001.State
  1518. End Sub
  1519.  
  1520. Sub Bumper002_Hit
  1521. If Tilted Then Exit Sub
  1522. PlaySoundAt SoundFXDOF("fx_Bumper",109,DOFPulse,DOFContactors), bumper002
  1523. AddScore 100 + 900 * LightBumper002.State
  1524. End Sub
  1525.  
  1526. '*****************
  1527. ' Lanes
  1528. '*****************
  1529.  
  1530. ' top
  1531.  
  1532. Sub Trigger005_Hit
  1533. PlaySoundAt "fx_sensor", Trigger005
  1534. If Tilted Then Exit Sub
  1535. AddScore 5000 + 45000 * Light010.State
  1536. LightBumper001.State = Light010.State
  1537. LightBumper002.State = Light010.State
  1538. End Sub
  1539.  
  1540. Sub Trigger006_Hit
  1541. PlaySoundAt "fx_sensor", Trigger006
  1542. If Tilted Then Exit Sub
  1543. AddScore 50000 + 45000 * Light011.State
  1544. LightBumper001.State = Light011.State
  1545. LightBumper002.State = Light011.State
  1546. End Sub
  1547.  
  1548. ' top buttons
  1549.  
  1550. Sub Trigger011_Hit 'left button
  1551. PlaySoundAt "fx_sensor", Trigger011
  1552. If Tilted Then Exit Sub
  1553. Addscore 100
  1554. AddBonus 1
  1555. light010.State = 0
  1556. light011.State = 1
  1557. End Sub
  1558.  
  1559. Sub Trigger012_Hit 'right button
  1560. PlaySoundAt "fx_sensor", Trigger012
  1561. If Tilted Then Exit Sub
  1562. Addscore 100
  1563. AddBonus 1
  1564. light010.State = 1
  1565. light011.State = 0
  1566. End Sub
  1567.  
  1568. ' side lanes
  1569.  
  1570. Sub Trigger008_Hit
  1571. PlaySoundAt "fx_sensor", Trigger008
  1572. If Tilted Then Exit Sub
  1573. AddScore 5000
  1574. If Light008.State Then BonusMultiplier = 3:UpdateMultiplierLights
  1575. End Sub
  1576.  
  1577. Sub Trigger007_Hit
  1578. PlaySoundAt "fx_sensor", Trigger007
  1579. If Tilted Then Exit Sub
  1580. AddScore 5000
  1581. If Light006.State Then AddBonus 1
  1582. End Sub
  1583.  
  1584. Sub Trigger010_Hit
  1585. PlaySoundAt "fx_sensor", Trigger010
  1586. If Tilted Then Exit Sub
  1587. AddScore 5000
  1588. If Light007.State Then AddBonus 1
  1589. End Sub
  1590.  
  1591. Sub Trigger009_Hit
  1592. PlaySoundAt "fx_sensor", Trigger009
  1593. If Tilted Then Exit Sub
  1594. AddScore 5000 + 45000 * Light016.State
  1595. End Sub
  1596.  
  1597. ' outlanes
  1598.  
  1599. Sub Trigger001_Hit
  1600. PlaySoundAt "fx_sensor", Trigger001
  1601. If Tilted Then Exit Sub
  1602. AddScore 5000 + 45000 * Light001.State
  1603. End Sub
  1604.  
  1605. Sub Trigger004_Hit
  1606. PlaySoundAt "fx_sensor", Trigger004
  1607. If Tilted Then Exit Sub
  1608. AddScore 5000
  1609. 'check?
  1610. If light002.State Then BonusMultiplier = 3:UpdateMultiplierLights
  1611. End Sub
  1612.  
  1613. ' inlanes
  1614.  
  1615. Sub Trigger002_Hit
  1616. PlaySoundAt "fx_sensor", Trigger002
  1617. If Tilted Then Exit Sub
  1618. AddScore 5000
  1619. AddBonus 1
  1620. End Sub
  1621.  
  1622. Sub Trigger003_Hit
  1623. PlaySoundAt "fx_sensor", Trigger003
  1624. If Tilted Then Exit Sub
  1625. AddScore 5000
  1626. AddBonus 1
  1627. End Sub
  1628.  
  1629. '************************
  1630. ' Targets
  1631. '************************
  1632.  
  1633. Sub Target006_hit 'center target
  1634. PlaySoundAtBall SoundFXDOF("fx_target", 123, DOFPulse, DOFTargets)
  1635. If Tilted Then Exit Sub
  1636. AddScore 1000
  1637. AddBonus 1
  1638. If light022.State Then AwardSpecial
  1639. If light023.State Then AwardSpin
  1640. End Sub
  1641.  
  1642. Sub AwardSpin
  1643. Select Case SpinValue
  1644. Case 0:Addscore 6000
  1645. Case 1:AwardExtraBall
  1646. Case 2:Addscore 6000
  1647. Case 3
  1648. If BonusMultiplier = 2 then
  1649. light008.state = 1:light002.State = 1
  1650. Else
  1651. light016.state = 1:light001.State = 1
  1652. End If
  1653. Case 4:Addscore 6000
  1654. Case 5
  1655. If BonusMultiplier = 2 then
  1656. light008.state = 1:light002.State = 1
  1657. Else
  1658. light016.state = 1:light001.State = 1
  1659. End If
  1660. Case 6:Addscore 6000
  1661. Case 7:AwardExtraBall
  1662. Case 8:Addscore 6000
  1663. End Select
  1664. End Sub
  1665.  
  1666. 'ABC targets
  1667.  
  1668. Sub Target001_hit 'center target
  1669. PlaySoundAtBall SoundFXDOF("fx_target", 123, DOFPulse, DOFTargets)
  1670. If Tilted Then Exit Sub
  1671. AddScore 1000
  1672. light013.State = 0
  1673. CheckABC
  1674. End Sub
  1675.  
  1676. Sub Target002_hit 'center target
  1677. PlaySoundAtBall SoundFXDOF("fx_target", 123, DOFPulse, DOFTargets)
  1678. If Tilted Then Exit Sub
  1679. AddScore 1000
  1680. light014.State = 0
  1681. CheckABC
  1682. End Sub
  1683.  
  1684. Sub Target003_hit 'center target
  1685. PlaySoundAtBall SoundFXDOF("fx_target", 123, DOFPulse, DOFTargets)
  1686. If Tilted Then Exit Sub
  1687. AddScore 1000
  1688. light015.State = 0
  1689. CheckABC
  1690. End Sub
  1691.  
  1692. Sub CheckABC
  1693. If light013.State + light014.State + light015.State = 0 Then 'double bonus
  1694. If BonusMultiplier = 1 Then
  1695. BonusMultiplier = 2
  1696. UpdateMultiplierLights
  1697. End If
  1698. End If
  1699. End Sub
  1700.  
  1701. '************************
  1702. ' Drop Targets
  1703. '************************
  1704.  
  1705. Sub dt1_Hit
  1706. PlaySoundAt SoundFXDOF("fx_droptarget", 124, DOFPulse, DOFDroptargets), dt1p
  1707. If Tilted Then Exit Sub
  1708. AddScore 10000
  1709. dt1.Isdropped = 1:dt1f.RotateToEnd
  1710. light006.State = 1
  1711. If dt2.Isdropped Then light023.State = 1
  1712. End Sub
  1713.  
  1714. Sub dt2_Hit
  1715. PlaySoundAt SoundFXDOF("fx_droptarget", 124, DOFPulse, DOFDroptargets), dt2p
  1716. If Tilted Then Exit Sub
  1717. AddScore 10000
  1718. dt2.Isdropped = 1:dt2f.RotateToEnd
  1719. light007.State = 1
  1720. If dt1.Isdropped Then light023.State = 1
  1721. End Sub
  1722.  
  1723. Sub ResetDropTargets
  1724. PlaySound SoundFXDOF("fx_resetdrop", 111, DOFPulse, DOFContactors)
  1725. dt1.Isdropped = 0:dt1f.RotateToStart
  1726. dt2.Isdropped = 0:dt2f.RotateToStart
  1727. End Sub
  1728.  
  1729. '************
  1730. ' Spinners
  1731. '************
  1732.  
  1733. Sub Spinner1_Spin
  1734. PlaySoundAt SoundFXDOF("fx_spinner", 122, DOFPulse, DOFShaker), Spinner1
  1735. If Tilted Then Exit Sub
  1736. SpinValue = (SpinValue + 1)MOD 9
  1737. UpdateSpin
  1738. End Sub
  1739.  
  1740. Sub Spinner2_Spin
  1741. PlaySoundAt SoundFXDOF("fx_spinner", 122, DOFPulse, DOFShaker), Spinner2
  1742. If Tilted Then Exit Sub
  1743. SpinValue = (SpinValue + 1)MOD 9
  1744. UpdateSpin
  1745. End Sub
  1746.  
  1747. Sub UpdateSpin
  1748. Select Case SpinValue
  1749. Case 0:light017.State = 1:light018.State = 0:light019.State = 0:light020.State = 0:light021.State = 0:light024.State = 0:light025.State = 0:light026.State = 0:light027.State = 0
  1750. Case 1:light017.State = 0:light018.State = 1:light019.State = 0:light020.State = 0:light021.State = 0:light024.State = 0:light025.State = 0:light026.State = 0:light027.State = 0
  1751. Case 2:light017.State = 0:light018.State = 0:light019.State = 1:light020.State = 0:light021.State = 0:light024.State = 0:light025.State = 0:light026.State = 0:light027.State = 0
  1752. Case 3:light017.State = 0:light018.State = 0:light019.State = 0:light020.State = 1:light021.State = 0:light024.State = 0:light025.State = 0:light026.State = 0:light027.State = 0
  1753. Case 4:light017.State = 0:light018.State = 0:light019.State = 0:light020.State = 0:light021.State = 1:light024.State = 0:light025.State = 0:light026.State = 0:light027.State = 0
  1754. Case 5:light017.State = 0:light018.State = 0:light019.State = 0:light020.State = 0:light021.State = 0:light024.State = 1:light025.State = 0:light026.State = 0:light027.State = 0
  1755. Case 6:light017.State = 0:light018.State = 0:light019.State = 0:light020.State = 0:light021.State = 0:light024.State = 0:light025.State = 1:light026.State = 0:light027.State = 0
  1756. Case 7:light017.State = 0:light018.State = 0:light019.State = 0:light020.State = 0:light021.State = 0:light024.State = 0:light025.State = 0:light026.State = 1:light027.State = 0
  1757. Case 8:light017.State = 0:light018.State = 0:light019.State = 0:light020.State = 0:light021.State = 0:light024.State = 0:light025.State = 0:light026.State = 0:light027.State = 1
  1758. End Select
  1759. End Sub
  1760.  
  1761. ' ***************************************************
  1762. ' GNMOD - Multiple High Score Display and Collection
  1763. ' jpsalas: changed ramps by flashers
  1764. ' ***************************************************
  1765.  
  1766. Dim EnteringInitials ' Normally zero, set to non-zero to enter initials
  1767. EnteringInitials = False
  1768. Dim ScoreChecker
  1769. ScoreChecker = 0
  1770. Dim CheckAllScores
  1771. CheckAllScores = 0
  1772. Dim sortscores(4)
  1773. Dim sortplayers(4)
  1774.  
  1775. Dim PlungerPulled
  1776. PlungerPulled = 0
  1777.  
  1778. Dim SelectedChar ' character under the "cursor" when entering initials
  1779.  
  1780. Dim HSTimerCount ' Pass counter For HS timer, scores are cycled by the timer
  1781. HSTimerCount = 5 ' Timer is initially enabled, it'll wrap from 5 to 1 when it's displayed
  1782.  
  1783. Dim InitialString ' the string holding the player's initials as they're entered
  1784.  
  1785. Dim AlphaString ' A-Z, 0-9, space (_) and backspace (<)
  1786. Dim AlphaStringPos ' pointer to AlphaString, move Forward and backward with flipper keys
  1787. AlphaString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_<"
  1788.  
  1789. Dim HSNewHigh ' The new score to be recorded
  1790.  
  1791. Dim HSScore(5) ' High Scores read in from config file
  1792. Dim HSName(5) ' High Score Initials read in from config file
  1793.  
  1794. ' default high scores, remove this when the scores are available from the config file
  1795. HSScore(1) = 250000
  1796. HSScore(2) = 240000
  1797. HSScore(3) = 230000
  1798. HSScore(4) = 220000
  1799. HSScore(5) = 210000
  1800.  
  1801. HSName(1) = "AAA"
  1802. HSName(2) = "ZZZ"
  1803. HSName(3) = "XXX"
  1804. HSName(4) = "ABC"
  1805. HSName(5) = "BBB"
  1806.  
  1807. Sub HighScoreTimer_Timer
  1808. If EnteringInitials then
  1809. If HSTimerCount = 1 then
  1810. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  1811. HSTimerCount = 2
  1812. Else
  1813. SetHSLine 3, InitialString
  1814. HSTimerCount = 1
  1815. End If
  1816. ElseIf bGameInPlay then
  1817. SetHSLine 1, "HIGH SCORE1"
  1818. SetHSLine 2, HSScore(1)
  1819. SetHSLine 3, HSName(1)
  1820. HSTimerCount = 5 ' set so the highest score will show after the game is over
  1821. HighScoreTimer.enabled = false
  1822. ElseIf CheckAllScores then
  1823. NewHighScore sortscores(ScoreChecker), sortplayers(ScoreChecker)
  1824. Else
  1825. ' cycle through high scores
  1826. HighScoreTimer.interval = 2000
  1827. HSTimerCount = HSTimerCount + 1
  1828. If HsTimerCount> 5 then
  1829. HSTimerCount = 1
  1830. End If
  1831. SetHSLine 1, "HIGH SCORE" + FormatNumber(HSTimerCount, 0)
  1832. SetHSLine 2, HSScore(HSTimerCount)
  1833. SetHSLine 3, HSName(HSTimerCount)
  1834. End If
  1835. End Sub
  1836.  
  1837. Function GetHSChar(String, Index)
  1838. Dim ThisChar
  1839. Dim FileName
  1840. ThisChar = Mid(String, Index, 1)
  1841. FileName = "PostIt"
  1842. If ThisChar = " " or ThisChar = "" then
  1843. FileName = FileName & "BL"
  1844. ElseIf ThisChar = "<" then
  1845. FileName = FileName & "LT"
  1846. ElseIf ThisChar = "_" then
  1847. FileName = FileName & "SP"
  1848. Else
  1849. FileName = FileName & ThisChar
  1850. End If
  1851. GetHSChar = FileName
  1852. End Function
  1853.  
  1854. Sub SetHsLine(LineNo, String)
  1855. Dim Letter
  1856. Dim ThisDigit
  1857. Dim ThisChar
  1858. Dim StrLen
  1859. Dim LetterLine
  1860. Dim Index
  1861. Dim StartHSArray
  1862. Dim EndHSArray
  1863. Dim LetterName
  1864. Dim xFor
  1865. StartHSArray = array(0, 1, 12, 22)
  1866. EndHSArray = array(0, 11, 21, 31)
  1867. StrLen = len(string)
  1868. Index = 1
  1869.  
  1870. For xFor = StartHSArray(LineNo)to EndHSArray(LineNo)
  1871. Eval("HS" &xFor).imageA = GetHSChar(String, Index)
  1872. Index = Index + 1
  1873. Next
  1874. End Sub
  1875.  
  1876. Sub NewHighScore(NewScore, PlayNum)
  1877. If NewScore> HSScore(5)then
  1878. HighScoreTimer.interval = 500
  1879. HSTimerCount = 1
  1880. AlphaStringPos = 1 ' start with first character "A"
  1881. EnteringInitials = true ' intercept the control keys while entering initials
  1882. InitialString = "" ' initials entered so far, initialize to empty
  1883. SetHSLine 1, "PLAYER " + FormatNumber(PlayNum, 0)
  1884. SetHSLine 2, "ENTER NAME"
  1885. SetHSLine 3, MID(AlphaString, AlphaStringPos, 1)
  1886. HSNewHigh = NewScore
  1887. 'AwardSpecial
  1888. End If
  1889. ScoreChecker = ScoreChecker-1
  1890. If ScoreChecker = 0 then
  1891. CheckAllScores = 0
  1892. End If
  1893. End Sub
  1894.  
  1895. Sub CollectInitials(keycode)
  1896. Dim i
  1897. If keycode = LeftFlipperKey Then
  1898. ' back up to previous character
  1899. AlphaStringPos = AlphaStringPos - 1
  1900. If AlphaStringPos <1 then
  1901. AlphaStringPos = len(AlphaString) ' handle wrap from beginning to End
  1902. If InitialString = "" then
  1903. ' Skip the backspace If there are no characters to backspace over
  1904. AlphaStringPos = AlphaStringPos - 1
  1905. End If
  1906. End If
  1907. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  1908. PlaySound "fx_Previous"
  1909. ElseIf keycode = RightFlipperKey Then
  1910. ' advance to Next character
  1911. AlphaStringPos = AlphaStringPos + 1
  1912. If AlphaStringPos> len(AlphaString)or(AlphaStringPos = len(AlphaString)and InitialString = "")then
  1913. ' Skip the backspace If there are no characters to backspace over
  1914. AlphaStringPos = 1
  1915. End If
  1916. SetHSLine 3, InitialString & MID(AlphaString, AlphaStringPos, 1)
  1917. PlaySound "fx_Next"
  1918. ElseIf keycode = StartGameKey or keycode = PlungerKey Then
  1919. SelectedChar = MID(AlphaString, AlphaStringPos, 1)
  1920. If SelectedChar = "_" then
  1921. InitialString = InitialString & " "
  1922. PlaySound("fx_Esc")
  1923. ElseIf SelectedChar = "<" then
  1924. InitialString = MID(InitialString, 1, len(InitialString)- 1)
  1925. If len(InitialString) = 0 then
  1926. ' If there are no more characters to back over, don't leave the < displayed
  1927. AlphaStringPos = 1
  1928. End If
  1929. PlaySound("fx_Esc")
  1930. Else
  1931. InitialString = InitialString & SelectedChar
  1932. PlaySound("fx_Enter")
  1933. End If
  1934. If len(InitialString) <3 then
  1935. SetHSLine 3, InitialString & SelectedChar
  1936. End If
  1937. End If
  1938. If len(InitialString) = 3 then
  1939. ' save the score
  1940. For i = 5 to 1 step -1
  1941. If i = 1 or(HSNewHigh> HSScore(i)and HSNewHigh <= HSScore(i - 1))then
  1942. ' Replace the score at this location
  1943. If i <5 then
  1944. HSScore(i + 1) = HSScore(i)
  1945. HSName(i + 1) = HSName(i)
  1946. End If
  1947. EnteringInitials = False
  1948. HSScore(i) = HSNewHigh
  1949. HSName(i) = InitialString
  1950. HSTimerCount = 5
  1951. HighScoreTimer_Timer
  1952. HighScoreTimer.interval = 2000
  1953. PlaySound("fx_Bong")
  1954. Exit Sub
  1955. ElseIf i <5 then
  1956. ' move the score in this slot down by 1, it's been exceeded by the new score
  1957. HSScore(i + 1) = HSScore(i)
  1958. HSName(i + 1) = HSName(i)
  1959. End If
  1960. Next
  1961. End If
  1962. End Sub
  1963. ' End GNMOD
Add Comment
Please, Sign In to add comment