Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- ' World's Fair Pinball
- ' Rock-Ola, 1933
- ' Lock values:
- ' 0 = not locked
- ' 1 = locked
- ' 2 = cannot lock
- 'Dim Controller,Tilt,Ball,Balls,Credits,ShootBall,Obj,Bonus,XAdv,Bonuscounter,MultiplierCounter,Tens,Ones,Score,Scoretoadd,TimesDroppedA,TimesDroppedB
- '*DOF method for non rom controller tables by Arngrim****************
- '*******Use DOF 1**, 1 to activate a ledwiz output*******************
- '*******Use DOF 1**, 0 to deactivate a ledwiz output*****************
- '*******Use DOF 1**, 2 to pulse a ledwiz output**********************
- ' World's Fair Jigsaw (1933 Rock-Ola)WIP-2 Screen
- 'DOF Config by Outhere
- '101
- '102
- '103
- '104
- '105
- '106
- '107
- '108
- '109
- '110 Put Ball into shooter Line
- '111
- '112 Shaker
- '113
- '114 Beacon 2000 Points
- '115 Beacon 1500 Points
- '116 Beacon 1000 Points
- '117 Topper Bell
- '118 Chime Unit High Tone
- '119 Chime Unit Mid Tone
- '120 Chime Unit Low Tone
- '121
- '122
- '123
- '124
- '125
- '126
- '127
- '128
- '129
- '130
- Sub DOF(dofevent, dofstate)
- If B2SOn=True Then
- If dofstate = 2 Then
- Controller.B2SSetData dofevent, 1:Controller.B2SSetData dofevent, 0
- Else Controller.B2SSetData dofevent, dofstate
- End If
- End If
- End Sub
- '********************************************************************
- 'Sub Table1_Init()
- Const BallSize = 50
- On Error Resume Next
- ExecuteGlobal GetTextFile("controller.vbs")
- If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
- On Error Goto 0
- Const cGameName = "worlds_fair"
- 'Const cGameName = "PinballY"
- ' B2SOn=true
- '
- 'if B2SOn then
- ' Set Controller = CreateObject("B2S.Server")
- ' Controller.B2SName = "Jigsaw"
- ' Controller.Run()
- ' If Err Then MsgBox "Can't Load B2S.Server."
- ' Controller.B2SSetScoreRolloverPlayer1 0
- 'end if
- LoadVPM "01560000", "Bally.VBS", 3.26
- Sub LoadVPM(VPMver, VBSfile, VBSver)
- End Sub
- Dim VarHidden, UseVPMDMD
- If Table1.ShowDT = true then
- 'UseVPMDMD = True
- 'VarHidden = 0
- 'lockdown.visible = true
- ScoreReel.visible = true
- BallReel.visible = true
- TextBox1.visible = true
- else
- ScoreReel.visible = false
- BallReel.visible = false
- TextBox1.visible = false
- end if
- Dim Controller
- Dim Ball
- Dim B2SOn
- Dim Tilted
- Dim Tilts
- Dim Col1Lock
- Dim Col2Lock
- Dim Col3Lock
- Dim Col4Lock
- Dim Col5Lock
- dim bump1:bump1 = 0
- dim bump2:bump2 = 0
- dim bump3:bump3 = 0
- dim bump4:bump4 = 0
- dim bump5:bump5 = 0
- dim bump6:bump6 = 0
- dim bump7:bump7 = 0
- dim intScore
- dim intGameReset
- dim intBallsLeft
- dim boolDoubleScore
- dim PlayerScore
- Sub Table1_KeyDown(ByVal keycode)
- If PostItHighScoreCheck(keycode) then Exit Sub
- if keycode=StartGameKey then
- if intBallsLeft<1 then
- GameReset
- end if
- end if
- If keycode = PlungerKey Then
- Plunger.PullBack
- PlaySound "plungerpull",0,1,0.25,0.25
- End If
- if Keycode=157 or Keycode=3 or Keycode=205 then
- if intBallsLeft > 0 and intGameReset=False then
- EjectBall
- intBallsLeft=intBallsLeft-1
- BallReel.SetValue intBallsLeft
- if b2son then Controller.B2SSetCredits intBallsLeft
- end if
- end if
- If keycode = LeftTiltKey Then
- Nudge 90, 3
- playsound "nudge"
- TiltCheck
- End If
- If keycode = RightTiltKey Then
- Nudge 270, 3
- playsound "nudge"
- TiltCheck
- End If
- If keycode = CenterTiltKey Then
- Nudge 0, 3
- playsound "nudge"
- TiltCheck
- End If
- End Sub
- Sub Table1_init
- LoadEM
- End Sub
- Sub Table1_KeyUp(ByVal keycode)
- If keycode = PlungerKey Then
- Plunger.Fire
- End If
- End Sub
- ' Tilt Routine
- Sub TiltCheck
- If Tilted = FALSE then
- If Tilts = 0 then
- Tilts = Tilts + int(rnd*100)
- TiltTimer.Enabled = TRUE
- Else
- Tilts = Tilts + int(rnd*120)
- End If
- If Tilts >= 250 and Tilted = FALSE then
- 'GameOn = FALSE
- Primitive62.Rotx = Primitive62.Rotx + 180
- playsound "tilt"
- Tilted = TRUE
- 'TiltBox.Text = "TILT"
- intGameReset=True
- 'intGameReset=True
- End If
- End If
- End Sub
- Sub GameReset
- BallGate.IsDropped=True
- Divider1.IsDropped=True
- Divider2.IsDropped=True
- Divider3.IsDropped=True
- Divider4.IsDropped=True
- DoubleScore.Enabled=False
- DoubleScore.Kick 180,1,-1
- ScoreReel.ResetToZero
- PlayerScore=0
- intScore=0
- boolDoubleScore=False
- RaisePuzzle
- intGameReset=True
- dim xx
- for each xx in puzzleflippers
- xx.rotatetoend
- Next
- GameReset2.enabled = true
- startB2S(3) ' This Line Added By Outhere
- End Sub
- Sub GameReset2_Timer
- 'GameReset3
- GameReset2.Enabled = False
- Dim xx
- for each xx in puzzleflippers
- xx.rotatetoStart
- Next
- end sub
- Sub AddScore(HitValue)
- PlayerScore=PlayerScore+HitValue
- ScoreReel.AddValue(HitValue)
- if boolDoubleScore=True then ScoreReel.AddValue(HitValue):PlayerScore=PlayerScore+HitValue
- if b2son then Controller.B2SSetScorePlayer1 PlayerScore
- End sub
- Sub Drain_Hit()
- Drain1.DestroyBall
- Drain2.DestroyBall
- Drain3.DestroyBall
- BallTrap.DestroyBall
- BallTrap2.DestroyBall
- FreePlay.CreateBall
- FreePlay.Kick 90,1
- End Sub
- '=================================== ' These Lines Added By Outhere ========================================
- Sub startB2S(aB2S)
- If B2SOn Then
- Controller.B2SSetData 1,0 ' 2x On
- Controller.B2SSetData 2,0 ' 2000
- Controller.B2SSetData 3,0 ' Stop Animation
- Controller.B2SSetData 4,0 ' 2x Off
- Controller.B2SSetData 5,0 ' 700
- Controller.B2SSetData 6,0 ' 900
- Controller.B2SSetData 7,0 ' 300
- Controller.B2SSetData 8,0 ' 200
- Controller.B2SSetData 9,0 ' 100
- Controller.B2SSetData 10,0 ' 1900
- Controller.B2SSetData 11,0 ' 500
- Controller.B2SSetData 12,0 ' 600
- Controller.B2SSetData 13,0 ' 400
- Controller.B2SSetData 14,0 ' 1200
- Controller.B2SSetData 15,0 ' 1400
- Controller.B2SSetData 16,0 ' 1700
- Controller.B2SSetData 17,0 ' --------
- Controller.B2SSetData 18,0 ' 1000
- Controller.B2SSetData 19,0 ' 1500
- Controller.B2SSetData aB2S,1
- End If
- End Sub
- '==============================================================================================================
- Sub timergate_Timer
- primitive112.rotz=gate1.CurrentAngle
- primitive113.rotz=gate2.CurrentAngle
- End Sub
- Sub LeftSlingshot_Slingshot()
- PlaySound "Bumper"
- End Sub
- Sub RightSlingshot_Slingshot()
- PlaySound "Bumper"
- End Sub
- Sub Drain2_Hit()
- Drain_Hit
- Playsound "ball_bounce"
- End Sub
- Sub Drain1_Hit()
- Playsound "ball_bounce"
- Drain_Hit
- End Sub
- Sub BallTrap_Hit()
- Drain_Hit
- End Sub
- Sub BallTrap2_Hit()
- Drain_Hit
- startB2S(4) ' This Line Added By Outhere
- End Sub
- Sub Drain1_Timer()
- End Sub
- Sub Drain3_Hit()
- Drain_Hit
- End Sub
- sub EjectBall
- BallEjector.CreateBall
- BallEjector.Kick 0,9
- PlaySound SoundFXDOF("Plunger", 110, DOFPulse, DOFFlippers)
- startB2S(3) ' This Line Added By Outhere
- end sub
- Sub Col1_Hit()
- if P14.rotx = -90 then DOF 117, DOFPulse:DOF 116, DOFPulse:startB2S(18) ' This Line Added By Outhere
- ' Col1Lock=2
- End Sub
- Sub Col2_Hit()
- if P24.rotx = -90 then DOF 117, DOFPulse:DOF 115, DOFPulse:startB2S(19) ' This Line Added By Outhere
- ' Col2Lock=2
- End Sub
- Sub Col3_Hit()
- if P34.rotx = -90 then DOF 117, DOFPulse:DOF 114, DOFPulse:DOF 112, DOFPulse:startB2S(2) ' This Line Added By Outhere
- ' Col3Lock=2
- End Sub
- Sub Col4_Hit()
- if P44.rotx = -90 then DOF 117, DOFPulse:DOF 115, DOFPulse:startB2S(19) ' This Line Added By Outhere
- ' Col4Lock=2
- End Sub
- Sub Col5_Hit()
- if P54.rotx = -90 then DOF 117, DOFPulse:DOF 116, DOFPulse:startB2S(18) ' This Line Added By Outhere
- ' Col5Lock=2
- End Sub
- Sub Col1Row1_Hit()
- if P14.rotx = -90 then DOF 117, DOFPulse:startB2S(18) ' This Line Added By Outhere
- if P11.rotx = -90 And P14.rotx = 0 then DOF 118, DOFPulse ' This Line Added By Outhere
- if P11.rotx = -90 And P14.rotx = 0 And P13.rotx = 0 And P12.rotx = -90 then:startB2S(5) ' This Line Added By Outhere
- if P11.rotx = -90 And P14.rotx = 0 And P13.rotx = -90 And P12.rotx = -90 then:startB2S(6) ' This Line Added By Outhere
- if P11.rotx = -90 And P14.rotx = 0 And P13.rotx = 0 And P12.rotx = 0 then:startB2S(13) ' This Line Added By Outhere
- RaisePiece Flipper11,400
- if P11.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(400)
- 'P1.Rotx = P1.Rotx + -90
- if Col1Lock<>2 then
- ' Col1Lock=1
- end if
- End Sub
- Sub Col2Row1_Hit()
- if P24.rotx = -90 then DOF 117, DOFPulse:startB2S(19) ' This Line Added By Outhere
- if P21.rotx = -90 And P24.rotx = 0 then DOF 118, DOFPulse ' This Line Added By Outhere
- if P21.rotx = -90 And P24.rotx = 0 And P23.rotx = 0 And P22.rotx = -90 then:startB2S(14) ' This Line Added By Outhere
- if P21.rotx = -90 And P24.rotx = 0 And P23.rotx = -90 And P22.rotx = -90 then:startB2S(15) ' This Line Added By Outhere
- if P21.rotx = -90 And P24.rotx = 0 And P23.rotx = 0 And P22.rotx = 0 then:startB2S(6) ' This Line Added By Outhere
- RaisePiece Flipper21,900
- if P21.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(900)
- 'P2.Rotx = P2.Rotx + -90
- if Col2Lock<>2 then
- ' Col2Lock=1
- end if
- End Sub
- Sub Col3Row1_Hit()
- if P34.rotx = -90 then DOF 117, DOFPulse:startB2S(2) ' This Line Added By Outhere
- if P31.rotx = -90 And P34.rotx = 0 then DOF 118, DOFPulse ' This Line Added By Outhere
- if P31.rotx = -90 And P34.rotx = 0 And P33.rotx = 0 And P32.rotx = -90 then:startB2S(16) ' This Line Added By Outhere
- if P31.rotx = -90 And P34.rotx = 0 And P33.rotx = -90 And P32.rotx = -90 then:startB2S(10) ' This Line Added By Outhere
- if P31.rotx = -90 And P34.rotx = 0 And P33.rotx = 0 And P32.rotx = 0 then:startB2S(15) ' This Line Added By Outhere
- RaisePiece Flipper31,1400
- if P31.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(1400)
- 'P3.Rotx = P3.Rotx + -90
- if Col3Lock<>2 then
- ' Col3Lock=1
- end if
- End Sub
- Sub Col4Row1_Hit()
- if P44.rotx = -90 then DOF 117, DOFPulse:startB2S(19) ' This Line Added By Outhere
- if P41.rotx = -90 And P44.rotx = 0 then DOF 118, DOFPulse ' This Line Added By Outhere
- if P41.rotx = -90 And P44.rotx = 0 And P43.rotx = 0 And P42.rotx = -90 then:startB2S(14) ' This Line Added By Outhere
- if P41.rotx = -90 And P44.rotx = 0 And P43.rotx = -90 And P42.rotx = -90 then:startB2S(15) ' This Line Added By Outhere
- if P41.rotx = -90 And P44.rotx = 0 And P43.rotx = 0 And P42.rotx = 0 then:startB2S(6) ' This Line Added By Outhere
- RaisePiece Flipper41,900
- if P41.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(900)
- 'P4.Rotx = P4.Rotx + -90
- if Col4Lock<>2 then
- ' Col4Lock=1
- end if
- End Sub
- Sub Col5Row1_Hit()
- if P54.rotx = -90 then DOF 117, DOFPulse:startB2S(18) ' This Line Added By Outhere
- if P51.rotx = -90 And P54.rotx = 0 then DOF 118, DOFPulse ' This Line Added By Outhere
- if P51.rotx = -90 And P54.rotx = 0 And P53.rotx = 0 And P52.rotx = -90 then:startB2S(5) ' This Line Added By Outhere
- if P51.rotx = -90 And P54.rotx = 0 And P53.rotx = -90 And P52.rotx = -90 then:startB2S(6) ' This Line Added By Outhere
- if P51.rotx = -90 And P54.rotx = 0 And P53.rotx = 0 And P52.rotx = 0 then:startB2S(13) ' This Line Added By Outhere
- RaisePiece Flipper51,400
- if P51.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(400)
- 'P5.Rotx = P5.Rotx + -90
- if Col5Lock<>2 then
- ' Col5Lock=1
- end if
- End Sub
- Sub Col1Row2_Hit()
- if P11.rotx = -90 And P12.rotx = -90 And P13.rotx = 0 And P14.rotx = 0 then:startB2S(7) ' This Line Added By Outhere
- if P11.rotx = -90 And P12.rotx = -90 And P13.rotx = -90 and P14.rotx = 0 then:startB2S(11) ' This Line Added By Outhere
- if P11.rotx = -90 And P12.rotx = -90 And P13.rotx = -90 and P14.rotx = -90 then:startB2S(12) ' This Line Added By Outhere
- if Col1Lock <>1 then
- RaisePiece Flipper12,300
- if P12.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(300):DOF 120, DOFPulse
- 'P12.Rotx = P12.Rotx + -90
- if Col1Lock<>2 then
- ' Col1Lock=1
- end if
- end if
- End Sub
- Sub Col2Row2_Hit()
- if P21.rotx = -90 And P22.rotx = -90 And P23.rotx = 0 And P24.rotx = 0 then:startB2S(7) ' This Line Added By Outhere
- if P21.rotx = -90 And P22.rotx = -90 And P23.rotx = -90 And P24.rotx = 0 then:startB2S(11) ' This Line Added By Outhere
- if P21.rotx = -90 And P22.rotx = -90 And P23.rotx = -90 And P24.rotx = -90 then:startB2S(12) ' This Line Added By Outhere
- if Col2Lock <>1 then
- RaisePiece Flipper22,300
- if P22.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(300):DOF 120, DOFPulse
- 'P22.Rotx = P22.Rotx + -90
- if Col2Lock<>2 then
- ' Col2Lock=1
- end if
- end if
- End Sub
- Sub Col3Row2_Hit()
- if P31.rotx = -90 And P32.rotx = -90 And P33.rotx = 0 And P34.rotx = 0 then:startB2S(7) ' This Line Added By Outhere
- if P31.rotx = -90 And P32.rotx = -90 And P33.rotx = -90 And P34.rotx = 0 then:startB2S(11) ' This Line Added By Outhere
- if P31.rotx = -90 And P32.rotx = -90 And P33.rotx = -90 And P34.rotx = -90 then:startB2S(12) ' This Line Added By Outhere
- if Col3Lock <>1 then
- RaisePiece Flipper32,300
- if P32.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(300):DOF 120, DOFPulse
- 'P32.Rotx = P32.Rotx + -90
- if Col3Lock<>2 then
- ' Col3Lock=1
- end if
- end if
- End Sub
- Sub Col4Row2_Hit()
- if P41.rotx = -90 And P42.rotx = -90 And P43.rotx = 0 And P44.rotx = 0 then:startB2S(7) ' This Line Added By Outhere
- if P41.rotx = -90 And P42.rotx = -90 And P43.rotx = -90 And P44.rotx = 0 then:startB2S(11) ' This Line Added By Outhere
- if P41.rotx = -90 And P42.rotx = -90 And P43.rotx = -90 And P44.rotx = -90 then:startB2S(12) ' This Line Added By Outhere
- if Col4Lock <>1 then
- RaisePiece Flipper42,300
- if P42.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(300):DOF 120, DOFPulse
- 'P42.Rotx = P42.Rotx + -90
- if Col4Lock<>2 then
- ' Col4Lock=1
- end if
- end if
- End Sub
- Sub Col5Row2_Hit()
- if P51.rotx = -90 And P52.rotx = -90 And P53.rotx = 0 And P54.rotx = 0 then:startB2S(7) ' This Line Added By Outhere
- if P51.rotx = -90 And P52.rotx = -90 And P53.rotx = -90 And P54.rotx = 0 then:startB2S(11) ' This Line Added By Outhere
- if P51.rotx = -90 And P52.rotx = -90 And P53.rotx = -90 And P54.rotx = -90 then:startB2S(12) ' This Line Added By Outhere
- if Col5Lock <>1 then
- RaisePiece Flipper52,300
- if P52.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(300):DOF 120, DOFPulse
- 'P52.Rotx = P52.Rotx + -90
- if Col5Lock<>2 then
- ' Col5Lock=1
- end if
- end if
- End Sub
- Sub Col1Row3_Hit()
- if P11.rotx = -90 And P12.rotx = -90 And P13.rotx = -90 And P14.rotx = 0 then:startB2S(8) ' This Line Added By Outhere
- if P11.rotx = -90 And P12.rotx = -90 And P13.rotx = -90 And P14.rotx = -90 then:startB2S(7) ' This Line Added By Outhere
- if Col1Lock <>1 then
- RaisePiece Flipper13,200
- if P13.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(200):DOF 119, DOFPulse
- 'P13.Rotx = P13.Rotx + -90
- if Col1Lock<>2 then
- ' Col1Lock=1
- end if
- end if
- End Sub
- Sub Col2Row3_Hit()
- if P21.rotx = -90 And P22.rotx = -90 And P23.rotx = -90 And P24.rotx = 0 then:startB2S(8) ' This Line Added By Outhere
- if P21.rotx = -90 And P22.rotx = -90 And P23.rotx = -90 And P24.rotx = -90 then:startB2S(7) ' This Line Added By Outhere
- if Col2Lock <>1 then
- RaisePiece Flipper23,200
- if P23.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(200):DOF 119, DOFPulse
- 'P23.Rotx = P23.Rotx + -90
- if Col2Lock<>2 then
- ' Col2Lock=1
- end if
- end if
- End Sub
- Sub Col3Row3_Hit()
- if P31.rotx = -90 And P32.rotx = -90 And P33.rotx = -90 And P34.rotx = 0 then:startB2S(8) ' This Line Added By Outhere
- if P31.rotx = -90 And P32.rotx = -90 And P33.rotx = -90 And P34.rotx = -90 then:startB2S(7) ' This Line Added By Outhere
- if Col3Lock <>1 then
- RaisePiece Flipper33,200
- if P33.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(200):DOF 119, DOFPulse
- 'P33.Rotx = P33.Rotx + -90
- if Col3Lock<>2 then
- ' Col3Lock=1
- end if
- end if
- End Sub
- Sub Col4Row3_Hit()
- if P41.rotx = -90 And P42.rotx = -90 And P43.rotx = -90 And P44.rotx = 0 then:startB2S(8) ' This Line Added By Outhere
- if P41.rotx = -90 And P42.rotx = -90 And P43.rotx = -90 And P44.rotx = -90 then:startB2S(7) ' This Line Added By Outhere
- if Col4Lock <>1 then
- RaisePiece Flipper43,200
- if P43.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(200):DOF 119, DOFPulse
- 'P43.Rotx = P43.Rotx + -90
- if Col4Lock<>2 then
- ' Col4Lock=1
- end if
- end if
- End Sub
- Sub Col5Row3_Hit()
- if P51.rotx = -90 And P52.rotx = -90 And P53.rotx = -90 And P54.rotx = 0 then:startB2S(8) ' This Line Added By Outhere
- if P51.rotx = -90 And P52.rotx = -90 And P53.rotx = -90 And P54.rotx = -90 then:startB2S(7) ' This Line Added By Outhere
- if Col5Lock <>1 then
- RaisePiece Flipper53,200
- if P53.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(200):DOF 119, DOFPulse
- 'P53.Rotx = P53.Rotx + -90
- if Col5Lock<>2 then
- ' Col5Lock=1
- end if
- end if
- End Sub
- Sub Col1Row4_Hit()
- if P11.rotx = -90 And P13.rotx = -90 then:startB2S(9) ' This Line Added By Outhere
- if Col1Lock <>1 then
- RaisePiece Flipper14,100
- if P14.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(100):DOF 118, DOFPulse
- 'P14.Rotx = P14.Rotx + -90
- end if
- Col1Lock=0
- End Sub
- Sub Col2Row4_Hit()
- if P21.rotx = -90 And P23.rotx = -90 then:startB2S(9) ' This Line Added By Outhere
- if Col2Lock <>1 then
- RaisePiece Flipper24,100
- if P24.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(100):DOF 118, DOFPulse
- 'P24.Rotx = P24.Rotx + -90
- end if
- Col2Lock=0
- End Sub
- Sub Col3Row4_Hit()
- if P31.rotx = -90 And P33.rotx = -90 then:startB2S(9) ' This Line Added By Outhere
- if Col3Lock <>1 then
- RaisePiece Flipper34,100
- if P34.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(100):DOF 118, DOFPulse
- 'P34.Rotx = P34.Rotx + -90
- end if
- Col3Lock=0
- End Sub
- Sub Col4Row4_Hit()
- if P41.rotx = -90 And P43.rotx = -90 then:startB2S(9) ' This Line Added By Outhere
- if Col4Lock <>1 then
- RaisePiece Flipper44,100
- if P44.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(100):DOF 118, DOFPulse
- 'P44.Rotx = P44.Rotx + -90
- end if
- Col4Lock=0
- End Sub
- Sub Col5Row4_Hit()
- if P51.rotx = -90 And P53.rotx = -90 then:startB2S(9) ' This Line Added By Outhere
- if Col5Lock <>1 then
- RaisePiece Flipper54,100
- if P54.rotx = -90 then playsound SoundFX("Pieceup", DOFContactors):AddScore(100):DOF 118, DOFPulse
- 'P54.Rotx = P54.Rotx + -90
- end if
- Col5Lock=0
- End Sub
- sub DropPuzzle
- dim oPiece
- For Each oPiece In Pieces
- oPiece.IsDropped=True
- Next
- PlaySound "puzzledown"
- end sub
- sub RaisePuzzle
- dim oPiece
- For Each oPiece In Pieces
- oPiece.IsDropped=false
- Next
- PlaySound "puzzledown"
- end sub
- Sub Piece11_Init()
- DropPuzzle
- End Sub
- 'sub RaisePiece(oPiece,intValue)
- ' if oPiece.IsDropped=True then
- ' oPiece.IsDropped=False
- ' PlaySound "pieceup"
- ' if boolDoubleScore=True then
- ' Score(intValue*2)
- ' else
- ' Score(intValue)
- ' end if
- ' end if
- 'end sub
- dim rot
- Sub RaisePiece(oPiece, rot)
- 'If Not rot Is Nothing Then
- oPiece.RotateToEnd
- End Sub
- Sub PrimT_Timer
- P11.RotX = Flipper11.currentangle
- P21.RotX = Flipper21.currentangle
- P31.RotX = Flipper31.currentangle
- P41.RotX = Flipper41.currentangle
- P51.RotX = Flipper51.currentangle
- P12.RotX = Flipper12.currentangle
- P22.RotX = Flipper22.currentangle
- P32.RotX = Flipper32.currentangle
- P42.RotX = Flipper42.currentangle
- P52.RotX = Flipper52.currentangle
- P13.RotX = Flipper13.currentangle
- P23.RotX = Flipper23.currentangle
- P33.RotX = Flipper33.currentangle
- P43.RotX = Flipper43.currentangle
- P53.RotX = Flipper53.currentangle
- P14.RotX = Flipper14.currentangle
- P24.RotX = Flipper24.currentangle
- P34.RotX = Flipper34.currentangle
- P44.RotX = Flipper44.currentangle
- P54.RotX = Flipper54.currentangle
- End Sub
- 'Sub SwitchUnhit(switchno, switch)
- ' Controller.Switch(switchno) = False
- ' If Not switch Is Nothing Then
- ' switch.TransZ = 0
- ' End If
- 'End Sub
- 'sub RaisePiece(oPiece,intValue)
- ' if oPiece.IsDropped=True then
- ' oPiece.IsDropped=False
- ' PlaySound "pieceup"
- ' if boolDoubleScore=True then
- ' Score(intValue*2)
- ' else
- ' Score(intValue)
- ' end if
- ' end if
- 'end sub
- sub Score(ScoreVal)
- intScore=CDbl(intScore)+CDbl(ScoreVal)
- ScoreReel.AddValue ScoreVal
- end sub
- Sub DoubleScore_Hit()
- startB2S(1)
- boolDoubleScore=True
- Score(intScore)
- End Sub
- Sub ResetTrap_Hit()
- ResetTrap.DestroyBall
- intBallsLeft=intBallsLeft+1
- BallReel.AddValue 1
- if b2son then Controller.B2SSetCredits intBallsLeft
- if intBallsLeft>9 then
- BallGate.IsDropped=False
- Divider1.IsDropped=False
- Divider2.IsDropped=False
- Divider3.IsDropped=False
- Divider4.IsDropped=False
- if intGameReset=True then
- intGameReset=False
- DropPuzzle
- DoubleScore.Enabled=True
- ScoreReel.ResetToZero
- intScore=0
- boolDoubleScore=False
- CheckNewHighScorePostIt1Player PlayerScore
- end if
- end if
- End Sub
- Sub BallStart1_Init()
- dim oStart
- For Each oStart in BallStart
- oStart.CreateBall
- oStart.Kick 180,1
- next
- End Sub
- Sub HelperKickers_Hit(Index)
- HelperKickers(Index).Kick 180,1,-1
- End Sub
- '****************** Animated Primitives ****************
- sub wall19_hit()
- bump1 = 1
- Wall19.TimerEnabled = 1
- end sub
- sub Wall19_Timer()
- Select Case bump1
- Case 1:Primitive82.x = 589.3328:bump1 = bump1 + 1
- Case 2:Primitive82.x = 589.0328:bump1 = bump1 + 1
- Case 3:Primitive82.x = 589.4028:bump1 = bump1 + 1
- Case 4:Primitive82.x = 589.0087:bump1 = bump1 + 1
- Case 5:Primitive82.x = 589.2628:bump1 = bump1 + 1
- Case 6:Primitive82.x = 589.3328:bump1 = bump1 + 1
- case 7:Me.TimerEnabled = 0:bump1 = 0
- End Select
- end sub
- sub wall18_hit()
- bump2 = 1
- Wall18.TimerEnabled = 1
- end sub
- sub Wall18_Timer()
- Select Case bump2
- Case 1:Primitive36.x = 452:bump2 = bump2 + 1
- Case 2:Primitive36.x = 452.0328:bump2 = bump2 + 1
- Case 3:Primitive36.x = 452.4028:bump2 = bump2 + 1
- Case 4:Primitive36.x = 452.0087:bump2 = bump2 + 1
- Case 5:Primitive36.x = 452.3628:bump2 = bump2 + 1
- Case 6:Primitive36.x = 452.0328:bump2 = bump2 + 1
- case 7:Me.TimerEnabled = 0:bump2 = 0
- End Select
- end sub
- sub wall20_hit()
- bump3 = 1
- Wall20.TimerEnabled = 1
- end sub
- sub Wall20_Timer()
- Select Case bump3
- Case 1:Primitive81.x = 721.7778:bump3 = bump3 + 1
- Case 2:Primitive81.x = 721.4328:bump3 = bump3 + 1
- Case 3:Primitive81.x = 721.8028:bump3 = bump3 + 1
- Case 4:Primitive81.x = 721.0087:bump3 = bump3 + 1
- Case 5:Primitive81.x = 721.8078:bump3 = bump3 + 1
- Case 6:Primitive81.x = 721.7778:bump3 = bump3 + 1
- case 7:Me.TimerEnabled = 0:bump3 = 0
- End Select
- end sub
- sub wall9_hit()
- bump4 = 1
- Wall9.TimerEnabled = 1
- end sub
- sub Wall9_Timer()
- Select Case bump4
- Case 1:Primitive83.x = 382.2222:bump4 = bump4 + 1
- Case 2:Primitive83.x = 382.0222:bump4 = bump4 + 1
- Case 3:Primitive83.x = 382.3222:bump4 = bump4 + 1
- Case 4:Primitive83.x = 382.0222:bump4 = bump4 + 1
- Case 5:Primitive83.x = 382.4222:bump4 = bump4 + 1
- Case 6:Primitive83.x = 382.2222:bump4 = bump4 + 1
- case 7:Me.TimerEnabled = 0:bump4 = 0
- End Select
- end sub
- sub wall10_hit()
- bump5 = 1
- Wall10.TimerEnabled = 1
- end sub
- sub Wall10_Timer()
- Select Case bump5
- Case 1:Primitive84.x = 517.3333:bump5 = bump5 + 1
- Case 2:Primitive84.x = 517.1333:bump5 = bump5 + 1
- Case 3:Primitive84.x = 517.4333:bump5 = bump5 + 1
- Case 4:Primitive84.x = 517.3333:bump5 = bump5 + 1
- Case 5:Primitive84.x = 517.0333:bump5 = bump5 + 1
- Case 6:Primitive84.x = 517.3333:bump5 = bump5 + 1
- case 7:Me.TimerEnabled = 0:bump5 = 0
- End Select
- end sub
- sub wall13_hit()
- bump6 = 1
- Wall13.TimerEnabled = 1
- end sub
- sub Wall13_Timer()
- Select Case bump6
- Case 1:Primitive85.x = 654.2222:bump6 = bump6 + 1
- Case 2:Primitive85.x = 654.0222:bump6 = bump6 + 1
- Case 3:Primitive85.x = 654.3222:bump6 = bump6 + 1
- Case 4:Primitive85.x = 654.1222:bump6 = bump6 + 1
- Case 5:Primitive85.x = 654.4222:bump6 = bump6 + 1
- Case 6:Primitive85.x = 654.3222:bump6 = bump6 + 1
- case 7:Me.TimerEnabled = 0:bump6 = 0
- End Select
- end sub
- sub wall17_hit()
- bump7 = 1
- Wall17.TimerEnabled = 1
- end sub
- sub Wall17_Timer()
- Select Case bump7
- Case 1:Primitive86.x = 792.8887:bump7 = bump7 + 1
- Case 2:Primitive86.x = 792.6887:bump7 = bump7 + 1
- Case 3:Primitive86.x = 792.3887:bump7 = bump7 + 1
- Case 4:Primitive86.x = 792.5887:bump7 = bump7 + 1
- Case 5:Primitive86.x = 792.9887:bump7 = bump7 + 1
- Case 6:Primitive86.x = 792.7887:bump7 = bump7 + 1
- case 7:Me.TimerEnabled = 0:bump7 = 0
- End Select
- end sub
- '****************************************
- ' High Score Post-It support 1.2
- '
- ' 1. Copy High Score objects from the template backdrop to the desired table's backdrop. Move if needed
- ' (Note: In backdrop Options, make sure Enable EMReels is checked. If you check and additions items are displayed, move them off the table)
- ' 2. Import the 4 Post-It note image files into the table using the Import Manager
- ' 3. Copy this High Score Post-It script into the table script
- ' 4. Change the HighScoreFilename, "xxxxHighscorePostIt.txt" below - must be unique for each table
- ' 5. Add this line to the top of the KeyDown sub: If PostItHighScoreCheck(keycode) then Exit Sub
- ' 6. Add one of the following lines below to the bottom of the Game Over sub of the table.
- ' Note: Each table is different, you will have to figure out the scoring variable and the game over/match over subroutine
- ' Replace xxxx with the variable used to track scoring, usually Score, Score(1), Score1, PlayerScore, etc
- ' CheckNewHighScorePostIt1Player PlayerScore '1 player table
- ' CheckNewHighScorePostIt2Player xxx1, xxx2 '2 player table
- ' CheckNewHighScorePostIt3Player xxx1, xxx2, xxx3 '3 player table
- ' CheckNewHighScorePostIt4Player xxx1, xxx2, xxx3, xxx4 '4 player table
- '****************************************
- Const HighScoreFilename = "jigsaw.txt"
- Dim HSAHighScore, HSA1, HSA2, HSA3
- Dim HSScore100k, HSScore10k, HSScoreK, HSScore100, HSScore10, HSScore1, HSScorex 'Define 5 different score values for each reel to use
- Dim HSEnterMode, hsLetterFlash, hsEnteredDigits(3), hsCurrentDigit, hsCurrentLetter
- Const hsFlashDelay = 4
- Const DefaultHighScore = 10
- Const DefaultHSA1 = 78
- Const DefaultHSA2 = 74
- Const DefaultHSA3 = 78
- LoadHighScore
- Sub LoadHighScore
- Dim FileObj
- Dim ScoreFile
- Dim TextStr
- Dim SavedDataTemp3 'HighScore
- Dim SavedDataTemp4 'HSA1
- Dim SavedDataTemp5 'HSA2
- Dim SavedDataTemp6 'HSA3
- Set FileObj=CreateObject("Scripting.FileSystemObject")
- If Not FileObj.FolderExists(UserDirectory) then
- Exit Sub
- End if
- If Not FileObj.FileExists(UserDirectory & HighScoreFilename) then
- SetDefaultHSTD:UpdatePostIt:SaveHighScore
- Exit Sub
- End if
- Set ScoreFile=FileObj.GetFile(UserDirectory & HighScoreFilename)
- Set TextStr=ScoreFile.OpenAsTextStream(1,0)
- If (TextStr.AtEndOfStream=True) then
- SetDefaultHSTD:UpdatePostIt:SaveHighScore
- Exit Sub
- End if
- SavedDataTemp3=Textstr.ReadLine ' HighScore
- SavedDataTemp4=Textstr.ReadLine ' HSA1
- SavedDataTemp5=Textstr.ReadLine ' HSA2
- SavedDataTemp6=Textstr.ReadLine ' HSA3
- TextStr.Close
- HSAHighScore=SavedDataTemp3
- HSA1=SavedDataTemp4
- HSA2=SavedDataTemp5
- HSA3=SavedDataTemp6
- UpdatePostIt
- Set ScoreFile = Nothing
- Set FileObj = Nothing
- End Sub
- Sub SetDefaultHSTD 'bad data or missing file - reset and resave
- HSAHighScore = DefaultHighScore
- HSA1 = DefaultHSA1
- HSA2 = DefaultHSA2
- HSA3 = DefaultHSA3
- SaveHighScore
- End Sub
- Sub LastScoreReels
- HSScorex = LastScore
- HSScore100K=Int (HSScorex/100000)'Calculate the value for the 100,000's digit
- HSScore10K=Int ((HSScorex-(HSScore100k*100000))/10000) 'Calculate the value for the 10,000's digit
- HSScoreK=Int((HSScorex-(HSScore100k*100000)-(HSScore10K*10000))/1000) 'Calculate the value for the 1000's digit
- HSScore100=Int((HSScorex-(HSScore100k*100000)-(HSScore10K*10000)-(HSScoreK*1000))/100) 'Calculate the value for the 100's digit
- HSScore10=Int((HSScorex-(HSScore100k*100000)-(HSScore10K*10000)-(HSScoreK*1000)-(HSScore100*100))/10) 'Calculate the value for the 10's digit
- HSScore1=Int(HSScorex-(HSScore100k*100000)-(HSScore10K*10000)-(HSScoreK*1000)-(HSScore100*100)-(HSScore10*10)) 'Calculate the value for the 1's digit
- End Sub
- Sub UpdatePostIt
- HSScorex = HSAHighScore
- HSScore100K=Int (HSScorex/100000)'Calculate the value for the 100,000's digit
- HSScore10K=Int ((HSScorex-(HSScore100k*100000))/10000) 'Calculate the value for the 10,000's digit
- HSScoreK=Int((HSScorex-(HSScore100k*100000)-(HSScore10K*10000))/1000) 'Calculate the value for the 1000's digit
- HSScore100=Int((HSScorex-(HSScore100k*100000)-(HSScore10K*10000)-(HSScoreK*1000))/100) 'Calculate the value for the 100's digit
- HSScore10=Int((HSScorex-(HSScore100k*100000)-(HSScore10K*10000)-(HSScoreK*1000)-(HSScore100*100))/10) 'Calculate the value for the 10's digit
- HSScore1=Int(HSScorex-(HSScore100k*100000)-(HSScore10K*10000)-(HSScoreK*1000)-(HSScore100*100)-(HSScore10*10)) 'Calculate the value for the 1's digit
- EMReelHSNum1.SetValue(HSScore100K):If HSScorex<100000 Then EMReelHSNum1.SetValue 10
- EMReelHSNum2.SetValue(HSScore10K):If HSScorex<10000 Then EMReelHSNum2.SetValue 10
- EMReelHSNum3.SetValue(HSScoreK):If HSScorex<1000 Then EMReelHSNum3.SetValue 10:EMReelHSComma.SetValue 0:Else EMReelHSComma.SetValue 1
- EMReelHSNum4.SetValue(HSScore100):If HSScorex<100 Then EMReelHSNum4.SetValue 10
- EMReelHSNum5.SetValue(HSScore10):If HSScorex<10 Then EMReelHSNum5.SetValue 10
- EMReelHSNum6.SetValue(HSScore1)
- EMReelHSName1.SetValue HSA1
- EMReelHSName2.SetValue HSA2
- EMReelHSName3.SetValue HSA3
- End Sub
- Sub SaveHighScore
- Dim FileObj
- Dim ScoreFile
- Set FileObj=CreateObject("Scripting.FileSystemObject")
- If Not FileObj.FolderExists(UserDirectory) then
- Exit Sub
- End if
- Set ScoreFile=FileObj.CreateTextFile(UserDirectory & HighScoreFilename,True)
- ScoreFile.WriteLine HSAHighScore
- ScoreFile.WriteLine HSA1
- ScoreFile.WriteLine HSA2
- ScoreFile.WriteLine HSA3
- ScoreFile.Close
- Set ScoreFile=Nothing
- Set FileObj=Nothing
- End Sub
- Sub HighScoreEntryInit()
- HSEnterMode = True
- hsCurrentDigit = 0
- hsCurrentLetter = 1:HSA1=1
- HighScoreFlashTimer.Interval = 250
- HighScoreFlashTimer.Enabled = True
- hsLetterFlash = hsFlashDelay
- End Sub
- Sub HighScoreFlashTimer_Timer()
- hsLetterFlash = hsLetterFlash-1
- If hsLetterFlash=1 then 'switch to underscore
- Select Case hsCurrentLetter
- Case 1:
- EMReelHSName1.SetValue 28
- Case 2:
- EMReelHSName2.SetValue 28
- Case 3:
- EMReelHSName3.SetValue 28
- End Select
- End If
- If hsLetterFlash=0 then 'switch back
- hsLetterFlash = hsFlashDelay
- Select Case hsCurrentLetter
- Case 1:
- EMReelHSName1.SetValue HSA1
- Case 2:
- EMReelHSName2.SetValue HSA2
- Case 3:
- EMReelHSName3.SetValue HSA3
- End Select
- End If
- End Sub
- Sub HighScoreProcessKey(keycode)
- If keycode = LeftFlipperKey Then
- hsLetterFlash = hsFlashDelay
- Select Case hsCurrentLetter
- Case 1:
- HSA1=HSA1-1:If HSA1=-1 Then HSA1=26 'no backspace on 1st digit
- UpdatePostIt
- Case 2:
- HSA2=HSA2-1:If HSA2=-1 Then HSA2=27
- UpdatePostIt
- Case 3:
- HSA3=HSA3-1:If HSA3=-1 Then HSA3=27
- UpdatePostIt
- End Select
- End If
- If keycode = RightFlipperKey Then
- hsLetterFlash = hsFlashDelay
- Select Case hsCurrentLetter
- Case 1:
- HSA1=HSA1+1:If HSA1>27 Then HSA1=0
- UpdatePostIt
- Case 2:
- HSA2=HSA2+1:If HSA2>27 Then HSA2=0
- UpdatePostIt
- Case 3:
- HSA3=HSA3+1:If HSA3>27 Then HSA3=0
- UpdatePostIt
- End Select
- End If
- If keycode = StartGameKey Then
- Select Case hsCurrentLetter
- Case 1:
- hsCurrentLetter=2 'ok to advance
- HSA2=HSA1 'start at same alphabet spot
- EMReelHSName1.SetValue HSA1:EMReelHSName2.SetValue HSA2
- Case 2:
- If HSA2=27 Then 'bksp
- HSA2=0
- hsCurrentLetter=1
- Else
- hsCurrentLetter=3 'enter it
- HSA3=HSA2 'start at same alphabet spot
- End If
- EMReelHSName2.SetValue HSA2:EMReelHSName3.SetValue HSA3
- Case 3:
- If HSA3=27 Then 'bksp
- HSA3=0
- hsCurrentLetter=2
- Else
- SaveHighScore 'enter it
- HighScoreFlashTimer.Enabled = False
- HSEnterMode = False
- UpdatePostIt
- EMReelHSTitle.SetValue 0
- End If
- EMReelHSName3.SetValue HSA3
- End Select
- End If
- End Sub
- Function PostItHighScoreCheck (keycode)
- PostItHighScoreCheck = 0
- If HSEnterMode Then
- HighScoreProcessKey(keycode)
- Select Case keycode
- Case LeftFlipperKey, RightFlipperKey, 2, StartGameKey
- PostItHighScoreCheck = 1
- End Select
- End If
- End Function
- Sub CheckNewHighScorePostIt (newScore)
- If CLng(newScore) > CLng(HSAHighScore) Then
- HSAHighScore=newScore:HSA1 = 0:HSA2 = 0:HSA3 = 0:UpdatePostIt
- EMReelHSTitle.SetValue 1
- HighScoreEntryInit()
- End If
- End Sub
- Sub CheckNewHighScorePostIt1Player (newScore1)
- CheckNewHighScorePostIt newScore1
- End Sub
- Sub CheckNewHighScorePostIt2Player (newScore1, newScore2)
- Dim bestscore
- bestscore = newScore1
- If newScore2 > bestscore then bestscore = newScore2
- CheckNewHighScorePostIt bestscore
- End Sub
- Sub CheckNewHighScorePostIt3Player (newScore1, newScore2, newScore3)
- Dim bestscore
- bestscore = newScore1
- If newScore2 > bestscore then bestscore = newScore2
- If newScore3 > bestscore then bestscore = newScore3
- CheckNewHighScorePostIt bestscore
- End Sub
- Sub CheckNewHighScorePostIt4Player (newScore1, newScore2, newScore3, newScore4)
- Dim bestscore
- bestscore = newScore1
- If newScore2 > bestscore then bestscore = newScore2
- If newScore3 > bestscore then bestscore = newScore3
- If newScore4 > bestscore then bestscore = newScore4
- CheckNewHighScorePostIt bestscore
- End Sub
- '*******************************RAIL SOUNDS *******************************
- Sub RCol1_Hit()
- dim finalspeed
- StopSound "fx_ballrolling"
- PlaySound "rail_low_slower", 0, (Vol(ActiveBall)*.75), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0:End Sub
- Sub Rcol1d_Hit()
- StopSound "rail"
- StopSound "rail_low_slower"
- PlaySound "ball_bounce",0,1,.3,0
- End Sub
- Sub RCol2_Hit()
- dim finalspeed
- StopSound "fx_ballrolling"
- PlaySound "rail_low_slower", 0, (Vol(ActiveBall)*.75), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0:End Sub
- Sub Rcol2d_Hit()
- StopSound "rail"
- StopSound "rail_low_slower"
- PlaySound "ball_bounce",0,1,.3,0
- End Sub
- Sub RCol3_Hit()
- dim finalspeed
- StopSound "fx_ballrolling"
- PlaySound "rail_low_slower", 0, (Vol(ActiveBall)*.75), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0:End Sub
- Sub Rcol3d_Hit()
- StopSound "rail"
- StopSound "rail_low_slower"
- PlaySound "ball_bounce",0,1,.3,0
- End Sub
- Sub RCol4_Hit()
- dim finalspeed
- StopSound "fx_ballrolling"
- PlaySound "rail_low_slower", 0, (Vol(ActiveBall)*.75), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0:End Sub
- Sub Rcol4d_Hit()
- StopSound "rail"
- StopSound "rail_low_slower"
- PlaySound "ball_bounce",0,1,.3,0
- End Sub
- Sub RCol5_Hit()
- dim finalspeed
- StopSound "fx_ballrolling"
- PlaySound "rail_low_slower", 0, (Vol(ActiveBall)*.75), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0:End Sub
- Sub Rcol5d_Hit()
- StopSound "rail"
- StopSound "rail_low_slower"
- PlaySound "ball_bounce",0,1,.3,0
- End Sub
- Sub draind_Hit()
- PlaySound "ball_bounce",0,1,.3,0
- End Sub
- Sub draind1_Hit()
- PlaySound "ball_bounce",0,1,.3,0
- End Sub
- ' *********************************************************************
- ' Supporting Ball & Sound Functions
- ' *********************************************************************
- Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^20 / 2000)
- End Function
- Function Vol2(ball1, ball2) ' Calculates the Volume of the sound based on the speed of two balls
- Vol2 = (Vol(ball1) + Vol(ball2) ) / 2
- End Function
- Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
- Dim tmp
- tmp = ball.x * 2 / table1.width-1
- If tmp> 0 Then
- Pan = Csng(tmp ^10)
- Else
- Pan = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
- Pitch = BallVel(ball) * 20
- End Function
- Function BallVel(ball) 'Calculates the ball speed
- BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
- End Function
- '*****************************************
- ' JP's VP10 Collision & Rolling Sounds
- '*****************************************
- Const tnob = 20 ' total number of balls
- ReDim rolling(tnob)
- ReDim collision(tnob)
- Initcollision
- Sub Initcollision
- Dim i
- For i = 0 to tnob
- collision(i) = -1
- rolling(i) = False
- Next
- End Sub
- Sub CollisionTimer_Timer()
- Dim BOT, B, B1, B2, dx, dy, dz, distance, radii
- BOT = GetBalls
- ' rolling
- For B = UBound(BOT) +1 to tnob
- rolling(b) = False
- StopSound("fx_ballrolling" & b)
- Next
- If UBound(BOT) = -1 Then Exit Sub
- For B = 0 to UBound(BOT)
- If BallVel(BOT(b) ) > 1 AND BOT(b).z < 100 Then
- rolling(b) = True
- PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
- Else
- If rolling(b) = True Then
- StopSound("fx_ballrolling" & b)
- rolling(b) = False
- End If
- End If
- Next
- 'collision
- If UBound(BOT) < 1 Then Exit Sub
- For B1 = 0 to UBound(BOT)
- For B2 = B1 + 1 to UBound(BOT)
- dz = INT(ABS((BOT(b1).z - BOT(b2).z) ) )
- radii = BOT(b1).radius + BOT(b2).radius
- If dz <= radii Then
- dx = INT(ABS((BOT(b1).x - BOT(b2).x) ) )
- dy = INT(ABS((BOT(b1).y - BOT(b2).y) ) )
- distance = INT(SQR(dx ^2 + dy ^2) )
- If distance <= radii AND (collision(b1) = -1 OR collision(b2) = -1) Then
- collision(b1) = b2
- collision(b2) = b1
- PlaySound("fx_collide"), 0, Vol2(BOT(b1), BOT(b2)), Pan(BOT(b1)), 0, Pitch(BOT(b1)), 0, 0
- Else
- If distance > (radii + 1) Then
- If collision(b1) = b2 Then collision(b1) = -1
- If collision(b2) = b1 Then collision(b2) = -1
- End If
- End If
- End If
- Next
- Next
- End Sub
- '************************************
- ' What you need to add to your table
- '************************************
- ' a timer called CollisionTimer. With a fast interval, like from 1 to 10
- ' one collision sound, in this script is called fx_collide
- ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
- ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
- '******************************************
- ' Explanation of the rolling sound routine
- '******************************************
- ' sounds are played based on the ball speed and position
- ' the routine checks first for deleted balls and stops the rolling sound.
- ' The For loop goes through all the balls on the table and checks for the ball speed and
- ' if the ball is on the table (height lower than 30) then then it plays the sound
- ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
- ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
- ' will change according to the ball speed, and the PAN function will change the stereo position according
- ' to the position of the ball on the table.
- '**************************************
- ' Explanation of the collision routine
- '**************************************
- ' The Double For loop: This is a double cycle used to check the collision between a ball and the other ones.
- ' If you look at the parameters of both cycles, you?ll notice they are designed to avoid checking
- ' collision twice. For example, I will never check collision between ball 2 and ball 1,
- ' because I already checked collision between ball 1 and 2. So, if we have 4 balls,
- ' the collision checks will be: ball 1 with 2, 1 with 3, 1 with 4, 2 with 3, 2 with 4 and 3 with 4.
- ' Sum first the radius of both balls, and if the height between them is higher then do not calculate anything more,
- ' since the balls are on different heights so they can't collide.
- ' The next 3 lines calculates distance between xth and yth balls with the Pytagorean theorem,
- ' The first "If": Checking if the distance between the two balls is less than the sum of the radius of both balls,
- ' and both balls are not already colliding.
- ' Why are we checking if balls are already in collision?
- ' Because we do not want the sound repeting when two balls are resting closed to each other.
- ' Set the collision property of both balls to True, and we assign the number of the ball colliding
- ' Play the collide sound of your choice using the VOL, PAN and PITCH functions
- ' Last lines: If the distance between 2 balls is more than the radius of a ball,
- ' then there is no collision and then set the collision property of the ball to False (-1).
- Sub Pins_Hit (idx)
- PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
- End Sub
- Sub spring_Hit (idx)
- PlaySound "spring", 10, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
- End Sub
- Sub nails_Hit (idx)
- PlaySound "post hit", 10, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Sub
- Sub Metals_Hit (idx)
- PlaySound "metal", 10, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Sub
- Sub Metals2_Hit (idx)
- PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Sub
- Sub Gates_Hit (idx)
- PlaySound "gate", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Sub
- Sub Spinner_Spin
- PlaySound "fx_spinner",0,.25,0,0.25
- End Sub
- Sub rubbers_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 1 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End if
- If finalspeed >= 6 AND finalspeed <= 1 then
- RandomSoundRubber()
- End If
- End Sub
- Sub Posts_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 16 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End if
- If finalspeed >= 6 AND finalspeed <= 16 then
- RandomSoundRubber()
- End If
- End Sub
- Sub RandomSoundRubber()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Select
- End Sub
- Sub LeftFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RightFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RandomSoundFlipper()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
- End Select
- End Sub
- Sub Table1_Exit
- Controller.Stop
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment