Advertisement
66dude

Spanish Eyes VBS script

Apr 29th, 2025 (edited)
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Const cGameName = "spanisheyes_1972"
  4.  
  5. On Error Resume Next
  6. ExecuteGlobal GetTextFile("controller.vbs")
  7. If Err Then MsgBox "You need the controller.vbs"
  8. On Error Goto 0
  9.  
  10.  
  11. Dim Digit(5)
  12. Dim Lane(5)
  13. Dim Target(6)
  14. Dim TLight(12)
  15. Dim LLight(5)
  16. Dim RLight(5)
  17. Dim ALight(4)
  18. Dim BLight(4)
  19. Dim HighScore
  20. Dim Score
  21.  
  22. Set TLight(1)=Light1a
  23. Set TLight(2)=Light2a
  24. Set TLight(3)=Light3a
  25. Set TLight(4)=Light4a
  26. Set TLight(5)=Light5a
  27. Set TLight(6)=Light6a
  28. Set TLight(7)=Light1b
  29. Set TLight(8)=Light2b
  30. Set TLight(9)=Light3b
  31. Set TLight(10)=Light4b
  32. Set TLight(11)=Light5b
  33. Set TLight(12)=Light6b
  34.  
  35. Set LLight(1)=LightA
  36. Set LLight(2)=LightB
  37. Set LLight(3)=LightC
  38. Set LLight(4)=LightD
  39. Set LLight(5)=LightE
  40.  
  41. Set RLight(1)=RollLight1
  42. Set RLight(2)=RollLight2
  43. Set RLight(3)=RollLight3
  44. Set RLight(4)=RollLight4
  45. Set RLight(5)=RollLight5
  46.  
  47. Set BLight(1)=Bumperl1
  48. Set BLight(2)=Bumperl2
  49. Set BLight(3)=Bumperl3
  50. Set BLight(4)=Bumperl4
  51.  
  52. Set ALight(1)=LoopLight1
  53. Set ALight(2)=LoopLight2
  54. Set ALight(3)=LeftLaneLight
  55. Set ALight(4)=RightLaneLight
  56.  
  57. Dim Credits
  58. Dim BallsToPlay
  59. Dim GotReplay
  60. Dim GotSpecial
  61. Dim GotAddA
  62. Dim GotAddB
  63. Dim GameType
  64. Dim HolePause
  65. Dim BallOut
  66. Dim BallActive
  67. Dim ThouMove
  68. Dim HunMove
  69. Dim TenMove
  70. Dim DigitClock
  71. Dim DigitDo
  72. Dim TargetDone
  73. Dim LanesDone
  74. Dim BumpOn
  75. Dim CreditPause
  76. Dim TiltSensor
  77. Dim MachineTilt
  78. Dim ResetPause
  79. Dim Got100K
  80.  
  81. Dim f,g,h
  82.  
  83. Randomize
  84.  
  85. Sub GameTimer_Timer
  86.  
  87.     If TiltSensor>99 and MachineTilt=0 and BallActive=1 then
  88.         PlaySound "Tilt"
  89.         TiltBox.Text="TILT"
  90.         If B2SOn Then Controller.B2SSetTilt 33,1
  91.         MachineTilt=1
  92. '       TargetDone=0
  93. '       LanesDone=0
  94.         TenMove=0
  95.         HunMove=0
  96.         ThouMove=0
  97.         for f=1 to 4
  98.             EVAL("Bumper"&f).hashitevent = 0
  99.         Next
  100.         LightSeqTilt.Play SeqAllOff
  101.     End If
  102.     If TiltSensor>0 then
  103.         TiltSensor=TiltSensor-1
  104.     End If
  105.  
  106.     If ResetPause>0 then
  107.         ResetPause=ResetPause-1
  108.         If ResetPause<55 and ResetPause>0 and ResetPause/6=int(ResetPause/6)then
  109.             For f=1 to 5
  110.                 If Digit(f)>0 then Digit(f)=Digit(f)-1
  111.             Next
  112.             Digit1.Text=Digit(1)
  113.             Digit2.Text=Digit(2)
  114.             Digit3.Text=Digit(3)
  115.             Digit4.Text=Digit(4)
  116.             Digit5.Text=Digit(5)
  117.         End If
  118.         If ResetPause=1 then
  119.             BallOut=50
  120.             BallsToPlay=5
  121.             If B2SOn then
  122.                 Controller.B2SSetGameOver 35,0
  123.                 Controller.B2SSetTilt 33,0
  124.                 Controller.B2SSetMatch 34,0
  125.                 Controller.B2SSetScorePlayer 1, 0
  126.                 Controller.B2ssetballinplay 32, BallsToPlay
  127.                 Controller.B2SSetScorePlayer 5, HighScore
  128.             End If
  129.             For f=1 to 6
  130.                 Target(f)=0
  131.             Next
  132.             For f=1 to 5
  133.                 Lane(f)=0
  134.             Next
  135.             TargetDone=0
  136.             LanesDone=0
  137.             NewBall
  138.         End If
  139.     End If
  140.  
  141.     If CreditPause>0 then
  142.         CreditPause=CreditPause-1
  143.         If CreditPause=0 then
  144.             If Credits<9 then
  145.                 Credits=Credits+1
  146.                 DOF 121, DOFOn
  147.                 CreditLight.state=1
  148.                 CreditBox.Text=Credits
  149.                 If B2SOn Then Controller.B2ssetCredits Credits
  150.             End If
  151.         End If
  152.     End If
  153.  
  154.     If HolePause>0 then
  155.         HolePause=HolePause-1
  156.         If HolePause=0 then
  157.             Hole.Kick 160, 10
  158.             PlaySound SoundFXDOF("popper_ball",119,DOFPulse,DOFContactors)
  159.             DOF 120, DOFPulse
  160.         End If
  161.     End If
  162.  
  163.     DigitDo=0
  164.     If TenMove>0 then DigitDo=4
  165.     If HunMove>0 then DigitDo=3
  166.     If ThouMove>0 then DigitDo=2
  167.     If DigitClock>0 then
  168.         DigitClock=DigitClock-1
  169.         DigitDo=0
  170.     End If
  171.  
  172.     If DigitDo>0 then
  173.     If DigitDo=4 then
  174.         Digit(4)=Digit(4)+1
  175.         PlaySound SoundFXDOF("Bell10",141,DOFPulse,DOFChimes)
  176.         TenMove=TenMove-1
  177.         DigitClock=5
  178.     End If
  179.     If DigitDo=3 then
  180.         Digit(3)=Digit(3)+1
  181.         PlaySound SoundFXDOF("Bell100",142,DOFPulse,DOFChimes)
  182.         HunMove=HunMove-1
  183.         DigitClock=5
  184.     End If
  185.     If DigitDo=2 then
  186.         Digit(2)=Digit(2)+1
  187.         PlaySound SoundFXDOF("Bell1000",143,DOFPulse,DOFChimes)
  188.         ThouMove=ThouMove-1
  189.         DigitClock=5
  190.     End If
  191.     If Digit(4)>9 then
  192.         Digit(4)=Digit(4)-10
  193.         Digit(3)=Digit(3)+1
  194.     End If
  195.     If Digit(3)>9 then
  196.         Digit(3)=Digit(3)-10
  197.         Digit(2)=Digit(2)+1
  198.     End If
  199.     If Digit(2)>9 then
  200.         Digit(2)=Digit(2)-10
  201.         Digit(1)=Digit(1)+1
  202.     End If
  203.         If Digit(1)>9 then
  204.         Digit(1)=Digit(1)-10
  205.         Got100K=Got100K+1
  206.         OTTBox.Text=Got100K*100000
  207.         if b2son then Controller.B2SSetScoreRollover 25, 1
  208.     End If
  209.     Digit1.Text=Digit(1)
  210.     Digit2.Text=Digit(2)
  211.     Digit3.Text=Digit(3)
  212.     Digit4.Text=Digit(4)
  213.     Digit5.Text=Digit(5)
  214.     If B2SOn Then
  215.         Controller.B2SSetReel 1, Digit(1)
  216.         Controller.B2SSetReel 2, Digit(2)
  217.         Controller.B2SSetReel 3, Digit(3)
  218.         Controller.B2SSetReel 4, Digit(4)
  219.         Controller.B2SSetReel 5, Digit(5)
  220.     End If
  221.     DigitDo=0
  222.         If Got100K=0 and GameType=2 and Digit(2)>4 then
  223.         If Digit(1)>4+(GotReplay*2) then
  224.         GotReplay=GotReplay+1
  225.         PlaySound SoundFXDOF("Knocker",122,DOFPulse,DOFKnocker)
  226.         DOF 120, DOFPulse
  227.         If Credits<9 then Credits=Credits+1:DOF 121, DOFOn
  228.         CreditLight.state=1
  229.         CreditBox.Text=Credits
  230.         If B2SOn Then Controller.B2ssetCredits Credits
  231.         End If
  232.         End If
  233.     End If
  234.  
  235.     If BallOut>0 then
  236.         BallOut=BallOut-1
  237. '       If TargetDone>0 and BallOut=50+(TargetDone*11) then
  238. '           TargetDone=TargetDone-1
  239. '           ThouMove=ThouMove+1
  240. '           f=0
  241. '           For g=7 to 12
  242. '           If f=0 and TLight(g).State=LightStateOn then
  243. '               TLight(g).State=LightStateOff
  244. '               f=1
  245. '           End If
  246. '           Next
  247. '       End If
  248.  
  249.         If BallOut=49 then
  250.             If BallsToPlay>0 then
  251.                 PlaySound "NewBall"
  252.                 DisplayBalls
  253.             Else
  254.                 Score=Score+ (Got100k * 100000)
  255.                 Score=Score+ (Digit(1)*10000)
  256.                 Score=Score+ (Digit(2)*1000)
  257.                 Score=Score+ (Digit(3)*100)
  258.                 Score=Score+ (Digit(4)*10)
  259.                 Score=Score+ Digit(5)
  260.                 If score>HighScore Then
  261.                     HighScore=score
  262.                     SaveValue "SpEyes","HS",HighScore
  263.                     Sbest.Text=FormatNumber(HighScore, 0, -1, 0, -1)
  264.                 End if
  265.                 BallBox1.Text=""
  266.                 GameOverBox.Text="GAME OVER"
  267.                   If b2son then
  268.                     Controller.B2SSetGameOver 35,1
  269.                     Controller.B2ssetballinplay 32, 0
  270.                     Controller.B2ssetPlayerUp 30, 0
  271.                     Controller.B2SSetScorePlayer 5, HighScore
  272.                   End If
  273.                 AllLightsOff
  274.             End If
  275.         End If
  276.        
  277.         If BallOut=1 then
  278.             If BallsToPlay>0 then
  279.                 BallActive=1
  280.                 DOF 135, DOFPulse
  281.                 BallKicker.CreateBall.image="pinball"
  282.                 BallKicker.Kick 100,5
  283.                 NewBall
  284.              Else
  285.                 BallActive=0
  286.     '           AllLightsOff
  287.                 If GameType=2 then
  288.                     f=int(rnd*10)
  289.                     MatchBox2.Text="0"
  290.                     MatchBox1.Text=f
  291.                     If b2son then
  292.                         if f=0 then
  293.                             Controller.B2SSetMatch 34,100
  294.                           Else
  295.                             Controller.B2SSetMatch 34,f*10
  296.                         End If
  297.                     End If
  298.                     If f=Digit(4) then
  299.                         PlaySound SoundFXDOF("Knocker",122,DOFPulse,DOFKnocker)
  300.                         DOF 120, DOFPulse
  301.                         If Credits<9 then Credits=Credits+1:DOF 121, DOFOn
  302.                         CreditLight.state=1
  303.                         CreditBox.Text=Credits
  304.                         If B2SOn Then Controller.B2ssetCredits Credits
  305.                     End If
  306.                 End If
  307.             End If
  308.         End If
  309.        
  310.     End If
  311.  
  312. End Sub
  313.  
  314. Sub SpEyes_KeyDown(ByVal keycode)
  315.  
  316.  
  317.     If keycode = PlungerKey Then
  318.         Plunger.PullBack
  319.         PlaySound "plungerpull",0,1,0.25,0.25
  320.     End If
  321.  
  322.     If keycode = LeftFlipperKey and MachineTilt=0 and BallActive=1 Then
  323.         LeftFlipper.RotateToEnd
  324.         PlaySound SoundFXDOF("fx_FlipperUp",101,DOFOn,DOFContactors), 0, .67, -0.05, 0.05
  325.         PlaySound "Buzz",-1,.05,-0.05, 0.05
  326.     End If
  327.    
  328.     If keycode = RightFlipperKey and MachineTilt=0 and BallActive=1 Then
  329.         RightFlipper.RotateToEnd
  330.         PlaySound SoundFXDOF("fx_FlipperUp",102,DOFOn,DOFContactors), 0, .67, 0.05, 0.05
  331.         PlaySound "Buzz1",-1,.05,0.05,0.05
  332.     End If
  333.    
  334.     If keycode = LeftTiltKey and MachineTilt=0 and BallActive=1 Then
  335.         Nudge 90, 2
  336.         TiltSensor=TiltSensor+50
  337.     End If
  338.    
  339.     If keycode = RightTiltKey and MachineTilt=0 and BallActive=1 Then
  340.         Nudge 270, 2
  341.         TiltSensor=TiltSensor+50
  342.     End If
  343.    
  344.     If keycode = CenterTiltKey and MachineTilt=0 and BallActive=1Then
  345.         Nudge 0, 2
  346.         TiltSensor=TiltSensor+50
  347.     End If
  348.    
  349.     If keycode=AddCreditKey and CreditPause=0 and Credits<9 then
  350.         CreditLight.state=1
  351.         PlaySound "CoinIn"
  352.         CreditPause=60
  353.     End If
  354.    
  355.     If keycode=StartGameKey and BallActive=0 then  
  356.         If Credits>0 then
  357.             BallActive=2
  358.             Credits=Credits-1
  359.             If Credits < 1 Then DOF 121, DOFOff
  360.             If credits=0 then creditlight.state=0
  361.             Score=0
  362.             CreditBox.Text=Credits
  363.             If B2SOn Then
  364.                 Controller.B2ssetCredits Credits
  365.                 Controller.B2ssetplayerup 30, 1
  366.                 Controller.B2SSetGameOver 0
  367.                 Controller.B2SSetScoreRollover 25, 0
  368.                 Controller.B2SSetScorePlayer 5, HighScore
  369.             End If
  370.             TargetDone=0
  371.             AllLightsOff
  372.             MatchBox1.Text=""
  373.             MatchBox2.Text=""
  374.             OTTBox.Text=""
  375.             GameOverBox.Text=""
  376.             Got100K=0
  377.             GotReplay=0
  378.             ResetPause=400
  379.             PlaySound "Reset"
  380.         End If
  381.     End If
  382.  
  383.     'If keycode=10 and BallActive=0 and GameType=2 then
  384.     '   GameType=1
  385.     '   PlaySound "TargetsUp"
  386.     '   AddWall1.IsDropped=False
  387.     '   AddWall2.IsDropped=False
  388.         'AddWall3.IsDropped=False
  389.     ''  AddWall4.IsDropped=True
  390.     'End If
  391.  
  392.     'If keycode=11 and BallActive=0 and GameType=1 then
  393.     '   GameType=2
  394.     '   PlaySound "TargetsUp"
  395.     '   AddWall1.IsDropped=True
  396.     '   AddWall2.IsDropped=True
  397.     '   AddWall3.IsDropped=True
  398.     '   AddWall4.IsDropped=False
  399.     'End If
  400.    
  401. End Sub
  402.  
  403. Sub SpEyes_KeyUp(ByVal keycode)
  404.  
  405.     If keycode = PlungerKey Then
  406.         Plunger.Fire
  407.         PlaySound "plunger",0,1,0.25,0.25
  408.     End If
  409.    
  410.     If keycode = LeftFlipperKey Then
  411.         LeftFlipper.RotateToStart
  412.         If MachineTilt=0 and BallActive=1 Then PlaySound SoundFXDOF("fx_flipperdown",101,DOFOff,DOFContactors), 0, 1, -0.05, 0.05
  413.         StopSound "Buzz"
  414.     End If
  415.    
  416.     If keycode = RightFlipperKey Then
  417.         RightFlipper.RotateToStart
  418.         If MachineTilt=0 and BallActive=1 Then PlaySound SoundFXDOF("fx_flipperdown",102,DOFOff,DOFContactors), 0, 1, 0.05, 0.05
  419.         StopSound "Buzz1"
  420.     End If
  421.  
  422. End Sub
  423.  
  424. Sub Drain_Hit()
  425.     PlaySound "Drain"
  426.     DOF 134, DOFPulse
  427.     BallOut=100+(TargetDone*11)+(ThouMove*6)+(HunMove*6)+(TenMove*6)
  428.     Drain.DestroyBall
  429.     BallstoPlay = Ballstoplay - 1
  430.     BallActive=2
  431.     If MachineTilt=1 then
  432.         For f=1 to 6
  433.             If Target(f)=1 then TLight(f+6).State=LightStateOn
  434.         Next
  435.         for f=1 to 4
  436.             EVAL("Bumper"&f).hashitevent = 1
  437.         Next
  438.         LightSeqTilt.StopPlay
  439.     End If
  440. End Sub
  441.  
  442. Sub ShooterLane_Unhit()
  443.     DOF 136, DOFPulse
  444. End Sub
  445.  
  446. Sub Sling1_Slingshot()
  447.     PlaySound SoundFXDOF("Sling",103,DOFPulse,DOFContactors)
  448.     DOF 104, DOFPulse
  449.     If MachineTilt=0 then TenMove=TenMove+1
  450. End Sub
  451.  
  452. Sub Sling2_Slingshot()
  453.     PlaySound SoundFXDOF("Sling",107,DOFPulse,DOFContactors)
  454.     If MachineTilt=0 then TenMove=TenMove+1
  455. End Sub
  456.  
  457. Sub Sling3_Slingshot()
  458.     PlaySound SoundFXDOF("Sling",109,DOFPulse,DOFContactors)
  459.     If MachineTilt=0 then TenMove=TenMove+1
  460. End Sub
  461.  
  462. Sub Sling4_Slingshot()
  463.     PlaySound SoundFXDOF("Sling",110,DOFPulse,DOFContactors)
  464.     If MachineTilt=0 then TenMove=TenMove+1
  465. End Sub
  466.  
  467. Sub Sling5_Slingshot()
  468.     PlaySound SoundFXDOF("Sling",108,DOFPulse,DOFContactors)
  469.     If MachineTilt=0 then TenMove=TenMove+1
  470. End Sub
  471.  
  472. Sub Sling6_Slingshot()
  473.     PlaySound SoundFXDOF("Sling",105,DOFPulse,DOFContactors)
  474.     DOF 106, DOFPulse
  475.     If MachineTilt=0 then TenMove=TenMove+1
  476. End Sub
  477.  
  478. Sub Sling7_Slingshot()
  479.     PlaySound "Sling"
  480.     If MachineTilt=0 then TenMove=TenMove+1
  481. End Sub
  482.  
  483. Sub Sling8_Slingshot()
  484.     PlaySound "Sling"
  485.     If MachineTilt=0 then TenMove=TenMove+1
  486. End Sub
  487.  
  488. Sub LaneA_Hit
  489.     DOF 127, DOFPulse
  490.     If MachineTilt=0 then
  491.     PlaySound "LaneSwitch"
  492.     'LLight(1).State=LightStateOn
  493.     HunMove=HunMove+5
  494.     CheckLanes(1)
  495.     End If
  496. End Sub
  497.  
  498. Sub LaneB_Hit
  499.     DOF 128, DOFPulse
  500.     If MachineTilt=0 then
  501.     PlaySound "LaneSwitch"
  502.     'LLight(2).State=LightStateOn
  503.     HunMove=HunMove+5
  504.     CheckLanes(2)
  505.     End If
  506. End Sub
  507.  
  508. Sub LaneC_Hit
  509.     DOF 129, DOFPulse
  510.     If MachineTilt=0 then
  511.     PlaySound "LaneSwitch"
  512.     'LLight(3).State=LightStateOn
  513.     HunMove=HunMove+5
  514.     CheckLanes(3)
  515.     End If
  516. End Sub
  517.  
  518. Sub LaneD_Hit
  519.     DOF 130, DOFPulse
  520.     If MachineTilt=0 then
  521.     PlaySound "LaneSwitch"
  522.     'LLight(4).State=LightStateOn
  523.     HunMove=HunMove+5
  524.     CheckLanes(4)
  525.     End If
  526. End Sub
  527.  
  528. Sub LaneE_Hit
  529.     DOF 131, DOFPulse
  530.     If MachineTilt=0 then
  531.     PlaySound "LaneSwitch"
  532.     'LLight(5).State=LightStateOn
  533.     HunMove=HunMove+5
  534.     CheckLanes(5)
  535.     End If
  536. End Sub
  537.  
  538. Sub CheckLanes(f)
  539.     If Lane(f)=0 then LanesDone=LanesDone+1
  540.     Lane(f)=1
  541.     LLight(f).State=LightStateOn
  542.     If LanesDone=5 then
  543. '       If GameType=2 and GotSpecial=0 then
  544. '           ALight(1).State=LightStateOn
  545. '           ALight(2).State=LightStateOn
  546. '       End If
  547. '       If GameType=1 and GotAddA=0 then
  548. '           ALight(1).State=LightStateOn
  549. '           ALight(2).State=LightStateOn
  550. '       End If
  551.         BallsToPlay=BallsToPlay+1
  552.         PlaySound SoundFXDOF("Bell10",141,DOFPulse,DOFChimes)
  553.         PlaySound SoundFXDOF("Bell100",142,DOFPulse,DOFChimes)
  554.         PlaySound SoundFXDOF("Bell1000",143,DOFPulse,DOFChimes)
  555.         DisplayBalls
  556.         For f=1 to 5
  557.             LLight(f).State=LightStateOff
  558.             Lane(f)=0
  559.         Next
  560.         LanesDone=0
  561.         If GotAddA=0 then
  562.             GotAddA=1
  563.         End If
  564.     End If
  565. End Sub
  566.  
  567. Sub LeftOutlane_Hit
  568.     DOF 132, DOFPulse
  569.     If MachineTilt=0 then
  570.     PlaySound "LaneSwitch"
  571.     If TargetDone=6 then
  572.         If GameType=1 then
  573.         BallsToPlay=BallsToPlay+1
  574.         PlaySound SoundFXDOF("Bell10",141,DOFPulse,DOFChimes)
  575.         PlaySound SoundFXDOF("Bell100",142,DOFPulse,DOFChimes)
  576.         PlaySound SoundFXDOF("Bell1000",143,DOFPulse,DOFChimes)
  577.         DisplayBalls
  578.         Else
  579.         ThouMove=ThouMove+5
  580.         End If
  581.     End If
  582.     ALight(3).State=LightStateOff
  583.     ALight(4).State=LightStateOff
  584.     If TargetDone<6 then ThouMove=ThouMove+1
  585.     End If
  586. End Sub
  587.  
  588. Sub RightOutlane_Hit
  589.     DOF 133, DOFPulse
  590.     If MachineTilt=0 then
  591.     PlaySound "LaneSwitch"
  592.     If TargetDone=6 then
  593.         If GameType=1 then
  594.         BallsToPlay=BallsToPlay+1
  595.         PlaySound SoundFXDOF("Bell10",141,DOFPulse,DOFChimes)
  596.         PlaySound SoundFXDOF("Bell100",142,DOFPulse,DOFChimes)
  597.         PlaySound SoundFXDOF("Bell1000",143,DOFPulse,DOFChimes)
  598.         DisplayBalls
  599.         Else
  600.         ThouMove=ThouMove+5
  601.         End If
  602.     End If
  603.     ALight(3).State=LightStateOff
  604.     ALight(4).State=LightStateOff
  605.     If TargetDone<6 then ThouMove=ThouMove+1
  606.     End If
  607. End Sub
  608.  
  609. Sub TopRollover_Hit
  610.     If MachineTilt=0 then
  611.         PlaySound "Rollover"
  612.         BumpOn=1
  613.         For f=1 to 4
  614.             BLight(f).State=LightStateOn
  615.         Next
  616.     End If
  617. End Sub
  618.  
  619. Sub LoopRollover_Hit
  620.     If MachineTilt=0 then
  621.         PlaySound "Rollover"
  622.         If TargetDone<6 then
  623.             ThouMove=ThouMove+5
  624. '       If GotSpecial=0 and TargetDone=6 then
  625. '           GotSpecial=1
  626.           else
  627.             If GameType=2 then
  628.                 BallsToPlay=BallsToPlay+1
  629.                 PlaySound SoundFXDOF("Bell10",141,DOFPulse,DOFChimes)
  630.                 PlaySound SoundFXDOF("Bell100",142,DOFPulse,DOFChimes)
  631.                 PlaySound SoundFXDOF("Bell1000",143,DOFPulse,DOFChimes)
  632.                 DisplayBalls
  633.                 ALight(1).State=LightStateOff
  634.                 ALight(2).State=LightStateOff
  635.                 For f= 1 to 6
  636.                     TLight(f).state=0
  637.                     TLight(f+6).state=0
  638.                     Target(f)=0
  639.                 Next
  640.                 TargetDone=0
  641.               Else
  642.                 PlaySound SoundFXDOF("Knock",122,DOFPulse,DOFKnocker)
  643.                 DOF 120, DOFPulse
  644.                 If Credits<9 then
  645.                     Credits=Credits+1
  646.                     DOF 121, DOFOn
  647.                     CreditLight.state=1
  648.                     CreditBox.Text=Credits
  649.                 End If
  650.             End If
  651.         End If
  652.     End If
  653. End Sub
  654.  
  655. Sub LeftRollover_Hit
  656.     If MachineTilt=0 then
  657.         PlaySound "Rollover"
  658.         TenMove=TenMove+1
  659.     End If
  660. End Sub
  661.  
  662. Sub RightRollover_Hit
  663.     If MachineTilt=0 then
  664.         PlaySound "Rollover"
  665.         TenMove=TenMove+1
  666.     End If
  667. End Sub
  668.  
  669. Sub BottomRollover_Hit
  670.     If MachineTilt=0 then
  671.         PlaySound "Rollover"
  672.         TenMove=TenMove+1
  673.     End If
  674. End Sub
  675.  
  676. Sub Bumper1_Hit
  677.     PlaySound SoundFXDOF("fx_bumper4",111,DOFPulse,DOFContactors)
  678.     DOF 112, DOFPulse
  679.     If MachineTilt=0 then
  680.         If BumpOn=1 then
  681.             HunMove=HunMove+1
  682.         Else
  683.             TenMove=TenMove+1
  684.         End If
  685.     End If
  686. End Sub
  687.  
  688. Sub Bumper2_Hit
  689.     PlaySound SoundFXDOF("fx_bumper4",113,DOFPulse,DOFContactors)
  690.     DOF 114, DOFPulse
  691.     If MachineTilt=0 then
  692.         HunMove=HunMove+1
  693.     End If
  694. End Sub
  695.  
  696. Sub Bumper3_Hit
  697.     PlaySound SoundFXDOF("fx_bumper4",115,DOFPulse,DOFContactors)
  698.     DOF 116, DOFPulse
  699.     If MachineTilt=0 then
  700.         If BumpOn=1 then
  701.             HunMove=HunMove+1
  702.         Else
  703.             TenMove=TenMove+1
  704.         End If
  705.     End If
  706. End Sub
  707.  
  708. Sub Bumper4_Hit
  709.     PlaySound SoundFXDOF("fx_bumper4",117,DOFPulse,DOFContactors)
  710.     DOF 118, DOFPulse
  711.     If MachineTilt=0 then
  712.         If BumpOn=1 then
  713.             HunMove=HunMove+1
  714.         Else
  715.             TenMove=TenMove+1
  716.         End If
  717.     End If
  718. End Sub
  719.  
  720. Sub Target1_Hit
  721.     DOF 125, DOFPulse
  722.     If MachineTilt=0 then
  723.     HunMove=HunMove+3
  724.     CheckTarget(1)
  725.     End If
  726. End Sub
  727.  
  728. Sub Target2_Hit
  729.     DOF 125, DOFPulse
  730.     If MachineTilt=0 then
  731.     HunMove=HunMove+3
  732.     CheckTarget(2)
  733.     End If
  734. End Sub
  735.  
  736. Sub Target3_Hit
  737.     DOF 126, DOFPulse
  738.     If MachineTilt=0 then
  739.     HunMove=HunMove+3
  740.     CheckTarget(3)
  741.     End If
  742. End Sub
  743.  
  744. Sub Target4_Hit
  745.     DOF 126, DOFPulse
  746.     If MachineTilt=0 then
  747.     HunMove=HunMove+3
  748.     CheckTarget(4)
  749.     End If
  750. End Sub
  751.  
  752. Sub Target5_Hit
  753.     DOF 123, DOFPulse
  754.     If MachineTilt=0 then
  755.     HunMove=HunMove+3
  756.     CheckTarget(5)
  757.     End If
  758. End Sub
  759.  
  760. Sub Target6_Hit
  761.     DOF 124, DOFPulse
  762.     If MachineTilt=0 then
  763.     HunMove=HunMove+3
  764.     CheckTarget(6)
  765.     End If
  766. End Sub
  767.  
  768. Sub CheckTarget(f)
  769.     If Target(f)=0 then TargetDone=TargetDone+1
  770.     Target(f)=1
  771.     TLight(f).State=LightStateOn
  772.     TLight(f+6).State=LightStateOn
  773.     If TargetDone=6 then
  774.         ALight(1).State=LightStateOn
  775.         ALight(2).State=LightStateOn
  776.         ALight(3).State=LightStateOn
  777.         ALight(4).State=LightStateOn
  778. '       If GameType=1 and GotAddB=0 then
  779. '           GotAddB=1
  780. '           BallsToPlay=BallsToPlay+1
  781. '           PlaySound "Bell10"
  782. '           PlaySound "Bell100"
  783. '           PlaySound "Bell1000"
  784. '           DisplayBalls
  785. '       End If
  786.     End If
  787. End Sub
  788.  
  789. Sub Hole_Hit()
  790.     HolePause=40+(TargetDone+6)
  791.     PlaySound "KickerIn"
  792.     If MachineTilt=0 then
  793.         If TargetDone>0 then
  794.             ThouMove=ThouMove+TargetDone
  795.         Else
  796.             HunMove=HunMove+5
  797.             HolePause=100
  798.         End If
  799.     End If
  800. End Sub
  801.  
  802.  
  803. Sub AllLightsOff
  804.     For f=1 to 4
  805.         ALight(f).State=LightStateOff
  806.         BLight(f).State=LightStateOff
  807.     Next
  808.     For f=1 to 5
  809.         LLight(f).State=LightStateOff
  810.         RLight(f).State=LightStateOff
  811.     Next
  812.     For f=1 to 12
  813.         TLight(f).State=LightStateOff
  814.     Next
  815. End Sub
  816.  
  817.  
  818. Sub AllLightsOn
  819.     For f=1 to 4
  820.         ALight(f).State=LightStateOn
  821.         BLight(f).State=LightStateOn
  822.     Next
  823.     For f=1 to 5
  824.         LLight(f).State=LightStateOn
  825.         RLight(f).State=LightStateOn
  826.     Next
  827.     For f=1 to 12
  828.         TLight(f).State=LightStateOn
  829.     Next
  830. End Sub
  831.  
  832. Sub AllLightsBlink
  833.     For f=1 to 4
  834.         ALight(f).State=LightStateBlinking
  835.         BLight(f).State=LightStateBlinking
  836.     Next
  837.     For f=1 to 5
  838.         LLight(f).State=LightStateBlinking
  839.         RLight(f).State=LightStateBlinking
  840.     Next
  841.     For f=1 to 12
  842.         TLight(f).State=LightStateBlinking
  843.     Next
  844. End Sub
  845.  
  846.  
  847. Sub NewBall
  848.     GotAddA=0
  849.     GotAddB=0
  850.     GotSpecial=0
  851.     TiltSensor=0
  852.     MachineTilt=0
  853.     TiltBox.Text=""
  854.     If b2son then Controller.B2SSetTilt 33,0
  855.     For f=1 to 4
  856.         BLight(f).state=LightStateOff
  857.     Next
  858.     BumperL2.State=LightStateOn
  859.     BumpOn=0
  860. '   TargetDone=0
  861. '   LanesDone=0
  862. '   For f=1 to 5
  863. '       RLight(f).State=LightStateOn
  864. '       Lane(f)=0
  865. '   Next
  866.     DisplayBalls
  867. End Sub
  868.  
  869. Sub DisplayBalls
  870.     If BallsToPlay>10 then BallsToPlay=10
  871.     For f=1 to 5
  872.         EVAL("BallBox"&f).text=""
  873.     Next
  874.     If BallsToPlay<6 Then
  875.         EVAL("BallBox"&BallsToPlay).text=BallsToPlay
  876.       Else
  877.         BallBox5.Text=BallsToPlay
  878.     End If
  879.     If b2son then Controller.B2ssetballinplay 32, BallsToPlay
  880. End Sub
  881.  
  882. Sub SpEyes_Init()
  883.     LoadEM
  884.     HighScore=LoadValue("SpEyes","HS") ' Load saved Highscore
  885.     If HighScore="" then
  886.         HighScore=100
  887.         SaveValue "SpEyes","HS",HighScore
  888.     Else
  889.         Highscore=CDbl(LoadValue("SpEyes","HS"))
  890.     End If
  891.     Sbest.Text=FormatNumber(HighScore, 0, -1, 0, -1)
  892.     PlaySound "TargetsUp"
  893.     GameType=2
  894.     Credits=LoadValue("SpEyes","Credits") ' Load saved Credits
  895.     If Credits="" then
  896.         Credits=0
  897.         SaveValue "SpEyes","Credits",Credits
  898.     Else
  899.         Credits=CDbl(LoadValue("SpEyes","Credits"))
  900.     End If
  901.     If B2SOn then
  902.         Tiltbox.Visible = false
  903.         OTTbox.visible = False
  904.         Digit1.visible = False
  905.         Digit2.visible = False
  906.         Digit3.visible = False
  907.         Digit4.visible = False
  908.         Digit5.visible = False
  909.         GameOverBox.visible = False
  910.         creditbox.visible = False
  911.         matchbox1.visible = False
  912.         matchbox2.visible = False
  913.         sbest.visible = False
  914.         ballBox1.visible = False
  915.         ballBox2.visible = False
  916.         ballBox3.visible = False
  917.         ballBox4.visible = False
  918.         ballBox5.visible = False
  919.         HSbox.visible = False  
  920.         Controller.B2ssetCredits Credits
  921.     End If
  922.     If Credits>0 then
  923.         CreditLight.state=1
  924.         DOF 121, DOFOn
  925.       Else
  926.         CreditLight.state=0
  927.     End If
  928.            
  929.     For f=1 to 5
  930.         Digit(f)=0
  931.         Lane(f)=0
  932.         Target(f)=0
  933.     Next
  934.     Target(6)=0
  935. End Sub
  936.  
  937. Sub SpEyes_Exit
  938.     SaveValue "SpEyes","Credits",Credits
  939.     If B2SOn Then Controller.stop
  940. End Sub
  941.  
  942. Sub Gate1_Hit():PlaySound "gate4":End Sub
  943.  
  944. Sub RubberWheel_hit():PlaySound "fx_rubber2" End Sub
  945.  
  946. ' *********************************************************************
  947. '                      Supporting Ball & Sound Functions
  948. ' *********************************************************************
  949.  
  950. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  951.    Vol = Csng(BallVel(ball) ^2 / 2000)
  952. End Function
  953.  
  954. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  955.    Dim tmp
  956.     tmp = ball.x * 2 / SPEyes.width-1
  957.     If tmp > 0 Then
  958.         Pan = Csng(tmp ^10)
  959.     Else
  960.         Pan = Csng(-((- tmp) ^10) )
  961.     End If
  962. End Function
  963.  
  964. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  965.    Pitch = BallVel(ball) * 20
  966. End Function
  967.  
  968. Function BallVel(ball) 'Calculates the ball speed
  969.    BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  970. End Function
  971.  
  972. '*****************************************
  973. '      JP's VP10 Rolling Sounds
  974. '*****************************************
  975.  
  976. Const tnob = 80 ' total number of balls
  977. ReDim rolling(tnob)
  978. InitRolling
  979.  
  980. Sub InitRolling
  981.     Dim i
  982.     For i = 0 to tnob
  983.         rolling(i) = False
  984.     Next
  985. End Sub
  986.  
  987. Sub RollingTimer_Timer()
  988.     Dim BOT, b
  989.     BOT = GetBalls
  990.  
  991.     ' stop the sound of deleted balls
  992.    For b = UBound(BOT) + 1 to tnob
  993.         rolling(b) = False
  994.         StopSound("fx_ballrolling" & b)
  995.     Next
  996.  
  997.     ' exit the sub if no balls on the table
  998.    If UBound(BOT) = -1 Then Exit Sub
  999.  
  1000.     ' play the rolling sound for each ball
  1001.    For b = 0 to UBound(BOT)
  1002.         If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  1003.             rolling(b) = True
  1004.             PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1005.         Else
  1006.             If rolling(b) = True Then
  1007.                 StopSound("fx_ballrolling" & b)
  1008.                 rolling(b) = False
  1009.             End If
  1010.         End If
  1011.     Next
  1012. End Sub
  1013.  
  1014. '**********************
  1015. ' Ball Collision Sound
  1016. '**********************
  1017.  
  1018. Sub OnBallBallCollision(ball1, ball2, velocity)
  1019.     PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  1020. End Sub
  1021.  
  1022. '************************************
  1023. ' What you need to add to your table
  1024. '************************************
  1025.  
  1026. ' a timer called RollingTimer. With a fast interval, like 10
  1027. ' one collision sound, in this script is called fx_collide
  1028. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  1029. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  1030.  
  1031.  
  1032. '******************************************
  1033. ' Explanation of the rolling sound routine
  1034. '******************************************
  1035.  
  1036. ' sounds are played based on the ball speed and position
  1037.  
  1038. ' the routine checks first for deleted balls and stops the rolling sound.
  1039.  
  1040. ' The For loop goes through all the balls on the table and checks for the ball speed and
  1041. ' if the ball is on the table (height lower than 30) then then it plays the sound
  1042. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  1043.  
  1044. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  1045. ' will change according to the ball speed, and the PAN function will change the stereo position according
  1046. ' to the position of the ball on the table.
  1047.  
  1048.  
  1049. '**************************************
  1050. ' Explanation of the collision routine
  1051. '**************************************
  1052.  
  1053. ' The collision is built in VP.
  1054. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  1055. ' 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
  1056. ' depending of the speed of the collision.
  1057.  
  1058.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement