Advertisement
Guest User

Congo 1.1a-2

a guest
Oct 28th, 2016
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 72.53 KB | None | 0 0
  1. ' Original VP9 Table by JPSalas
  2. ' VP10 conversion by nFozzy
  3. ' Spotlight primitive by Dark
  4. ' flasher images by LoadedWeapon
  5.  
  6. Option Explicit
  7. Randomize
  8.  
  9. On Error Resume Next
  10. ExecuteGlobal GetTextFile("controller.vbs")
  11. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  12. On Error Goto 0
  13.  
  14. 'Options------
  15. const HardFlips = 1 'more rigid flippers
  16. const SingleScreenFS = 0    'Single Screen FS support
  17. Const FastFlips = 1 'Skip solenoid callbacks for flippers (def: 1)
  18. '------------
  19.  
  20.  
  21. 'Dim DesktopMode:DesktopMode = Table1.ShowDT
  22. Dim DesktopMode:DesktopMode = Table1.ShowDT
  23. Dim UseVPMColoredDMD
  24. Const UseVPMModSol = 1
  25.  
  26. const cSingleLFlip = False  'disable UL flipper button
  27.  
  28. if SingleScreenFS = 1 then UseVPMColoredDMD = True else UseVPMColoredDMD = DesktopMode
  29. if FastFlips = 0 then Clockstep = 20
  30.  
  31. LoadVPM "01560000", "WPC.VBS", 3.5
  32.  
  33.  
  34. '********************
  35. 'Standard definitions
  36. '********************
  37.  
  38. Const UseSolenoids = 1
  39. Const UseLamps = 0
  40. Const UseSync = 0
  41. Const HandleMech = 0
  42.  
  43. 'Const UseGI = 0
  44.  
  45. ' Standard Sounds
  46. Const SSolenoidOn = "fx_solenoid"
  47. Const SSolenoidOff = ""
  48. Const SCoin = "fx_Coin"
  49.  
  50. Const cGameName = "congo_21"
  51.  
  52. Dim bsTrough, bsAmyVuk, bsVolcano, bsMap, bsMystery, LowerPlayfieldBall
  53.  
  54. Dim x
  55.  
  56. Set GICallback = GetRef("UpdateGIon")
  57. Set GICallback2 = GetRef("UpdateGI")
  58. Set MotorCallback = GetRef("RollingUpdate") 'realtime updates - rolling sound
  59.  
  60. '************
  61. ' Table init.
  62. '************
  63.  
  64. Sub Table1_Init
  65.     vpmInit Me
  66.     With Controller
  67.         .GameName = cGameName
  68.         If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  69.         .SplashInfoLine = "Congo (Williams 1995)"
  70.         .Games(cGameName).Settings.Value("rol") = 0 'set it to 1 to rotate the DMD to the left
  71.        .HandleKeyboard = 0
  72.         .ShowTitle = 0
  73.         .ShowDMDOnly = 1
  74.         .ShowFrame = 0
  75.         .HandleMechanics = 0
  76. '        .Hidden = DesktopMode
  77. '       .Hidden = 0    
  78.        If DesktopMode then
  79.             .Hidden = 1
  80.         else
  81.             If SingleScreenFS = 1 then
  82.                 .Hidden = 1
  83.             else
  84.                 .Hidden = 0
  85.             End If
  86.         End If
  87.         On Error Resume Next
  88.         .Run GetPlayerHWnd
  89.         If Err Then MsgBox Err.Description
  90.         On Error Goto 0
  91.         .Switch(22) = 1 'close coin door
  92.        .Switch(24) = 1 'and keep it close
  93.    End With
  94.  
  95.     ' Nudging
  96.    vpmNudge.TiltSwitch = 14
  97.     vpmNudge.Sensitivity = 1
  98.     vpmNudge.TiltObj = Array(bumper1, bumper2, bumper3, LeftSlingshot, RightSlingshot)
  99.  
  100.     ' Trough
  101.    Set bsTrough = New cvpmTrough
  102.     With bsTrough
  103.         .size = 4
  104.         .initSwitches Array(32, 33, 34, 35)
  105.         .Initexit BallRelease, 90, 4
  106.         .InitEntrySounds "fx_drain", "fx_Solenoid", "fx_Solenoid"
  107.         .InitExitSounds "fx_Solenoid", SoundFX("fx_ballrel",DOFContactors)
  108.         .Balls = 4
  109.     End With
  110. 'SoundFX("DTDrop",DOFContactors)
  111.  
  112.      '   Volcano
  113.     Set bsVolcano = New cvpmTrough
  114.     With bsVolcano    
  115.         .size = 4
  116.         .initSwitches Array(41, 42, 43)
  117.         .Initexit sw36a, 260, 10
  118.         .InitExitVariance 10, 1 'direction, force
  119.        .InitExitSounds SoundFX("popper",DOFContactors), SoundFX("popper",DOFContactors)
  120.         .InitExitVariance 2, 2
  121. '        .MaxBallsPerKick = 2
  122.    End With
  123.    
  124.    
  125.     '2-way Popper
  126.     Set bsAmyVuk = New cvpmSaucer
  127.     With bsAmyVuk
  128.         .InitKicker sw53, 53, 330, 30, 65   'up 'switch, direction, force, Zforce
  129.         .InitAltKick 145, 30, 60 'down
  130.         .InitSounds "kicker_enter_center", "fx_Solenoid", SoundFX("fx_kicker2",DOFContactors)
  131. '        .CreateEvents "bsAmyVuk", sw53
  132.     End With
  133.    
  134.     Set BsMystery = New cvpmSaucer
  135.     With bsMystery
  136.         .InitKicker sw37, 37, 185, 20, 45
  137.         .InitExitVariance 2, 1
  138.         .InitSounds "kicker_enter_center", "fx_Solenoid", SoundFX("fx_kicker2",DOFContactors)
  139. '       .createevents "bsMystery", sw37
  140.     End With
  141.    
  142.     Set bsMap = New cvpmSaucer
  143.     With bsMap
  144.         .InitKicker sw38, 38, 210, 20, 45
  145.         .InitExitVariance 2, 1
  146.         .InitSounds "kicker_enter_center", "fx_Solenoid", SoundFX("fx_kicker2",DOFContactors)
  147. '       .createevents "bsMap", sw38
  148.     End With
  149.    
  150.  
  151.     ' Main Timer init
  152.    PinMAMETimer.Interval = PinMAMEInterval
  153.     PinMAMETimer.Enabled = 1
  154.    
  155.     ' Init Kickback
  156.    KickBack.Pullback
  157.     AutoPlunger.Pullback
  158.  
  159.     ' Init other dropwalls - animations
  160.     LeftPost.IsDropped = 1:SolTopPost 0
  161.     TopPost.IsDropped = 0
  162.     leftpost_invis.IsDropped = 1
  163.    
  164.     'Lower Playfield Ball
  165.     CreateLPFball
  166.  
  167. '   DisconnectFlippers
  168.  
  169.     UpdateGIon 0, 0:UpdateGIon 1, 0: UpdateGIon 2, 0
  170.     UpdateGI 0, 9:UpdateGI 1, 7:UpdateGI 2, 7
  171.  
  172.  
  173.     'Sidewall tops
  174.     borderL.visible = cInt(desktopmode)
  175.     borderR.visible = cInt(desktopmode)
  176.     borderL2.visible = cInt(desktopmode)
  177.     borderR2.visible = cInt(desktopmode)
  178.  
  179.     'DMD Adjust
  180.     if DesktopMode Then
  181.         flasherDMD.X = -58: flasherDMD.Y = 1580: flasherDMD.rotX = -40: flasherDMD.rotY = 2.5:flasherDMD.height = 830
  182.     elseif SingleScreenFS then
  183.         '/
  184. '       msgbox("SSFS")
  185.     Else
  186.         flasherdmd.visible = 0
  187.     end if
  188.  
  189. 'if VPBuildVersion < 10100 then 'Legacy support, since VP10.0 does not support changing flipper angles
  190. '   GoFlipperLeft.strength = 1600
  191. '   GoFlipperRight.strength = 1600
  192. '   playsound "target"
  193. ''  flipper1.rotatetoend
  194. '   controller.hidden = 0
  195. 'end if
  196.  
  197.  
  198. End Sub
  199.  
  200. Sub CreateLPFball
  201.     Set LowerPlayfieldBall = kickerLPF.Createball
  202.     with LowerPlayfieldBall
  203.         .image = "ball_HDR"
  204.         .color = RGB(148,148,148)
  205.     end with
  206.     kickerLPF.Kick 180, 1
  207. End Sub
  208.  
  209. Sub LPFcatcherTrigger_hit() 'in case the ball bugs
  210.     me.destroyball
  211.     CreateLPFball
  212. end sub
  213.  
  214. Sub table1_Paused:Controller.Pause = 1:End Sub
  215. Sub table1_unPaused:Controller.Pause = 0:End Sub
  216.  
  217. '***********
  218. ' Update GI
  219. '***********
  220. Dim gistep, Giswitch, xx
  221. Giswitch = 0
  222.  
  223. Sub UpdateGIOn(no, Enabled)
  224.     Select Case no
  225.         Case 0 'Gorilla
  226.             If Enabled Then
  227.                 For each xx in GIGorilla:xx.State = 1: Next
  228.             Else
  229.                 For each xx in GIGorilla:xx.state = 0: Next
  230.             End If
  231.         Case 1
  232.             If Enabled Then
  233.                 For Each xx in GiTop:xx.state = 1: Next
  234.                 Gi_flasher.visible = 1  'spotlight
  235.             else
  236.                 For Each xx in GiTop:xx.state = 0: Next
  237.                 Gi_flasher.visible = 0
  238.             End If
  239.         Case 2
  240.             If Enabled Then
  241.                 For Each xx in GiBottom:xx.state = 1: Next
  242.             Else
  243.                 For Each xx in GiBottom:xx.state = 0: Next
  244.             End If
  245.     End Select
  246. End Sub
  247. 'cutting down the intensity a bit
  248. 'min 50% intensityscale
  249.  
  250. 'x = intensityscale y = gistep
  251. 'x1= 0.5 y1= 1
  252. 'x2= 1   y2= 7
  253.  
  254. 'solve for slope
  255. ''m = (y2 - y1) / (x2 - x1)
  256. '   (7 - 1) / (1 - 0.5)
  257. '   6 / 0.5
  258. 'm = 12
  259.  
  260. 'point slope formula
  261. 'y - y1 = m(x-x1)
  262. '   y - 1 = 12(x-0.5)
  263.  
  264. 'y = 12x -5
  265. 'x = (y+5)/12
  266.            
  267.  
  268. Sub UpdateGI(no, step)
  269.     Dim ii, x
  270.     If step = 0 then exit sub 'only values from 1 to 8 are visible and reliable. 0 is not reliable and 7 & 8 are the same so...
  271.    gistep = (step-1)' / 7
  272.    Select Case no
  273.         Case 0
  274. '           textbox1.text = step
  275. '           If step > 0 and step < 8 Then
  276. '               For each xx in GIGorilla:xx.State = 1: Next
  277. '           Else
  278. '               For each xx in GIGorilla:xx.state = 0: Next
  279. '           End If
  280. '               GorillaGI
  281.          For each ii in GiGorilla
  282.                 ii.IntensityScale = (gistep+5)/12
  283.             Next
  284.         Case 1
  285.             For each ii in GiTop
  286.                 ii.IntensityScale = (gistep+5)/12
  287.            ' back.Image="backwall"&step
  288.            Next
  289.             Gi_flasher.IntensityScale = (gistep+5)/12
  290.         Case 2 ' also the bumpers er GI
  291.            For each ii in GiBottom
  292.                 ii.IntensityScale = (gistep+5)/12
  293.             Next
  294.     End Select
  295.     ' change the intensity of the flasher depending on the gi to compensate for the gi lights being off
  296. '    For ii = 0 to 200
  297. '        FlashMax(ii) = 6 - gistep * 3 ' the maximum value of the flashers
  298. '    Next
  299.     '
  300.     for each x in LInserts
  301.         dim s, i
  302.         s = mid(x.name, 2, 2)           'take L off the lamp's name
  303.         i = cInt(s)                     'convert string to integer to get the lampnumber
  304.         x.intensityscale = 4-(3*GI31.intensityscale)
  305.         x.fadespeedup = insertfading(i, 1) * x.intensityscale
  306.         x.fadespeeddown = insertfading(i, 2) * x.intensityscale
  307.     Next
  308.     textbox1.text = 4-(3*GI31.intensityscale)
  309. '   textbox1.text = GI31.intensityscale
  310. End Sub
  311.  
  312. dim insertfading(100, 2):   'columns : 0 = name 1 = fadeup 2 = fadedown
  313. 'for x = 0 to ubound(insertfading)
  314. '   insertfading(x, 0) = 0
  315. '   insertfading(x, 1) = 0
  316. 'next
  317.     initlampsforfading
  318. Sub initlampsforfading
  319.     dim x, s, i
  320.     i = 0
  321.     for each x in Linserts  'setup array
  322.         s = mid(x.name, 2, 2)           'take L off the lamp
  323.         i = cInt(s) 'convert string to integer to get the lampnumber
  324.         insertfading(i, 0) = i
  325.         insertfading(i, 1) = x.fadespeedup
  326.         insertfading(i, 2) = x.fadespeeddown
  327.     next
  328.     for x = 0 to UBOUND(insertfading)
  329.         if insertfading(x, 0) <> 0 then
  330. '       textbox1.text = insertfading(x, 0)
  331.         exit for
  332.         Else
  333. '       textbox1.text = "comin up zeros"
  334.         end If
  335.     next
  336.  
  337.     textbox1.text = insertfading(58, 2)
  338. end sub
  339.  
  340. 'x = intensityscale y = gistep
  341. 'x1= 2.5 y1= 0.5
  342. 'x2= 1   y2= 1
  343.  
  344. 'solve for slope
  345. ''m = (y2 - y1) / (x2 - x1)
  346. '   (1 - 0.5) / (1 - 2.5)
  347. 'm = -1/3
  348.  
  349. 'point slope formula
  350. 'y - y1 = m(x-x1)
  351. 'y - 0.5 = (-1/3)(x-2.5)
  352.  
  353.  
  354.  
  355.  
  356. Sub GorillaGI
  357.     If Giswitch = 1 then
  358.     Giswitch = 0
  359.     Gion
  360.     Else
  361.     Giswitch = 1
  362.     Gioff
  363.     End If
  364. End Sub
  365.  
  366. Sub GIon
  367.     For each xx in GIGorilla:xx.State = 1: Next
  368. end sub
  369.  
  370. Sub GIoff
  371.     For each xx in GIGorilla:xx.state = 0: Next
  372. end sub
  373.  
  374. '--Experimental simple light tweaking UI
  375. dim teststatement: teststatement = "buddy! Press enter to start!" '============CLICK ME TO COLLAPSE============
  376.     ltbody.text = " "
  377.     ltTop.text = "Top bar"
  378.     ltSide.text = "0" & vbnewline & "1" & vbnewline & "2" & vbnewline & "3"' & vbnewline & "4" & vbnewline & "5"
  379.     dim testarray(6)
  380.     testarray(0) = "Hi there " & teststatement
  381.     ltbody.text = testarray(0)
  382.  
  383.     dim LTtypeselect:LTtypeselect = 0
  384.     dim LTpropertyselect: LTpropertyselect = 0
  385.  
  386.     'InitLT
  387.     'Sub InitLT
  388.     '   LtTypeSelect = 0
  389.     'End Sub
  390.  
  391.     sub ltdebug2_timer()
  392.         me.text = "Ltpropertyselect var: " & LTpropertyselect & vbnewline &  "Lttypeselect var: " & LTTypeselect
  393.     end sub
  394.  
  395.     sub LTcontUpDown(updown)
  396.         dim x
  397.         if Updown = 1 Then
  398.             if LtPropertySelect = 0 then
  399.                 LtPropertyselect = 8
  400.             else LtpropertySelect = Ltpropertyselect -1
  401.             end if
  402.         elseif Updown = 0 Then
  403.             if LtPropertySelect = 8 then
  404.                 LtPropertyselect = 0
  405.             else LtpropertySelect = Ltpropertyselect +1
  406.             end if
  407.         Else
  408.             Ltdebug.text = "Bad argument"
  409.         end if
  410.         dim a, aa
  411.         aa = array("0 ", "1 ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8")
  412.         a = array("0>", "1>", "2>", "3>", "4>", "5>", "6>", "7>", "8>")
  413.         aa(LtPropertySelect) = a(LTpropertyselect) 'heh
  414.         ltside.text = aa(0) & vbnewline & aa(1) & vbnewline & aa(2) & vbnewline & aa(3) & vbnewline & aa(4) & vbnewline & aa(5) & vbnewline & aa(6) & vbnewline & aa(7) & vbnewline & aa(8)
  415.     End Sub
  416.  
  417.     Sub LtcontLeftRight(LeftRight)  '1 or -1
  418.         dim a
  419.         a = array(Linserts)
  420.         dim x
  421.         if mid(Lcatalogn(LTtypeselect), 1, 1) = "L" then
  422.             select case LTpropertyselect
  423.                 case 0 'name
  424.                     LtTypeSelect = LtTypeSelect + 1 * leftright
  425.                     if LtTypeSelect < 0 then LtTypeSelect = lrarraycount
  426.                     if LtTypeSelect > lrarraycount then LtTypeSelect = 0
  427.                 case 1  'falloff
  428.                     for each x in Lcatalog(LTtypeselect)
  429.                         x.falloff = x.falloff + 10 *leftright
  430.                     next
  431.                 case 2  'fallofpower
  432.                     for each x in Lcatalog(LTtypeselect)
  433.                         x.falloffpower = x.falloffpower + 0.5 *leftright
  434.                     next
  435.                 case 3  'intensity
  436.                     for each x in Lcatalog(LTtypeselect)
  437.                         x.intensity = x.intensity + 1 *leftright
  438.                     next
  439.                 case 4 'empty
  440.             end select
  441.         Elseif mid(Lcatalogn(LTtypeselect), 1, 1) = "F" then
  442.         '1 object '2 opacity '3 modulate
  443.             select case LTpropertyselect
  444.                 case 0  'name
  445.                     LtTypeSelect = LtTypeSelect + 1 * leftright
  446.                     if LtTypeSelect < 0 then LtTypeSelect = lrarraycount
  447.                     if LtTypeSelect > lrarraycount then LtTypeSelect = 0               
  448.                 case 1  'opacity
  449.                     for each x in Lcatalog(LTtypeselect)
  450.                         x.opacity = x.opacity + 50 *leftright
  451.                     next
  452.                 case 2  'modulatevsadd
  453.                     for each x in Lcatalog(LTtypeselect)
  454.                         x.modulatevsadd = x.modulatevsadd + 0.01 *leftright
  455.                     next
  456.                 case 3  'modulatevsadd gross
  457.                     for each x in Lcatalog(LTtypeselect)
  458.                         x.modulatevsadd = x.modulatevsadd + 0.1 *leftright
  459.                     next
  460.             end select
  461.         Elseif mid(Lcatalogn(LTtypeselect), 1, 1) = "B" then
  462.             select case LTpropertyselect
  463.                 case 0 'name
  464.                     LtTypeSelect = LtTypeSelect + 1 * leftright
  465.                     if LtTypeSelect < 0 then LtTypeSelect = lrarraycount
  466.                     if LtTypeSelect > lrarraycount then LtTypeSelect = 0
  467.                 case 1  'falloff
  468.                     for each x in Lcatalog(LTtypeselect)
  469.                         x.falloff = x.falloff + 10 *leftright
  470.                     next
  471.                 case 2  'fallofpower
  472.                     for each x in Lcatalog(LTtypeselect)
  473.                         x.falloffpower = x.falloffpower + 0.5 *leftright
  474.                     next
  475.                 case 3  'intensity
  476.                     for each x in Lcatalog(LTtypeselect)
  477.                         x.intensity = x.intensity + 0.5 *leftright
  478.                     next
  479.                 case 4 'transmit
  480.                     for each x in Lcatalog(LTtypeselect)
  481.                         x.TransmissionScale = x.TransmissionScale + 0.1 *LeftRight
  482.                     next
  483.                 case 5 'lightscale for everything else
  484.                     for each x in a(0)
  485.                         x.intensityscale = x.intensityscale + 0.1 *leftright
  486.                     next
  487.             end select
  488.         Elseif mid(Lcatalogn(LTtypeselect), 1, 1) = "G" then
  489.             select case LTpropertyselect
  490.                 case 0 'name
  491.                     LtTypeSelect = LtTypeSelect + 1 * leftright
  492.                     if LtTypeSelect < 0 then LtTypeSelect = lrarraycount
  493.                     if LtTypeSelect > lrarraycount then LtTypeSelect = 0
  494.                 case 1  'falloff    '1 falloff '2 falloff power '3 intensity '4 transmit '5 GI level '6 GI on/off '7 all lights scale
  495.                     for each x in Lcatalog(LTtypeselect)
  496.                         x.falloff = x.falloff + 10 *leftright
  497.                     next
  498.                 case 2  'fallofpower
  499.                     for each x in Lcatalog(LTtypeselect)
  500.                         x.falloffpower = x.falloffpower + 0.5 *leftright
  501.                     next
  502.                 case 3  'intensity
  503.                     for each x in Lcatalog(LTtypeselect)
  504.                         x.intensity = x.intensity + 0.5 *leftright
  505.                     next
  506.                 case 4 'transmit
  507.                     for each x in Lcatalog(LTtypeselect)
  508.                         x.TransmissionScale = x.TransmissionScale + 0.1 *LeftRight
  509.                     next
  510.                 case 5 'GI level
  511.                     for each x in Lcatalog(LTtypeselect)
  512.                         x.intensityscale = x.intensityscale + 0.1 *leftright
  513.                     next
  514.                 case 6 'GI state
  515.                     for each x in Lcatalog(LTtypeselect)
  516.                         if x.state = 0 then x.state = 1 else x.state = 0
  517.                     next
  518.                 case 7 'lightscale for everything else
  519.                     for each x in a(0)
  520.                         x.intensityscale = x.intensityscale + 0.1 *leftright
  521.                     next
  522.                 case 8 'modulate
  523.                     for each x in Lcatalog(LTtypeselect)
  524.                         x.BulbModulateVsAdd = x.BulbModulateVsAdd + 0.01 *leftright
  525.                     next
  526.             end select
  527.         end if
  528.         updateLT
  529.         ltdebug.text = "lr:" & ltpropertyselect
  530.     end sub
  531.  
  532.  
  533.     sub updateLT
  534.         dim x, s, xx
  535.     '   for each x in Lcatalog(LTtypeselect)
  536.         for each x in Lcatalog(LTtypeselect)
  537.             if mid(Lcatalogn(LTtypeselect), 1, 1) = "L" Then    'if array starts with "L"
  538.                 xx = mid(Lcatalogn(LTtypeselect), 1, 1)
  539.                 LTdebug.text = "lamp col."
  540.                 LTdisplayLampCats
  541.             elseif mid(Lcatalogn(LTtypeselect), 1, 1) = "F" Then
  542.                 ltDebug.text = "flash col."
  543.                 LTdisplayFlashCats
  544.             elseif mid(Lcatalogn(LTtypeselect), 1, 1) = "B" Then
  545.                 ltDebug.text = "bulb col."
  546.                 LTdisplayBulbLampCats
  547.             elseif mid(Lcatalogn(LTtypeselect), 1, 1) = "G" Then
  548.                 ltDebug.text = "bulb col."
  549.                 LTdisplayGICats
  550.             Else   
  551.                 LTdebug.text = "error: unknown col."            'for Flashers collections later
  552.             end if
  553.     '       x.intensity = 555
  554.             exit for
  555.         next
  556.         s = " "
  557.         ltTop.text = s
  558.     '   xx = cStr(Lcatalog(LTtypeselect) )  'convert to string for the TextBox  'can't figure this out :(
  559.     '   xx = Lcatalog(0)    'convert to string for the TextBox
  560.     ''  xx = cstr(xx)
  561.     '   xx = (Lcatalog(0).tostring())
  562.         s = LcatalogN(LTtypeselect) 'fuck it
  563.         ltTop.text = s
  564.     end sub
  565.  
  566.  
  567.     'categories
  568.     sub LTdisplayLampCats
  569.         dim xxx, LTfalloff1, LTfalloff2, LTintens, LTname   'Loptions0, Loptions1, Loptions2 (falloff, falloffpower, intensity)
  570.         for each xxx in Lcatalog(LTtypeselect)
  571.             LTname = xxx.name
  572.             LTfalloff1 = xxx.falloff
  573.             LTfalloff2 = xxx.falloffpower
  574.             LTintens = xxx.intensity
  575.             exit for 'only need one
  576.         next
  577.         Ltbody.text = "obj: " & LTname & vbnewline & " Falloff: " & LTfalloff1 & vbnewline & " Falloff Power: " & LTfalloff2 & vbnewline & " Intensity: " & LTintens
  578.     end sub
  579.  
  580.     sub LTdisplayBulbLampCats
  581.         dim xxx, LTfalloff1, LTfalloff2, LTintens, LTname, LTtransmit, LTintscale   'Loptions0, Loptions1, Loptions2 (falloff, falloffpower, intensity)
  582.         for each xxx in Lcatalog(LTtypeselect)
  583.             LTname = xxx.name
  584.             LTfalloff1 = xxx.falloff
  585.             LTfalloff2 = xxx.falloffpower
  586.             LTintens = xxx.intensity
  587.             LTtransmit = xxx.TransmissionScale
  588.             exit for 'only need one
  589.         next
  590.         for each xxx in Collection1
  591.             LTintscale = xxx.intensityscale
  592.             exit for
  593.         next
  594.         Ltbody.text = "obj: " & LTname & vbnewline & " Falloff: " & LTfalloff1 & vbnewline & " Falloff Power: " & LTfalloff2 & vbnewline & " Intensity: " & LTintens & vbnewline & " Transmit: " & LTtransmit & vbnewline & " insertscale: " & LTintscale
  595.     end sub
  596.  
  597.     'name, Opacity, 'ModulateVsAdd
  598.     sub LTdisplayFlashCats  '1 object '2 opacity '3 modulate
  599.         dim xxx, ltOpacity, LtModulate, LTname  'ModulateVsAdd
  600.         for each xxx in Lcatalog(LTtypeselect)
  601.             LTname = xxx.name
  602.             LtModulate = xxx.ModulateVsAdd
  603.             LtOpacity = xxx.Opacity
  604.     '       LTintens = xxx.intensity
  605.             exit for 'only need one
  606.         next
  607.         Ltbody.text = "an object: " & LTname & vbnewline & " Opacity: " & LtOpacity & vbnewline & " Modulate: " & LtModulate
  608.     end sub
  609.  
  610.  
  611.     sub LTdisplayGICats                                                                                 '1 falloff '2 falloff power '3 intensity '4 transmit '5 GI level '6 GI on/off '7 all lights scale
  612.         dim xxx, LTfalloff1, LTfalloff2, LTintens, LTname, LTtransmit, LTintscale, LTgi, LTgibool, LtBulbModulateVsAdd  'Loptions0, Loptions1, Loptions2 (falloff, falloffpower, intensity)
  613.         for each xxx in Lcatalog(LTtypeselect)
  614.             LTname = xxx.name
  615.             LTfalloff1 = xxx.falloff
  616.             LTfalloff2 = xxx.falloffpower
  617.             LTintens = xxx.intensity
  618.             LTtransmit = xxx.TransmissionScale
  619.             Ltgi = xxx.intensityscale
  620.             LtGIbool = xxx.state
  621.             LtBulbModulateVsAdd = xxx.BulbModulateVsAdd
  622.             exit for 'only need one
  623.         next
  624.         for each xxx in Linserts
  625.             LTintscale = xxx.intensityscale
  626.             exit for
  627.         next
  628.         Ltbody.text = "obj: " & LTname & vbnewline & " Falloff: " & LTfalloff1 & vbnewline & " Falloff Power: " & LTfalloff2 & _
  629.         vbnewline & " Intensity: " & LTintens & vbnewline & " Transmit: " & LTtransmit & vbnewline & "Gi lvl:" & LTgi & vbnewline & "Gi on:" & LTGibool & vbnewline & "insertscale: " & LTintscale & vbnewline & "Modulate:" & LtBulbModulateVsAdd
  630.     end sub
  631.     'categories end
  632.  
  633.  
  634.  
  635.  
  636.     dim Lcatalog, LcatalogN
  637.     Lcatalog = array(Linserts, Gibottom2, GiTop, Gigorilla) '9
  638.     'aka fuck it
  639.     LcatalogN = array("Linserts", "Gibottom2", "GiTop", "Gigorilla")
  640.     dim LRarraycount : lrarraycount = 3
  641. '#end region
  642.  
  643.  
  644. sub TestUpperFlipper
  645.     KickerUFTEST.createball
  646.     KickerUFTEST.kick 0, 0
  647.     bip = bip + 1
  648.  
  649. '   T1.enabled = 1
  650. '   ULeftFlipper.rotatetostart
  651. End Sub
  652. '   polltimer.enabled = 0
  653.  
  654.     tb1.text = "interval: " & t1.interval
  655. sub t1_timer()
  656.     uleftflipper.rotatetoend
  657.     me.enabled = 0
  658. end sub
  659.  
  660. sub textbox3_timer()
  661.     me.text = GoFlipperLeft.strength
  662. end sub
  663.  
  664. '**********
  665. ' Keys
  666. '**********
  667.  
  668. sub textbox2_timer()
  669.     me.text = FlasherDMD1.x & vbnewline & Flasherdmd1.y & vbnewline & FlasherDMD1.height
  670. end sub
  671.  
  672. dim LeftFlipperOn, RightFlipperOn
  673. Sub table1_KeyDown(ByVal Keycode)
  674.     '    If keycode = LeftTiltKey Then Nudge 90, 5:PlaySound "fx_nudge", 0, 1, -0.1, 0.25
  675. '    If keycode = RightTiltKey Then Nudge 270, 5:PlaySound "fx_nudge", 0, 1, 0.1, 0.25
  676. '    If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound "fx_nudge", 0, 1, 0, 0.25
  677.     If keycode = LeftFlipperKey Then
  678.         flipnf 0, 1
  679.         if FlippersEnabled then LeftFlipperOn = 1 else LeftFlipperOn = 0    'testing
  680.     end if
  681.     If keycode = RightFlipperKey Then
  682.         flipnf 1, 1
  683.         if FlippersEnabled then RightFlipperOn = 1 else RightFlipperOn = 0  'testing
  684.     end if
  685.  
  686. '       if keycode = 28 then updateLT
  687.  
  688. '       if keycode = 200 then LTcontUpDown 1
  689. '       if keycode = 208 then LTcontUpDown 0
  690. '
  691. '       if keycode = 203 then LtcontLeftRight -1
  692. '       if keycode = 205 then LtcontLeftRight 1
  693.  
  694. '       if keycode = 200 then FlasherDMD1.y = Flasherdmd1.y + 10
  695. '       if keycode = 208 then FlasherDMD1.y = Flasherdmd1.y - 10
  696. '       if keycode = 203 then FlasherDMD1.x = Flasherdmd1.x - 10
  697. '       if keycode = 205 then FlasherDMD1.x = Flasherdmd1.x + 10
  698. '       if keycode = 38 then FlasherDMD1.height = Flasherdmd1.height - 10   'L
  699. '       if keycode = 37 then FlasherDMD1.height = Flasherdmd1.height + 10   'K
  700.  
  701. '       if keycode = 38 then FlasherDMD.ROTY = Flasherdmd.ROTY - 2.5    'L
  702. '       if keycode = 37 then FlasherDMD.ROTY = Flasherdmd.ROTY + 2.5    'K
  703. '
  704. '       if keycode = 200 then t1.interval = t1.interval - 10 :  tb1.text = "interval: " & t1.interval
  705. '       if keycode = 208 then t1.interval = t1.interval + 10 :  tb1.text = "interval: " & t1.interval
  706.  
  707.     If vpmKeyDown(keycode) Then Exit Sub
  708.     If keycode = PlungerKey Then PlaySound SoundFx("PlungerPull",0), 0, 0.05, 0.1, 0.25:Plunger.Pullback:end if
  709.     If keycode=31 then ' test Right Kicker debug
  710. '   initlampsforfading
  711. '   textbox1.text = insertfading(55, 0)
  712. '   TestUpperFlipper
  713. '   Kicker1.createball
  714. '   kicker1.kick 22, 1
  715. '   bip = bip + 1
  716. '   vpmTimer.PulseSw 71
  717. '   vpmtimer.pulsesw 11     'Grey test
  718. '   If keycode=32 then ' test Left Kicker
  719. '   Kicker2.createball
  720. '   kicker2.kick 1,1
  721. '   End If
  722.    End If
  723.     If keycode=33 then ' test Right Kicker debug
  724. '   initlampsforfading
  725. '   textbox1.text = insertfading(55, 0)
  726. '   Kicker1.createball
  727. '   kicker1.kick 22, 35
  728. '   bip = bip + 1
  729. '   vpmTimer.PulseSw 71
  730. '   vpmtimer.pulsesw 11     'Grey test
  731. '   If keycode=32 then ' test Left Kicker
  732. '   Kicker2.createball
  733. '   kicker2.kick 1,1
  734. '   End If
  735.    End If
  736. End Sub
  737.  
  738.  
  739.  
  740. Sub table1_KeyUp(ByVal Keycode)
  741.     If keycode = LeftFlipperKey Then
  742.         flipnf 0, 0
  743.         LeftFlipperOn = 0
  744.     end if
  745.     If keycode = RightFlipperKey Then
  746.         flipnf 1, 0
  747.         RightFlipperOn = 0
  748.     end if
  749.     If vpmKeyUp(keycode) Then Exit Sub
  750.     If keycode = PlungerKey Then PlaySound SoundFx("plunger",0), 0, 0.1, 0.1, 0.25:Plunger.Fire:end if
  751. End Sub
  752.  
  753. '*********
  754. ' Switches
  755. '*********
  756.  
  757. ' Drain hole
  758. Sub Drain_Hit
  759.     bsTrough.AddBall Me
  760.     bip = bip - 1
  761.     if bip < 0 then
  762.         bip = 0
  763.     elseif bip = 0 then
  764.         polltimer.enabled = 1
  765.     end if
  766. End Sub
  767. 'sub drain_hit:drain.destroyball:end sub    'debug, infinite balls
  768. sub destroyer_hit
  769.     bip = bip - 1
  770.     if bip < 0 then
  771.         bip = 0
  772.     elseif bip = 0 then
  773.         polltimer.enabled = 1
  774.     end if
  775.     me.destroyball
  776. end sub
  777. Sub Sw36_Hit:vpmTimer.PulseSw(36):bsVolcano.AddBall me:bip = bip - 1:playsound "fx_drain", 1, 0.1, 0.005:End Sub    'name,loopcount,volume,pan,randompitch
  778. Sub Sw37_Hit:controller.Switch(37) = 1:bsMystery.addball me:bip = bip - 1:End Sub
  779. Sub Sw38_Hit:controller.Switch(38) = 1:bsMap.addball me:bip = bip - 1:End Sub
  780. 'sw53 (2 way popper)
  781. sub sw53_hit:controller.Switch(53) = 1:bsAmyVuk.addball me:bip = bip - 1:End Sub
  782.  
  783. ' Slings & div switches
  784.  
  785. Dim Lstep, Rstep
  786.  
  787. Sub LeftSlingShot_Slingshot
  788.     vpmTimer.PulseSw 61
  789.     PlaySound SoundFx("fx_slingshot1",DOFContactors),0,0.7,-0.01,0.05
  790.     LSling.Visible = 0
  791.     LSling1.Visible = 1
  792.     sling2.TransZ = -28
  793.     LStep = 0
  794.     LeftSlingShot.TimerEnabled = 1
  795. End Sub
  796.  
  797. Sub LeftSlingShot_Timer
  798.     Select Case LStep
  799.         Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -16
  800.         Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  801.     End Select
  802.     LStep = LStep + 1
  803. End Sub
  804.  
  805. Sub RightSlingShot_Slingshot
  806.     vpmTimer.PulseSw 62
  807.     PlaySound SoundFx("fx_slingshot2",DOFContactors), 0, 0.7, 0.01, 0.05
  808.     RSling.Visible = 0
  809.     RSling1.Visible = 1
  810.     sling1.TransZ = -28
  811.     RStep = 0
  812.     RightSlingShot.TimerEnabled = 1
  813. End Sub
  814.  
  815. Sub RightSlingShot_Timer
  816.     Select Case RStep
  817.         Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -17
  818.         Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  819.     End Select
  820.     RStep = RStep + 1
  821. End Sub
  822.  
  823. ' Bumpers
  824. Sub Bumper1_Hit:vpmTimer.PulseSw 63:PlaySound SoundFx("fx_bumper3",DOFContactors), 0, 1, 0.01, 0.20:End Sub
  825. Sub Bumper2_Hit:vpmTimer.PulseSw 64:PlaySound SoundFx("fx_bumper3",DOFContactors), 0, 1, 0.02, 0.20:End Sub
  826. Sub Bumper3_Hit:vpmTimer.PulseSw 65:PlaySound SoundFx("fx_bumper3",DOFContactors), 0, 1, 0.01, 0.20:End Sub
  827.  
  828. ' Right Eject Rubber
  829. Sub sw25_Hit:vpmTimer.PulseSw 25:End Sub 'Right Eject Rubber
  830.  
  831. 'Shooter Lane
  832.  
  833. Sub sw18_Hit:Controller.Switch(18) = 1:End Sub
  834. Sub sw18_UnHit:Controller.Switch(18) = 0:End Sub
  835.  
  836. 'Inlane/Outlanes
  837. Sub sw16_Hit:Controller.Switch(16) = 1:End Sub  'Kickback
  838. Sub sw16_UnHit:Controller.Switch(16) = 0:End Sub'kickback
  839.  
  840. Sub sw26_Hit:Controller.Switch(26) = 1:End Sub
  841. Sub sw26_UnHit:Controller.Switch(26) = 0:End Sub
  842. Sub sw17_Hit:Controller.Switch(17) = 1:End Sub
  843. Sub sw17_UnHit:Controller.Switch(17) = 0:End Sub
  844. Sub sw27_Hit:Controller.Switch(27) = 1:End Sub
  845. Sub sw27_UnHit:Controller.Switch(27) = 0:End Sub
  846.  
  847. 'Playfield Switches & Rollovers
  848.  
  849. Sub sw15_Hit:Controller.Switch(15) = 1:End Sub
  850. Sub sw15_UnHit:Controller.Switch(15) = 0:End Sub
  851. Sub sw45_Hit:Controller.Switch(45) = 1:End Sub
  852. Sub sw45_UnHit:Controller.Switch(45) = 0:End Sub
  853. Sub sw11_Hit:Controller.Switch(11) = 1:End Sub
  854. Sub sw11_UnHit:Controller.Switch(11) = 0:End Sub
  855. Sub sw44_Hit:Controller.Switch(44) = 1:End Sub
  856. Sub sw44_UnHit:Controller.Switch(44) = 0:End Sub
  857. Sub sw12_Hit:Controller.Switch(12) = 1:End Sub
  858.  
  859. 'Volcano Switch
  860. Sub sw12_UnHit:Controller.Switch(12) = 0:End Sub
  861.  
  862. 'Additional diverter Sub
  863. Sub VolcanoTop_Hit()
  864.     bip = bip + 1
  865. End Sub
  866.  
  867. Sub sw71_Hit:Controller.Switch(71) = 1:End Sub      'AMY Rollovers
  868. Sub sw71_UnHit:Controller.Switch(71) = 0:End Sub
  869. Sub sw72_Hit:Controller.Switch(72) = 1:End Sub
  870. Sub sw72_UnHit:Controller.Switch(72) = 0:End Sub
  871. Sub sw73_Hit:Controller.Switch(73) = 1:End Sub
  872. Sub sw73_UnHit:Controller.Switch(73) = 0:End Sub
  873.  
  874. 'Targets
  875.  
  876. Sub sw46_Hit:vpmTimer.PulseSw 46:End Sub
  877. Sub sw47_Hit:vpmTimer.PulseSw 47:End Sub
  878. Sub sw48_Hit:vpmTimer.PulseSw 48:End Sub
  879. Sub sw56_Hit:vpmTimer.PulseSw 56:End Sub':PlaySound "target", 0, 0.2:End Sub    'Laser Perimeter
  880. Sub sw51_Hit:vpmTimer.PulseSw 51:End Sub
  881. Sub sw52_Hit:vpmTimer.PulseSw 52:End Sub
  882.  
  883. Sub sw54_Hit:vpmTimer.PulseSw 54:End Sub            'We Are
  884. Sub sw55_Hit:vpmTimer.PulseSw 55:End Sub            'Watching
  885. Sub sw28_Hit:vpmTimer.PulseSw 28:End Sub            'You
  886.  
  887. Sub sw74_Hit:vpmTimer.PulseSw 74:End Sub
  888. Sub sw75_Hit:vpmTimer.PulseSw 75:End Sub
  889. Sub sw76_Hit:vpmTimer.PulseSw 76:End Sub
  890. Sub sw77_Hit:vpmTimer.PulseSw 77:End Sub
  891. Sub sw78_Hit:vpmTimer.PulseSw 78:End Sub
  892.  
  893. 'Ramp Switches
  894. Sub sw57_Hit:Controller.Switch(57) = 1:End Sub
  895. Sub sw57_UnHit:Controller.Switch(57) = 0:End Sub
  896. Sub sw58_Hit:Controller.Switch(58) = 1:End Sub
  897. Sub sw58_UnHit:Controller.Switch(58) = 0:End Sub
  898. Sub sw67_Hit:Controller.Switch(67) = 1:End Sub
  899. Sub sw67_UnHit:Controller.Switch(67) = 0:End Sub
  900. Sub sw68_Hit:Controller.Switch(68) = 1:End Sub
  901. Sub sw68_UnHit:Controller.Switch(68) = 0:End Sub
  902.  
  903.  
  904. '***************************
  905. '   Solenoids & Flashers
  906. 'some soleoid subs are from
  907. 'Aurian/Guitar/Jive's table
  908. '***************************
  909.  
  910. SolCallBack(1) = "Auto_Plunger"
  911. SolCallBack(2) = "Kick_back"
  912. SolCallBack(3) = "SolPopUp"
  913. SolCallBack(4) = "SolPopDown"
  914. 'SolCallBack(5) = "vpmSolDiverter Diverter,true,"
  915. SolCallback(5) = "RampDiverter"
  916. SolCallBack(6) = "bsVolcano.SolOut"
  917. 'SolCallBack(6) = "VolcanoKick"
  918. SolCallBack(7) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  919. SolCallBack(8) = "SolTopPost"
  920. 'SolCallBack(9) = "bsTrough.SolOut"
  921. SolCallBack(9) = "SolRelease"
  922. 'SolCallBack(10)    ' Left SLingshot
  923. 'SolCallBack(11)    ' Right Slingshot
  924. 'SolCallBack(12)    ' Left bumper
  925. 'SolCallBack(13)    ' Right bumper
  926. 'SolCallBack(14)    ' Bottom bumper
  927. SolCallBack(15) = "GorillaRight"
  928. SolCallBack(16) = "GorillaLeft"
  929. 'SolCallBack(17) = "SetLamp 117,"   'Amy Flasher
  930. 'SolCallBack(18) = "SetLamp 118,"   'Left Ramp Flasher
  931. 'SolCallBack(19) = "SetLamp 119,"   '2-Way Popper Flasher
  932. 'SolCallBack(20) = "SetLamp 120,"   'SkillShot Flasher
  933. 'SolCallBack(21) = "SetLamp 121,"   'Gray Gorilla Flasher
  934. 'SolCallback(22) = "bsMap.SolOut"
  935. SolCallback(22) = "MapKick"
  936. SolCallBack(23) = "LeftGateOn"
  937. SolCallBack(24) = "RightGateOn"
  938. 'SolCallBack(23) = "vpmSolGate Gate4,true,"
  939. 'SolCallBack(24) = "vpmSolGate Gate2,true," 'dese are reversed
  940. 'SolCallBack(25) = "SetLamp 125,"   'Lower Right Flasher
  941. 'SolCallBack(26) = "SetLamp 126,"   'Right Ramp Flasher
  942. 'SolCallBack(27) = "SetLamp 127,"   'Volcano Flasher
  943. 'SolCallBack(28) = "SetLamp 128,"   'Perimeter Defense Flasher
  944. SolCallBack(33) = "SolLeftPost"
  945. 'SolCallback(34) = "bsMystery.SolOut"
  946. SolCallback(34) = "MysteryKick"
  947. '
  948. 'SolCallback(17) = "AdvFlashBool 17,"   'Amy Flasher
  949. 'SolCallback(18) = "AdvFlashBool 18,"   'Left Ramp Flasher
  950. 'SolCallback(19) = "AdvFlashBool 19,"   '2-Way Popper Flasher
  951. 'SolCallback(20) = "AdvFlashBool 20,"   'SkillShot Flasher
  952. 'SolCallback(21) = "AdvFlashBool 21,"   'Gray Gorilla Flasher
  953. 'SolCallback(25) = "AdvFlashBool 25,"   'Lower Right Flasher
  954. 'SolCallback(26) = "AdvFlashBool 26,"   'Right Ramp Flasher
  955. 'SolCallback(27) = "AdvFlashBool 27,"   'Volcano Flasher
  956. 'SolCallback(28) = "AdvFlashBool 28,"   'Perimeter Defense Flasher
  957.         DiverterSwoop.isdropped = 1
  958. Sub RampDiverter(enabled)
  959.     if Enabled Then
  960.         Diverter.rotatetoend
  961.         DiverterSwoop.isdropped = 0
  962.     else
  963.         Diverter.rotatetostart
  964.         DiverterSwoop.isdropped = 1
  965.     End If
  966. End Sub
  967.  
  968. SolModCallback(17) = "AdvFlash 17," 'Amy Flasher
  969. SolModCallback(18) = "AdvFlash 18," 'Left Ramp Flasher
  970. SolModCallback(19) = "AdvFlash 19," '2-Way Popper Flasher
  971. SolModCallback(20) = "AdvFlash 20," 'SkillShot Flasher
  972. SolModCallback(21) = "AdvFlash 21," 'Gray Gorilla Flasher
  973. SolModCallback(25) = "AdvFlash 25," 'Lower Right Flasher
  974. SolModCallback(26) = "AdvFlash 26," 'Right Ramp Flasher
  975. SolModCallback(27) = "AdvFlash 27," 'Volcano Flasher
  976. SolModCallback(28) = "AdvFlash 28," 'Perimeter Defense Flasher
  977.  
  978. sub TBtestfading_timer()
  979. '   me.text = f4l.fadespeedup & vbnewline & f4l.fadespeeddown & vbnewline & f4l.intensity & vbnewline & f4l.state & vbnewline & f4l.intensityscale
  980.     me.text = f8l1.fadespeedup & vbnewline & f8l1.fadespeeddown & vbnewline & f8l1.intensity & vbnewline & f8l1.state & vbnewline & f8l1.intensityscale
  981.  
  982. end sub
  983.  
  984. 'array of fading levels
  985. dim fFadeSpeedUp(50, 3)
  986. dim fFadeSpeedDown(50, 3)
  987. dim fIntensity(50, 3)
  988. Dim LastMod(50)
  989.  
  990. InitFlasherFadeSpeeds
  991. sub InitFlasherFadeSpeeds   'don't copy this it's dumb. Just use intensityscale and state
  992.     dim x
  993.     for each x in Fflashers
  994.         x.intensityscale = 1.25 'meh
  995.     next
  996.     for x = 0 to UBOUND(lastMod) : lastmod(x) = 0 : next
  997.     Fcategorize 0, 17, F1L      'amy
  998.     Fcategorize 1, 17, F1L2     'Amy
  999.  
  1000.     Fcategorize 0, 18, F2L      'left ramp Flasher
  1001.  
  1002.     Fcategorize 0, 19, F3L      '2-way popper
  1003.  
  1004.     Fcategorize 0, 20, F4L      'Skillshot flasher
  1005. '  
  1006.     Fcategorize 0, 21, F5L      'Gorilla
  1007.     Fcategorize 1, 21, F5L2     'Gorilla
  1008. '  
  1009.     Fcategorize 0, 25, F6L      'lower right Flasher
  1010.     Fcategorize 1, 26, F7L      'right ramp flasher
  1011. '  
  1012.     Fcategorize 0, 27, F8L      'Volcano
  1013.     Fcategorize 1, 27, F8L1
  1014.     Fcategorize 2, 27, F8L2
  1015.     Fcategorize 3, 27, F8L3
  1016. '
  1017.     Fcategorize 0, 28, F9L      'Perimeter Defense Flasher
  1018.     Fcategorize 1, 28, F9L2
  1019. end sub
  1020.  
  1021. Sub Fcategorize(col, sol, Object)   'column, sol number, object
  1022.     fFadeSpeedUp(sol, col) = object.fadespeedup
  1023.     fFadeSpeedDown(sol, col) = object.Fadespeeddown
  1024.     fIntensity(sol, col) = object.intensity
  1025. '   object.intensityscale = 0
  1026.     object.state = 0
  1027. '   object.fadespeeddown = object.fadespeeddown*1.45    'quick adjustments in here
  1028. '   object.fadespeedup = object.fadespeedup*0.3375  'quick adjustments in here
  1029.  
  1030.     object.fadespeeddown = object.fadespeeddown*1.45    'quick adjustments in here
  1031. '   object.fadespeedup = object.fadespeedup*0.3375  'quick adjustments in here
  1032. end sub
  1033. '287.32394366197183098591549295775
  1034.  
  1035.  
  1036. 'x = intensityscale y = gistep
  1037. 'x1= 0.1125 y1= 0
  1038. 'x2= 1   y2= 255
  1039.  
  1040. 'solve for slope
  1041. ''m = (y2 - y1) / (x2 - x1)
  1042. '   (255 - 0) / (1 - 0.15)
  1043. 'm = 300
  1044. 'point slope formula
  1045. 'y - y1 = m(x-x1)
  1046.  
  1047. 'y - (0) = 300(x-0.15)
  1048.  
  1049. '   y - 0 = 329.03225806451612903225806451613(x-0.225)
  1050.  
  1051.  
  1052. ' 0.15 --- x = (y+45)/300
  1053. 'x = (31 y)/10200+9/40
  1054. 'x = y / 300
  1055. 'y = 510 x-254.
  1056. 'x = (y + 254) / 510
  1057.  
  1058.  
  1059. Sub AdvFlashBool(nr, Enabled)   'this sucks a lot. Will remake later using arrays.
  1060.     x = ABS(cInt(Enabled) )
  1061.     select case nr
  1062.         case 17
  1063.             F1L.state = x
  1064.             f1l2.state = x
  1065.         Case 18
  1066.             if Enabled and not FlippersEnabled then polltimer.enabled = 1
  1067.             F2L.state = x
  1068.         Case 19
  1069.             F3L.state = x
  1070.         case 20
  1071.             F4L.state = x
  1072.         case 21
  1073.             F5L.state = x
  1074.             F5L2.state = x
  1075.         Case 25
  1076.             F6l.state = x
  1077.         case 26
  1078.             f7l.state = x
  1079.         case 27
  1080.             f8l.state = x
  1081.             f8l1.state = x
  1082.             f8l2.state = x
  1083.             f8l3.state = x
  1084.         case 28
  1085.             f9l.state = x
  1086.             f9l2.state = x
  1087.     end select
  1088. end sub
  1089.  
  1090. Sub AdvFlash(nr, value) 'this sucks a lot. Will remake later using arrays.
  1091.     '   if value > lastmod(nr) then         'dynamic Fading 'meh
  1092.     '       advFlashBool nr, True
  1093.     '   elseif value < lastmod(nr) Then
  1094.     '       advFlashBool nr, False
  1095.     '   end if
  1096.     '   LastMod(nr) = value
  1097.     dim i
  1098. '   i = value * 0.00392 'convert integer to percent
  1099.     i = (value * 0.00392) +0.1125   'convert integer to percent then + 11%
  1100. '   i = (value + 254) / 510 'different formula (0.5 intensity min, 1 max)
  1101. '   i = ((value /300) + 0.15)
  1102. '   i = value
  1103.     if value = 0 then advFlashBool nr, False else advFlashBool nr, True
  1104.     select case nr
  1105.         case 17
  1106.             f1l.intensity = fIntensity(nr, 0) * i
  1107. '           f1l.intensityscale = 1
  1108.             f1l2.intensity = fIntensity(nr, 1) * i
  1109. '           f1l2.intensityscale = 1
  1110.  
  1111. '           f1l.intensityscale = i
  1112. '           f1l.fadespeedup = fFadeSpeedUp(17, 0)*i
  1113. '           f1l.fadespeeddown = fFadeSpeedDown(17, 0)*i
  1114. ''          f1l2.intensityscale = i
  1115. '           f1l2.fadespeedup = fFadeSpeedUp(17, 1)*i
  1116. '           f1l2.fadespeeddown = fFadeSpeedDown(17, 1)*i
  1117.         case 18
  1118. '           f2l.intensityscale = i
  1119.             f2l.intensity = fIntensity(nr, 0) * i
  1120.             f2l.intensityscale = 1
  1121.  
  1122. '           f2l.fadespeedup = fFadeSpeedUp(18, 0)*i
  1123. '           f2l.fadespeeddown = fFadeSpeedDown(18, 0)*i
  1124.         case 19
  1125. '           f3l.intensityscale = i
  1126.             f3l.intensity = fIntensity(nr, 0) * i
  1127. '           f3l.intensityscale = 1
  1128.  
  1129. '           f3l.fadespeedup = fFadeSpeedUp(19, 0)*i
  1130. '           f3l.fadespeeddown = fFadeSpeedDown(19, 0)*i
  1131.         case 20
  1132. '           if value < 5 then
  1133. '               F4L.state = 0
  1134. '           else
  1135. '               F4L.state = 1
  1136. '           end if
  1137.             f4l.intensity = fIntensity(nr, 0) * i
  1138. '           f4l.intensityscale = 1
  1139. '           f4l.intensityscale = i
  1140.  
  1141. '           f4l.fadespeedup = fFadeSpeedUp(20, 0)*i
  1142. '           f4l.fadespeeddown = fFadeSpeedDown(20, 0)*i
  1143.         case 21
  1144.             f5l.intensity = fIntensity(nr, 0) * i
  1145. '           f5l.intensityscale = 1
  1146. '           f5l.intensityscale = i
  1147.  
  1148. '           f5l.fadespeedup = fFadeSpeedUp(21, 0)*i
  1149. '           f5l.fadespeeddown = fFadeSpeedDown(21, 0)*i
  1150.  
  1151.             f5l2.intensity = fIntensity(nr, 0) * i
  1152. '           f5l2.intensityscale = 1
  1153. '           f5l2.intensityscale = i
  1154. '           f5l2.fadespeedup = fFadeSpeedUp(21, 1)*i
  1155. '           f5l2.fadespeeddown = fFadeSpeedDown(21, 1)*i
  1156.         case 25
  1157.             f6l.intensity = fIntensity(nr, 0) * i
  1158. '           f6l.intensityscale = 1
  1159. '           f6l.intensityscale = i
  1160.  
  1161. '           f6l.fadespeedup = fFadeSpeedUp(25, 0)*i
  1162. '           f6l.fadespeeddown = fFadeSpeedDown(25, 0)*i
  1163.         case 26
  1164.             f7l.intensity = fIntensity(nr, 0) * i
  1165. '           f7l.intensityscale = 1
  1166. '           f7l.intensityscale = i
  1167. '
  1168. '           f7l.fadespeedup = fFadeSpeedUp(26, 0)*i
  1169. '           f7l.fadespeeddown = fFadeSpeedDown(26, 0)*i
  1170.         case 27
  1171.             f8l.intensity = fIntensity(nr, 0) * i
  1172. '           f8l.intensityscale = 1
  1173.             f8l1.intensity = fIntensity(nr, 1) * i
  1174. '           f8l1.intensityscale = 1
  1175.             F8L2.intensity = fIntensity(nr, 2) * i
  1176. '           F8L2.intensityscale = 1
  1177.             F8L3.intensity = fIntensity(nr, 3) * i
  1178. '           F8L3.intensityscale = 1
  1179.  
  1180.  
  1181. ''          f8l.intensityscale = i
  1182. '           f8l.fadespeedup = fFadeSpeedUp(27, 0)*i
  1183. '           f8l.fadespeeddown = fFadeSpeedDown(27, 0)*i
  1184. ''          f8l1.intensityscale = i
  1185. '           f8l1.fadespeedup = fFadeSpeedUp(27, 1)*i
  1186. '           f8l1.fadespeeddown = fFadeSpeedDown(27, 1)*i
  1187. ''          F8L2.intensityscale = i
  1188. '           F8L2.fadespeedup = fFadeSpeedUp(27, 2)*i
  1189. '           F8L2.fadespeeddown = fFadeSpeedDown(27, 2)*i
  1190. ''          f8l3.intensityscale = i
  1191. '           f8l3.fadespeedup = fFadeSpeedUp(27, 3)*i
  1192. '           f8l3.fadespeeddown = fFadeSpeedDown(27, 3)*i
  1193.         Case 28
  1194.             f9l.intensity = fIntensity(nr, 0) * i
  1195. '           f9l.intensityscale = 1
  1196.             f9l2.intensity = fIntensity(nr, 1) * i
  1197. '           f9l2.intensityscale = 1
  1198.  
  1199. '
  1200. ''          f9l.intensityscale = i
  1201. '           f9l.fadespeedup = fFadeSpeedUp(28, 0)*i
  1202. '           f9l.fadespeeddown = fFadeSpeedDown(28, 0)*i
  1203. ''          f9l2.intensityscale = i
  1204. '           f9l2.fadespeedup = fFadeSpeedUp(28, 1)*i
  1205. '           f9l2.fadespeeddown = fFadeSpeedDown(28, 1)*i
  1206.     end select
  1207. End Sub
  1208.  
  1209.  
  1210. 'ball tracking
  1211. Sub MysteryKick(enabled): if bsMystery.hasball then bip = bip + 1 end if: bsmystery.ExitSol_On : end sub
  1212. Sub MapKick(enabled): if bsMap.hasball then bip = bip + 1 end if : bsmap.ExitSol_On : end sub
  1213. 'Sub VolcanoKick(enabled): bsVolcano.SolOut True    :   if bsVolcano.balls > 0 then bip = bip + 1 end if : end sub
  1214.  
  1215. sub tBIP_timer()
  1216.     me.text = BIP
  1217. end sub
  1218.  
  1219. Sub RightGateOn(Enabled)
  1220.     If Enabled Then
  1221.     gate4.open = True
  1222.     Else
  1223.     gate4.open = False
  1224.     End If
  1225. End Sub
  1226.  
  1227. Sub LeftGateOn(Enabled)
  1228.     If Enabled Then
  1229.     gate2.open = True
  1230.     Else
  1231.     gate2.open = False
  1232.     End If
  1233. End Sub
  1234.  
  1235. Sub Auto_Plunger(Enabled)
  1236.     If Enabled Then
  1237.        AutoPlunger.Fire
  1238.        PlaySound SoundFX("fx_solenoid",DOFContactors)
  1239.     else
  1240.        AutoPlunger.Pullback
  1241.     End If
  1242. End Sub
  1243.  
  1244. Sub Kick_Back(Enabled)
  1245.     If Enabled Then
  1246.        KickBack.Fire
  1247.        PlaySound SoundFX("fx_solenoid",DOFContactors)
  1248.     else
  1249.        KickBack.Pullback
  1250.     End If
  1251. End Sub
  1252.  
  1253. Sub SolRelease(Enabled) 'ball tracking
  1254.    If Enabled And bsTrough.Balls > 0 Then
  1255.         vpmTimer.PulseSw 31
  1256.         bsTrough.ExitSol_On
  1257.         bip = bip + 1
  1258.     End If
  1259. End Sub
  1260.  
  1261. 'Pop up
  1262. Sub SolPopUp(Enabled)
  1263.     if bsAmyVuk.hasball then bip = bip + 1
  1264.     If Enabled Then
  1265.         bsAmyVuk.SolOutAlt 0
  1266. '       bsAmyVuk.SolOut 'Up
  1267.         bsAmyVuk.ExitSol_On
  1268.     Else
  1269.         bsAmyVuk.SolOutAlt 1    'Down
  1270.     End If
  1271. End Sub
  1272.  
  1273. '   (Public) .solOut           - Fire the primary exit kicker.  Ejects ball if one is present.
  1274. '   (Public) .solOutAlt        - Fire the secondary exit kicker.  Ejects ball with alternate forces if present.
  1275.  
  1276. 'Pop down
  1277. Sub SolPopDown(Enabled)
  1278.     if bsAmyVuk.hasball then bip = bip + 1
  1279.     If Enabled Then
  1280.         bsAmyVuk.SolOutAlt 1'down
  1281.         bsAmyVuk.ExitSol_On
  1282.         'bsAmyVuk.ExitSol_On
  1283.     Else
  1284.         bsAmyVuk.ExitSol_On     'Up
  1285.     End If
  1286. End Sub
  1287.  
  1288.  
  1289. ' Left Post
  1290. Sub SolLeftpost(Enabled)
  1291.     If Enabled Then
  1292.         LeftPost.IsDropped = 0
  1293.         LeftPost_invis.IsDropped = 0
  1294.     Else
  1295.         LeftPost.IsDropped = 1
  1296.         LeftPost_invis.IsDropped = 1
  1297.     End If
  1298. End Sub
  1299.  
  1300. Sub AmyRampTrigger_Hit()
  1301.     activeball.vely = activeball.vely * 0.5
  1302.     activeball.velx = activeball.velx * 0.5
  1303.     playsound "drop_mono", 0, 0.2, -0.1
  1304. End Sub
  1305.  
  1306. ' Top Post - Lock
  1307. Sub SolTopPost(Enabled)
  1308.     If Enabled Then
  1309.         TopPost.IsDropped = 1
  1310.     Else
  1311.         TopPost.IsDropped = 0
  1312.     End If
  1313. End Sub
  1314.  
  1315.  
  1316.  
  1317. 'Grey Gorilla Scripting
  1318. '-===================
  1319.  
  1320. 'go5 is -10
  1321. 'g02 is 0
  1322. 'go3 is 10
  1323.  
  1324. Dim Gordest
  1325. dim GorAngle
  1326. Gordest = 0
  1327. gorangle = 0    'starting angle
  1328.  
  1329. Sub GorillaTimer_Timer()
  1330.     If Gordest = 0 and GorAngle > 0 Then    'If 0
  1331.         GorAngle = GorAngle - 4 'formerly 2
  1332.     ElseIf Gordest = 0 and GorAngle < 0 Then
  1333.         GorAngle = GorAngle + 4
  1334.     ElseIf Gordest = 10 and GorAngle < 10 Then  'if 10
  1335.         GorAngle = GorAngle + 4
  1336.     Elseif Gordest = -10 and GorAngle > -10 Then    'if -10
  1337.         GorAngle = GorAngle - 4
  1338.     Else
  1339. '       me.Enabled = 0
  1340.     End If
  1341. '   textbox1.text = gorangle
  1342.     Gorilla.objRotZ = GorAngle
  1343. End Sub
  1344.  
  1345. sub GorillaTimerShutoff_Timer()
  1346.     GorillaTimer.enabled = 0
  1347.     me.enabled = 0
  1348. end sub
  1349.    
  1350.  
  1351. ' Gorilla Right
  1352. Sub GorillaRight(Enabled)   '...left        '-76 start -105 end
  1353.     If Enabled Then
  1354.         GorillaTimer.enabled = 1
  1355.         GorillaTimerShutoff.interval = 10000
  1356.         GorillaTimerShutoff.enabled = 1
  1357. '       GiON 'is this necessary?
  1358.         PlaySound SoundFx("Solenoid",DOFContactors)
  1359. '       GorillaTimer.Enabled = 1
  1360.         GoFlipperRight.Startangle = 76
  1361.         GoFlipperLeft.RotateToEnd
  1362.         GoFlipperRight.RotateToStart
  1363.         GoFlipperLeft.startangle = -100
  1364.         Gordest = 0
  1365. '       Textbox2.text = "ENABLED"
  1366.     Else
  1367. '       giOFF
  1368.         PlaySound SoundFx("Solenoidoff",0)
  1369.         GoFlipperLeft.RotateToStart
  1370.         GorDest = -10
  1371. '       Textbox2.text = "0"
  1372.     End If
  1373. End Sub
  1374.  
  1375.  
  1376. ' Gorilla Left
  1377. Sub GorillaLeft(Enabled)    '...right       '76 start 105 end
  1378.     If Enabled Then
  1379.         GorillaTimer.enabled = 1
  1380.         GorillaTimerShutoff.interval = 10000
  1381.         GorillaTimerShutoff.enabled = 1
  1382.         PlaySound SoundFx("Solenoid",DOFContactors)
  1383.         GoFlipperRight.RotateToEnd
  1384.         GoFlipperLeft.Startangle = -76
  1385.         GoFlipperLeft.RotateToStart
  1386.         GoFlipperRight.startangle = 100
  1387.         Gordest = 0
  1388. '       Textbox3.text = "ENABLED"
  1389.     Else
  1390.         PlaySound SoundFx("Solenoidoff",0)
  1391.         GoFlipperRight.RotateToStart
  1392.         Gordest = 10
  1393. '       Textbox3.text = "0"
  1394.     End If
  1395. End Sub
  1396.  
  1397. '=-======================
  1398. '------
  1399. '0999999999999
  1400. '36444444444444
  1401.  
  1402.  
  1403. '===================
  1404. 'Disconnected Flippers
  1405. dim bip:bip = 0 'Click here to collapse this section
  1406.     dim discoflips:discoflips = 0
  1407.  
  1408.  
  1409.  
  1410. '1- Special Flipper Behaviors
  1411.  
  1412.     sub DisconnectFlippers 'engages special flipper polling behavior, call after flippers kick out / ball leaves shooter lane
  1413.         LightSol_L.color = RGB(0, 255, 0)
  1414.         LightSol_L1.color = RGB(0, 255, 0)
  1415.         LightSol_R.color = RGB(0, 255, 0)
  1416.         LightSol_L.colorfull = RGB(55, 255, 55)
  1417.         LightSol_L1.colorfull = RGB(55, 255, 55)
  1418.         LightSol_R.colorfull = RGB(55, 255, 55)
  1419.         DiscoFlips = 1
  1420.     '   controller.switch(swLLFlip) = True
  1421.     '   pollstep = 0
  1422.         Clockstep = 0
  1423.         if FastFlips = 0 then clockstep = 20
  1424.     '   pollflippers.interval = 128 'idk
  1425.         if leftflipperon = 1 Then       'When going from green to red, sometimes flipper gets stuck on 'todo fix this nonsense
  1426. '           leftflipper.rotatetoend
  1427.         Else
  1428.             leftflipper.rotatetostart
  1429.             ULeftFlipper.rotatetostart
  1430.             leftflipper.eostorque = defaultEOS
  1431.         end if
  1432.         if rightflipperon = 1 Then      'When going from green to red
  1433. '           rightflipper.rotatetoend
  1434.         Else
  1435.             rightflipper.rotatetostart
  1436.             rightflipper.eostorque = defaultEOS
  1437.         end if
  1438.     end sub
  1439.  
  1440.     sub DisconnectFlippers2 'Called from flipper up, no adjustments
  1441.         LightSol_L.color = RGB(0, 255, 0)
  1442.         LightSol_L1.color = RGB(0, 255, 0)
  1443.         LightSol_R.color = RGB(0, 255, 0)
  1444.         LightSol_L.colorfull = RGB(55, 255, 55)
  1445.         LightSol_L1.colorfull = RGB(55, 255, 55)
  1446.         LightSol_R.colorfull = RGB(55, 255, 55)
  1447.         DiscoFlips = 1
  1448.     '   controller.switch(swLLFlip) = True
  1449.     '   pollstep = 0
  1450.         Clockstep = 0
  1451.     end sub
  1452.  
  1453.     sub DefaultFlipperControl 'returns everything back to default
  1454.         if leftflipperon = 1 Then       'When going from green to red, sometimes flipper gets stuck on
  1455.             controller.switch(swLLFlip) = True
  1456.         Else
  1457.             controller.switch(swLLFlip) = False
  1458.         end if
  1459.         if rightflipperon = 1 Then      'When going from green to red
  1460.             controller.switch(swLRFlip) = True
  1461.         Else
  1462.             controller.switch(swLRFlip) = False
  1463.         end if
  1464.         LightSol_L.color = RGB(255, 0, 0)
  1465.         LightSol_L1.color = RGB(255, 0, 0)
  1466.         LightSol_R.color = RGB(255, 0, 0)
  1467.         LightSol_L.colorfull = RGB(255, 55, 55)
  1468.         LightSol_L1.colorfull = RGB(255, 55, 55)
  1469.         LightSol_R.colorfull = RGB(255, 55, 55)
  1470.         DiscoFlips = 0
  1471.         if FastFlips = 0 then clockstep = 20
  1472. '       discolamps = 1  'changelane thing ignore me
  1473.     '   pollstep = 0
  1474.     end sub
  1475.  
  1476. sub tbnf_timer()
  1477.     me.text = "DiscoFlips:" & discoflips & vbnewline & "polltimer: " & polltimer.enabled & vbnewline & "clockstep:" & clockstep & vbnewline & " DiscoVar:" & DisconnectFlippersV & vbnewline & " tiltsol:" & FlippersEnabled
  1478. end sub
  1479.  
  1480.  
  1481.  
  1482. '2 - The timer itself
  1483.  
  1484. 'dim SolLon, SolRon, SolULon
  1485.  
  1486.     DefaultFlipperControl
  1487.     dim Clockstep:clockstep = 0
  1488.     dim BallSearchStep:BallSearchStep = 0
  1489.  
  1490.     Sub PollTimer_Timer()
  1491.         Select Case Clockstep
  1492.             case 0                                  'send L
  1493.                 controller.switch(118) = True
  1494. '               if discoflips = 1 then discoflips = 2 'lag compensation to prevent stickiness
  1495.                 clockstep = 1
  1496. '               light1.state = 1
  1497. '               ballsearchstep = ballsearchstep + 1
  1498.             case 1                                  'receive L and poll
  1499.                 controller.switch(118) = False
  1500.                 if bip = 0 Then 'if no balls are in play, disable this sub
  1501.                     Clockstep = 9
  1502.                 elseif SolULon Then
  1503.                     TiltSol(True)   'returns clockstep to 0
  1504.                 elseif not SolULon Then 'if no solenoid callback,
  1505.                     if FlippersEnabled = True Then TiltSol(False)   'tilt 'returns clockstep to 0
  1506.                 End if
  1507. '               if ballsearchstep > 10 then ballsearchstep = 0: ballsearch : end if
  1508.             Case 9 'disabled, red
  1509.                 if bip = 0 then
  1510.                     DefaultFlipperControl
  1511.                 Else
  1512. '                   DisconnectFlippers  'this will return clockstep back to 0
  1513.                     DisconnectFlippersV = 1
  1514. '                   clockstep = 0'this will return clockstep back to 0
  1515.                     PollTimer.interval = 200
  1516.                 end if
  1517.             Case 15 ' ballsearch case
  1518.                 DefaultFlipperControl
  1519.                 if BIP = 0 then clockstep = 0
  1520.             Case 20 ' Disabled
  1521.                
  1522.         end Select
  1523.     end sub
  1524.  
  1525.     Sub Ballsearch  'uses getballs to detect stuck balls and returns flipper controls so fliptronics can clear them (Hopefully seamlessly)
  1526. '       exit sub
  1527.         if BIP = 0 then exit Sub    'this whole sub is unused on this table
  1528.         dim BOT, x, d, xx, yy
  1529.         BOT = GetBalls
  1530.         If UBound(BOT) = 0 Then tBallstuck.text = "ubound = " & Ubound(bot) & "exitsub" : Exit Sub : End If
  1531.         for x = 0 to Ubound(BOT)
  1532.             On Error Resume Next
  1533.             xx = BOT(x).velx
  1534.             yy = BOT(x).vely
  1535.             d = cInt(xx * yy)
  1536.             if d > 2 then
  1537.                 exit for    'can you do this in a for loop?
  1538.             Else
  1539. '               Clockstep = 15
  1540.             end if
  1541.         next
  1542.         tBallstuck.text = "balls: " & Ubound(BOT) & " vel:" & d
  1543.         tBallstuck.timerenabled = 1
  1544.     End Sub
  1545.     sub tBallstuck_Timer : me.timerenabled = 0 : me.text = " " : end sub    'reset textbox
  1546.  
  1547. Sub RollingUpdateXX()
  1548.     Dim BOT, b
  1549.     BOT = GetBalls
  1550.  
  1551.     ' stop the sound of deleted balls
  1552.    For b = UBound(BOT) + 1 to tnob
  1553.         rolling(b) = False
  1554.         StopSound("fx_ballrolling" & b)
  1555.     Next
  1556.  
  1557.     ' exit the sub if no balls on the table
  1558.    If UBound(BOT) = -1 Then Exit Sub
  1559.  
  1560.     ' play the rolling sound for each ball
  1561.    For b = 0 to UBound(BOT)
  1562.         If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  1563.             rolling(b) = True
  1564.             PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1565.         Else
  1566.             If rolling(b) = True Then
  1567.                 StopSound("fx_ballrolling" & b)
  1568.                 rolling(b) = False
  1569.             End If
  1570.         End If
  1571.     Next
  1572. End Sub
  1573.  
  1574.  
  1575.  
  1576.  
  1577. '2 - Tilt Sub
  1578. dim FlippersEnabled
  1579. Sub TiltSol(Enabled)    'designed to work off a solenoid that stays on, so FALSE = tilted
  1580.     FlippersEnabled = Enabled   'handles flippers
  1581.         DisconnectFlippers
  1582.         PollTimer.interval = 200
  1583.     if Enabled Then
  1584. '       textboxTILT.text = " "
  1585.         vpmnudge.solgameon true
  1586.     Elseif not Enabled Then
  1587. '       textboxTILT.text = "TILT"
  1588.         DefaultFlipperControl   'necessary for fliptronics
  1589.         polltimer.enabled = 0   'renabled by: drain when BIP = 0, LPF lamps, left ramp flasher?
  1590.         PollTimer.interval = 64 'fast polling when tilted
  1591.         vpmnudge.solgameon false
  1592.         if leftflipper.startangle > leftflipper.endangle Then
  1593.             if leftflipper.currentangle < leftflipper.startangle then leftflipper.rotatetostart : leftflippersound 0 : end if
  1594.         elseif leftflipper.startangle < leftflipper.endangle Then
  1595.             if leftflipper.currentangle > leftflipper.startangle then leftflipper.rotatetostart : leftflippersound 0 : end If
  1596.         end If
  1597.         if rightflipper.startangle > rightflipper.endangle Then
  1598.             if rightflipper.currentangle < rightflipper.startangle then rightflipper.rotatetostart : rightflippersound 0 : end if
  1599.         elseif rightflipper.startangle < rightflipper.endangle Then
  1600.             if rightflipper.currentangle > rightflipper.startangle then rightflipper.rotatetostart : rightflippersound 0 : end If
  1601.         end If
  1602.         ULeftFlipper.rotatetostart
  1603.     end if
  1604.     clockstep = 0
  1605.     if FastFlips = 0 then clockstep = 20
  1606. end sub
  1607.  
  1608. '#end region
  1609.  
  1610. '-----end disconnect flippers
  1611.  
  1612. dim DisconnectFlippersV: DisconnectFlippersV = 0
  1613. 'flippersenabled = from the old tilt routine (reliant on sol callbacks so not hugely relevant here)
  1614. sub flipnf(LR, DU)  'object, left-right, downup         'using object lags this script to hell, don't do it
  1615. '   if DU = 1 then if DisconnectFlippersV = 1 then DisconnectFlippersV = 0 :DisconnectFlippers2 'called from flipper up only
  1616.     if DisconnectFlippersV = 1 then DisconnectFlippersV = 0 :DisconnectFlippers2    'called from flipper up and flipper down
  1617.     if discoflips = 1 then
  1618.         if LR = 0 Then      'left flipper
  1619.             if DU = 1 then
  1620.                 If FlippersEnabled = True then
  1621.                     leftflipper.rotatetoend
  1622.                     ULeftFlipper.rotatetoend
  1623.                     LeftFlipperSound 1
  1624.                 end if
  1625.                 controller.Switch(swLLFlip) = True
  1626.             Elseif DU = 0 then
  1627.                 If FlippersEnabled = True then
  1628.                     leftflipper.rotatetoStart
  1629.                     ULeftFlipper.rotatetostart
  1630.                     LeftFlipperSound 0
  1631.                 end if
  1632.                 controller.Switch(swLLFlip) = False                        
  1633.             end if
  1634.         elseif LR = 1 then      ''right flipper
  1635.             if DU = 1 then
  1636.                 If FlippersEnabled = True then
  1637.                     RightFlipper.rotatetoend
  1638.                     RightFlipperSound 1
  1639.                 end if
  1640.                 controller.Switch(swLRFlip) = True
  1641.             Elseif DU = 0 then
  1642.                 If FlippersEnabled = True then
  1643.                     RightFlipper.rotatetoStart
  1644.                     RightFlipperSound 0
  1645.                 end if
  1646.                 controller.Switch(swLRFlip) = False                    
  1647.             end if
  1648.         end if
  1649.     end if
  1650. end sub
  1651.  
  1652. sub flipnfSOL(LR, DU)   'flipnf without the switches, no tilt cutoff
  1653.     if discoflips = 0 then      'whole sub conditional on discoflips, not flippersenabled
  1654.         if LR = 0 Then      'left flipper
  1655.             if DU = 1 then
  1656.                 leftflipper.rotatetoend
  1657.                 LeftFlipperSound 1
  1658.             Elseif DU = 0 then
  1659.                 leftflipper.rotatetoStart
  1660.                 ULeftFlipper.rotatetostart
  1661.                 LeftFlipperSound 0                     
  1662.             end if
  1663.         elseif LR = 1 then      ''right flipper
  1664.             if DU = 1 then
  1665.                 RightFlipper.rotatetoend
  1666.                 RightFlipperSound 1
  1667.             Elseif DU = 0 then
  1668.                 RightFlipper.rotatetoStart
  1669.                 RightFlipperSound 0
  1670.             end if
  1671.         elseif LR = 2 then      ''ULeftFlipper
  1672.             if DU = 1 then
  1673.                 ULeftFlipper.rotatetoend
  1674.             Elseif DU = 0 then
  1675.                 ULeftFlipper.rotatetoStart
  1676.             end if
  1677.         end if
  1678.     end if
  1679. end sub
  1680.  
  1681. sub LeftFlipperSound(updown)'called along with the flipper, so feel free to add stuff, EOStorque tweaks, animation updates, upper flippers, whatever.
  1682.     if updown = 1 Then
  1683.         playsound SoundFX("fx_Flipperup",DOFContactors), 1, 0.5, -0.02  'flip       'name,loopcount,volume,pan,randompitch
  1684.     Else
  1685.         if LeftFlipper.CurrentAngle = LeftFlipper.StartAngle then
  1686.             LeftFlipper.eostorque = defaultEOS
  1687.         Else
  1688.         playsound SoundFX("fx_Flipperdown",DOFContactors), 1, 0.8, -0.01 'return
  1689.         LeftFlipper.eostorque = defaultEOS
  1690.         end if
  1691.     end if
  1692. end sub
  1693. sub RightFlipperSound(updown)
  1694.     if updown = 1 Then
  1695.         playsound SoundFX("fx_Flipperup",DOFContactors), 1, 0.5, 0.02   'flip
  1696.     Else
  1697.         if RightFlipper.CurrentAngle = RightFlipper.StartAngle then
  1698.             RightFlipper.eostorque = defaultEOS
  1699.         Else
  1700.         playsound SoundFX("fx_Flipperdown",DOFContactors), 1, 0.8, 0.01 'return
  1701.         RightFlipper.eostorque = defaultEOS
  1702.         end if
  1703.     end if
  1704. end sub
  1705.  
  1706. '====================
  1707. '   -NEW     HARD
  1708. '       FLIPS
  1709. '====================
  1710. 'just switches EOStorque when hit
  1711. 'const HardFlips = 1    'move me!
  1712. dim defaultEOS, hardEOS
  1713. defaultEOS = LeftFlipper.eostorque
  1714. hardEOS = 2200 / LeftFlipper.strength   'eos equivalent to 2200 strength
  1715. if HardFlips = 0 then TriggerLF.enabled = 0 : TriggerRF.enabled = 0 end if
  1716.  
  1717. Sub TriggerLF_Hit()
  1718.     dim finalspeed
  1719.     finalspeed = SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1720.     If finalspeed > 3 then
  1721.         LeftFlipper.eostorque = hardEOS
  1722.     End if
  1723. end sub
  1724.  
  1725. Sub TriggerRF_Hit()
  1726.     dim finalspeed
  1727.     finalspeed = SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1728.     If finalspeed > 3 then
  1729.         RightFlipper.eostorque = hardEOS
  1730.     End if
  1731. end sub
  1732.  
  1733. '********************
  1734. ' Special JP Flippers
  1735. '********************
  1736.  
  1737.  SolCallback(sLRFlipper) = "SolRFlipper"
  1738.  SolCallback(sLLFlipper) = "SolLFlipper"
  1739.  SolCallback(sULFlipper) = "SolULFlipper"
  1740.  
  1741. dim SolLon, SolRon, SolULon
  1742. Sub SolLFlipper(Enabled)
  1743.     If Enabled Then
  1744. '        PlaySound SoundFX("fx_flipperup",DOFContactors), 0, 0.4, -0.05, 0.11
  1745. '        LeftFlipper.RotateToEnd
  1746.         flipnfSOL 0, 1
  1747.         LightSol_L.state = 1
  1748.     Else
  1749. '        PlaySound SoundFX("fx_flipperdown",DOFContactors), 0, 0.4, -0.05, 0.11
  1750. '        LeftFlipper.RotateToStart
  1751.         LightSol_L.state = 0
  1752.         flipnfSOL 0, 0
  1753.     End If
  1754.     SolLon = Enabled
  1755. End Sub
  1756.  
  1757. 'SoundFX("fx_flipperup",DOFContactors)
  1758. Sub SolRFlipper(Enabled)
  1759.     If Enabled Then
  1760. '        PlaySound SoundFX("fx_flipperup",DOFContactors), 0, 0.4, 0.05, 0.15
  1761. '        RightFlipper.RotateToEnd
  1762.         LightSol_R.state = 1
  1763.         flipnfSOL 1, 1
  1764.     Else
  1765. '        PlaySound SoundFX("fx_flipperdown",DOFContactors), 0, 0.4, 0.05, 0.15
  1766. '        RightFlipper.RotateToStart
  1767.         LightSol_R.state = 0
  1768.         flipnfSOL 1, 0
  1769.     End If
  1770.     SolRon = Enabled
  1771. End Sub
  1772. 'flipnf
  1773. Sub SolULFlipper(Enabled)
  1774.     If Enabled Then
  1775. '        PlaySound "fx_flipperup", 0, 0.5, -0.06, 0.15
  1776. '        ULeftFlipper.RotateToEnd
  1777.         LightSol_L1.state = 1
  1778.         flipnfSOL 2, 1
  1779.     Else
  1780. '        PlaySound "fx_flipperdown", 0, 0.5, -0.06, 0.15
  1781. '        ULeftFlipper.RotateToStart
  1782.         LightSol_L1.state = 0
  1783.         flipnfSOL 2, 0
  1784.     End If
  1785.     SolUlon = Enabled
  1786. End Sub
  1787.  
  1788.  
  1789. '================VP10 Fading Lamps Script
  1790.  
  1791. Dim LampState(200), FadingLevel(200)
  1792. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  1793.  
  1794. InitLamps()
  1795. LampTimer.Interval = 16
  1796. LampTimer.Enabled = 1
  1797.  
  1798.  
  1799. Sub LampTimer_Timer()
  1800.     Dim chgLamp, num, chg, ii
  1801.     chgLamp = Controller.ChangedLamps
  1802.     If Not IsEmpty(chgLamp) Then
  1803.         For ii = 0 To UBound(chgLamp)
  1804.             LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1)       'keep the real state in an array
  1805.            FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  1806.        Next
  1807.  
  1808.     End If
  1809.  
  1810.     UpdateLamps
  1811. End Sub
  1812.  
  1813. Sub UpdateLamps
  1814. '   NFadeL 11, L11
  1815.     NFadeLwf 11, L11, l11f
  1816.  
  1817. '   NFadeL 12, L12
  1818.     NFadeLwf 12, L12, l12f
  1819.  
  1820.     NFadeL 13, L13
  1821.  
  1822. '   NFadeL 14, L14
  1823.     NFadeLwf 14, L14, l14f
  1824.  
  1825. '   NFadeL 15, L15
  1826.     NFadeLwf 15, L15, l15f
  1827.  
  1828. '   NFadeL 16, L16  'A
  1829. '   NFadeL 17, L17  'M
  1830. '   NFadeL 18, L18  'Y
  1831.  
  1832.     NFadeLwF 16, L16, L16F  'A
  1833.     NFadeLwF 17, L17, L17F  'M
  1834.     NFadeLwF 18, L18, L18F  'Y
  1835.  
  1836.     NFadeL 21, L21
  1837.     NFadeL 22, L22
  1838. '   NFadeL 23, L23
  1839.     NFadeLwF 23, l23, l23f
  1840.     NFadeL 24, L24
  1841.     NFadeL 25, L25
  1842.     NFadeL 26, L26
  1843.     NFadeL 27, L27
  1844.     NFadeLwF 28, L28, l28f
  1845.  
  1846.     NFadeLwf 31, L31, l31f
  1847.  
  1848.  
  1849.     NFadeL 32, L32
  1850.     NFadeL 33, L33
  1851. '   NFadeLm 32, L32L
  1852.     NFadeLm 33, L33L
  1853.  
  1854.  
  1855.     NFadeL 34, L34
  1856.     NFadeL 35, L35
  1857.     NFadeL 36, L36
  1858.     NFadeL 37, L37
  1859.  
  1860.  
  1861.     NFadeLm 38, L38
  1862.     NFadeLm 38, L38L
  1863.  
  1864.     NFadeL 41, L41
  1865.     NFadeL 42, L42
  1866.  
  1867.     NFadeLwF 43, L43, L43f
  1868.     NFadeLwF 44, L44, L44f
  1869.  
  1870.     NFadeLwF 45, L45, l45f
  1871.     NFadeL 46, L46
  1872.     NFadeLwF 47, L47, l47f
  1873.     NFadeLwF 48, L48, l48f
  1874.    
  1875.     NFadeL 51, L51
  1876.     NFadeL 52, L52
  1877.     NFadeL 53, L53
  1878.     NFadeL 54, L54
  1879.     NFadeL 55, L55
  1880. '   NFadeL 56, L56
  1881.     NFadeLwF 56, L56, L56F
  1882.     NFadeL 57, L57
  1883.  
  1884.  
  1885. '   NFadeLm 58, L58
  1886. '   Flashb 58, L58
  1887.  
  1888.     NFadeLwF 58, L58, L58F
  1889. '   l58f.intensityscale = 0
  1890.    
  1891.     NFadeLwf 61, L61, l61f
  1892.     NFadeLA 62, L62
  1893.     NFadeL 63, L63
  1894.     NFadeL 64, L64
  1895.     NFadeL 65, L65 
  1896.     NFadeL 66, L66 
  1897.     NFadeL 67, L67
  1898.     NFadeLwF 68, L68, l68f 
  1899.    
  1900.     NFadeLwF 71, L71, l71f
  1901.     NFadeLwf 72, L72, l72f
  1902.     NFadeLwf 73, L73, l73f
  1903.  
  1904. '   NFadeLA 74, L74 'right lock
  1905.     NFadeLwFa 74, L74, l74f
  1906.  
  1907.     NFadeL 75, L75 
  1908.     NFadeL 76, L76 
  1909.     NFadeL 77, L77
  1910.     NFadeL 78, L78 
  1911.    
  1912.     NFadeLm 81, L81
  1913.     NFadeLm 81, L81l    'H
  1914.     NFadeL 82, L82
  1915.  
  1916. '   NFadeL 83, L83
  1917. '   NFadeL 84, L84
  1918. '   NFadeL 85, L85 
  1919.     NFadeLwF 83, L83, L83f
  1920.     NFadeLwF 84, L84, L84f
  1921.     NFadeLwF 85, L85, L85f
  1922.  
  1923.     NFadeL 86, L86  'Shoot Again
  1924. '   NFadeL 87, L87  'Not used
  1925. '   NFadeL 88, L88  'Start Button
  1926.  
  1927.    
  1928.    
  1929.     'Flashers
  1930.    
  1931. '117,"  'Amy Flasher
  1932. '118,"  'Left Ramp Flasher
  1933. '119,"  '2-Way Popper Flasher
  1934. '120,"  'SkillShot Flasher
  1935. '121,"  'Gray Gorilla Flasher f5L
  1936.  
  1937. '125,"  'Lower Right Flasher f6L
  1938. '126,"  'Right Ramp Flasher F7L
  1939. '127,"  'Volcano Flasher F8L
  1940. '128,"  'Perimeter Defense Flasher
  1941. '  
  1942. '   NFadeLMB 117, F1L
  1943. '   NFadeLMB 117, F1L2  'Amy
  1944. '   NFadeLBB 118, F2L
  1945. '   NFadeLBB 119, F3L
  1946. ''  NFadeL 120, F4L
  1947. '  
  1948. '   NFadeLm 121, F5L        'Gorilla
  1949. '   NFadeLm 121, F5L2       'Gorilla
  1950. '  
  1951. ''  NFadeL 125, F6L
  1952. '   NFadeL 126, F7L
  1953. '  
  1954. ''  NFadeObj 127, VolcanoPrim, "volcano_lavaoff", "volcano_lavaon" 
  1955. '   NFadeLMB 127, F8L       'Volcano
  1956. '   NFadeLMB 127, F8L1
  1957. '   NFadeLMB 127, F8L2
  1958. '   NFadeLMB 127, F8L3
  1959. '
  1960. '  
  1961. '   NFadeLMb 128, F9L   'Perimeter Defense Flasher
  1962. '   NFadeLMb 128, F9L2 
  1963. '
  1964. '   NFadeL 120, F4L
  1965. '
  1966. '   NFadeLbb 125, F6L
  1967.  
  1968.    
  1969. End Sub
  1970.  
  1971. Sub InitLamps()
  1972.     Dim x
  1973.     For x = 0 to 200
  1974.         LampState(x) = 0        ' current light state, independent of the fading level. 0 is off and 1 is on
  1975.        FadingLevel(x) = 4      ' used to track the fading state
  1976.        FlashSpeedUp(x) = 0.4   ' faster speed when turning on the flasher
  1977.        FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  1978.        FlashMax(x) = 1         ' the maximum value when on, usually 1
  1979.        FlashMin(x) = 0         ' the minimum value when off, usually 0
  1980.        FlashLevel(x) = 0       ' the intensity of the flashers, usually from 0 to 1
  1981.    Next
  1982. End Sub
  1983.  
  1984. Sub AllLampsOff
  1985.     Dim x
  1986.     For x = 0 to 200
  1987.         SetLamp x, 0
  1988.     Next
  1989. End Sub
  1990.  
  1991. Sub SetLamp(nr, value)
  1992.     If value <> LampState(nr) Then
  1993.         LampState(nr) = abs(value)
  1994.         FadingLevel(nr) = abs(value) + 4
  1995.     End If
  1996. End Sub
  1997.  
  1998. 'Walls
  1999.  
  2000. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  2001.  
  2002. Sub NFadeL(nr, object)
  2003.     Select Case FadingLevel(nr)
  2004.         Case 4:object.state = 0:FadingLevel(nr) = 0
  2005.         Case 5:object.state = 1:FadingLevel(nr) = 1
  2006.     End Select
  2007. End Sub
  2008.  
  2009. 'Light with flasher
  2010. Sub NFadeLwF(nr, object1, object2)
  2011.     Select Case FadingLevel(nr)
  2012.         Case 0:object2.intensityscale = 0
  2013.         Case 1:object2.intensityscale = 1
  2014.         Case 4:object1.state = 0:FadingLevel(nr) = 16
  2015.         Case 5:object1.state = 1:FadingLevel(nr) = 6':TextBox4.text = object1.fadespeedup   'to 6
  2016.  
  2017. '0.125 up, 0.125 down
  2018.         Case 6, 7, 8, 9, 10, 11, 12:If object2.intensityscale < 1 then Object2.intensityscale = object2.intensityscale + 0.125 else object2.intensityscale = 0.875 end if:FadingLevel(nr) = FadingLevel(nr) + 1
  2019.         Case 13:If object2.intensityscale < 1 then Object2.intensityscale = object2.intensityscale + 0.125 end if:FadingLevel(nr) = 1':TextBox4.text = "Case 11"
  2020.         Case 16, 17, 18, 19, 20, 21, 22:If object2.intensityscale > 0 then Object2.intensityscale = object2.intensityscale + -0.125 else object2.intensityscale = 0.125 end if:FadingLevel(nr) = FadingLevel(nr) + 1
  2021.         Case 23:If object2.intensityscale > 0 then Object2.intensityscale = object2.intensityscale + -0.125 end if:FadingLevel(nr) = 0':TextBox4.text = "Case 26"
  2022.    End Select
  2023. End Sub
  2024.  
  2025. Sub NFadeLwFa(nr, object1, object2)
  2026.     Select Case FadingLevel(nr)
  2027.         Case 0:object2.intensityscale = 0
  2028.         Case 1:object2.intensityscale = 1
  2029.         Case 4:object1.state = 0:FadingLevel(nr) = 16
  2030.         Case 5:object1.state = 1:FadingLevel(nr) = 6
  2031.  
  2032. '0.125 up, 0.125 down
  2033.         Case 6, 7, 8, 9, 10, 11, 12:If object2.intensityscale < 1 then Object2.intensityscale = object2.intensityscale + 0.125 else object2.intensityscale = 0.875 end if:FadingLevel(nr) = FadingLevel(nr) + 1
  2034.         Case 13:If object2.intensityscale < 1 then Object2.intensityscale = object2.intensityscale + 0.125 end if:FadingLevel(nr) = 1':TextBox4.text = "Case 11"
  2035.         Case 16, 17, 18, 19, 20, 21, 22:If object2.intensityscale > 0 then Object2.intensityscale = object2.intensityscale + -0.125 else object2.intensityscale = 0.125 end if:FadingLevel(nr) = FadingLevel(nr) + 1
  2036.         Case 23:If object2.intensityscale > 0 then Object2.intensityscale = object2.intensityscale + -0.125 end if:FadingLevel(nr) = 0':TextBox4.text = "Case 26"
  2037.    End Select
  2038. End Sub
  2039.  
  2040.  
  2041. Sub NFadeLB(nr, object)         'blinks
  2042.    Select Case FadingLevel(nr)
  2043.         Case 4:object.state = 0:FadingLevel(nr) = 0
  2044.         Case 5:object.state = 2:FadingLevel(nr) = 6
  2045.         case 6:object.state = 1::FadingLevel(nr) = 1':TextBox4.text = "AmyFade" 'lil extra before fading
  2046.    End Select
  2047. End Sub
  2048.  
  2049. Sub NFadeLBB(nr, object)            'blinks
  2050.    Select Case FadingLevel(nr)
  2051.         Case 4:object.state = 0:FadingLevel(nr) = 0
  2052.         Case 5:object.state = 2:FadingLevel(nr) = 1
  2053.     End Select
  2054. End Sub
  2055.  
  2056. Sub NFadeLA(nr, object)         'Light with extra diverter scripts  'reused for polltimer
  2057.    Select Case FadingLevel(nr)
  2058.         Case 4:object.state = 0:FadingLevel(nr) = 0
  2059.         Case 5:object.state = 1:FadingLevel(nr) = 1:if polltimer.enabled = 0 then polltimer.enabled = 1':LockIsLit = 1:AmyShot=0
  2060.    End Select
  2061. End Sub
  2062.  
  2063. Sub NFadeLm(nr, object) ' used for multiple lights
  2064.    Select Case FadingLevel(nr)
  2065.         Case 4:object.state = 0
  2066.         Case 5:object.state = 1
  2067.     End Select
  2068. End Sub
  2069.  
  2070. Sub NFadeLmB(nr, object) ' used for multiple lights, Blinks
  2071.    Select Case FadingLevel(nr)
  2072.         Case 4:object.state = 0
  2073.         Case 5:object.state = 2
  2074.         case 6:object.state = 1         'lil extra before fading
  2075.    End Select
  2076. End Sub
  2077.  
  2078. Sub NFadeLmf(nr, object) ' used for multiple lights working off FadeObj or FadePrim
  2079.    Select Case FadingLevel(nr)
  2080.         Case 1:object.state = 1
  2081.         Case 7:object.state = 0
  2082.     End Select
  2083. End Sub
  2084.  
  2085. Sub NFadeLF(nr, object) ' used for multiple lights working off FadeObj or FadePrim
  2086.    Select Case FadingLevel(nr)
  2087.         Case 1:object.state = 1
  2088.         Case 7:object.state = 0
  2089.     End Select
  2090. End Sub
  2091.  
  2092. Sub FadeLm(nr, a, b) 'Old
  2093.     Select Case LampState(nr)
  2094.         Case 2:b.state = 0
  2095.         Case 3:b.state = 1
  2096.         Case 4:a.state = 0
  2097.         Case 5:b.state = 1
  2098.         Case 6:a.state = 1
  2099.     End Select
  2100. End Sub
  2101.  
  2102. 'Lights, Ramps & Primitives used as 4 step fading lights
  2103. 'a,b,c,d are the images used from on to off
  2104.  
  2105. Sub FadeObj(nr, object, a, b, c, d) 'a = on b = fade a little c = fade a lot d = nothin'
  2106.    Select Case FadingLevel(nr)
  2107.         Case 4:object.image = b:FadingLevel(nr) = 6                   'fading to off...
  2108.        Case 5:object.image = a:FadingLevel(nr) = 1                   'ON
  2109.        Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1             'wait
  2110.        Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  2111.        Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1         'wait
  2112.        Case 13:object.image = d:FadingLevel(nr) = 0                  'Off
  2113.    End Select
  2114. End Sub
  2115.  
  2116.  
  2117. Sub FadeObjm(nr, object, a, b, c, d)
  2118.     Select Case FadingLevel(nr)
  2119.         Case 4:object.image = b 'fading to off...
  2120.        Case 5:object.image = a 'ON
  2121.        Case 9:object.image = c 'fading...
  2122.        Case 13:object.image = d 'Off
  2123.    End Select
  2124. End Sub
  2125.  
  2126. '       primmy.size_x = 125
  2127. '       primmy.size_y = 125
  2128.  
  2129. 'Unused, but a cool thing for primitive flashers in the vein of Ramp flashers (scaling primitives instead of swapping to smaller flasher images)
  2130. Sub FadePrim(nr, object, a) 'a is Size 'a = on b = fade a little c = fade a lot d = nothin'
  2131.    Select Case FadingLevel(nr)
  2132.         Case 1:object.size_x = a +5: object.size_y = a +5: FadingLevel(nr) = FadingLevel(nr) + 1':TextBox4.text = "CASE1"       'Jitter while on (experimental)
  2133.         Case 2:object.size_x = a -5: object.size_y = a -5: FadingLevel(nr) = 1':TextBox4.text = "CASE2"
  2134.  
  2135.         Case 4:object.size_x = a * 0.9: object.size_y = a * 0.9:FadingLevel(nr) = 6                  'fading to off... GOTO 6
  2136.  
  2137.         Case 5:object.visible = 1:object.size_x = a: object.size_y = a: FadingLevel(nr) = 1': TextBox4.text = "ON"           'ON
  2138.  
  2139.         Case 6, 7, 8, 9, 10, 11, 12:object.size_x = a * 0.95: object.size_y = a * 0.95: FadingLevel(nr) = FadingLevel(nr) + 1             'Fading
  2140.  
  2141. '        Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  2142. '        Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1         'wait
  2143.  
  2144.         Case 13:object.visible = 0:FadingLevel(nr) = 0': TextBox4.TEXT = " "                  'Off
  2145.  
  2146. '       Case 14:object.size_x = a +1: object.size_y = a +1: FadingLevel(nr) = FadingLevel(nr) + 1       'Jitter while on (experimental)
  2147. '       Case 15:object.size_x = a -1: object.size_y = a -1: FadingLevel(nr) = 14
  2148.    End Select
  2149. End Sub
  2150.  
  2151. Sub NFadeObj(nr, object, a, b)
  2152.     Select Case FadingLevel(nr)
  2153.         Case 4:object.image = b:FadingLevel(nr) = 0 'off
  2154.        Case 5:object.image = a:FadingLevel(nr) = 1 'on
  2155.    End Select
  2156. End Sub
  2157.  
  2158. Sub NFadeObjm(nr, object, a, b)
  2159.     Select Case FadingLevel(nr)
  2160.         Case 4:object.image = b
  2161.         Case 5:object.image = a
  2162.     End Select
  2163. End Sub
  2164.  
  2165. ' Flasher objects
  2166.  
  2167. Sub Flash(nr, object)
  2168.     Select Case FadingLevel(nr)
  2169.         Case 4 'off
  2170.            FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  2171.             If FlashLevel(nr) < FlashMin(nr) Then
  2172.                 FlashLevel(nr) = FlashMin(nr)
  2173.                FadingLevel(nr) = 0 'completely off
  2174.            End if
  2175.             Object.IntensityScale = FlashLevel(nr)
  2176.         Case 5 ' on
  2177.            FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  2178.             If FlashLevel(nr) > FlashMax(nr) Then
  2179.                 FlashLevel(nr) = FlashMax(nr)
  2180.                 FadingLevel(nr) = 1 'completely on
  2181.            End if
  2182.             Object.IntensityScale = FlashLevel(nr)
  2183.     End Select
  2184.         '   Object.IntensityScale = 1
  2185. End Sub
  2186.  
  2187. Sub FlashB(nr, object)
  2188.     Select Case FadingLevel(nr)
  2189.         Case 4 'off
  2190.            FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  2191.             If FlashLevel(nr) < FlashMin(nr) Then
  2192.                 FlashLevel(nr) = FlashMin(nr)
  2193.                FadingLevel(nr) = 0 'completely off
  2194.            End if
  2195.             Object.IntensityScale = FlashLevel(nr)
  2196.         Case 5 ' on
  2197.             FadingLevel(nr) = FadingLevel(nr) + 1
  2198.         Case 6
  2199.             FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  2200.             If FlashLevel(nr) > FlashMax(nr) Then
  2201.                 FlashLevel(nr) = FlashMax(nr)
  2202. '                FadingLevel(nr) = 1 'completely on
  2203.            End if
  2204.             Object.IntensityScale = FlashLevel(nr)
  2205.     End Select
  2206.         '   Object.IntensityScale = 1
  2207. End Sub
  2208.  
  2209. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  2210.    Object.IntensityScale = FlashLevel(nr)
  2211.          ' Object.IntensityScale = 1
  2212. End Sub
  2213.  
  2214. ' Desktop Objects: Reels & texts (you may also use lights on the desktop)
  2215.  
  2216. ' Reels
  2217.  
  2218. Sub FadeR(nr, object)
  2219.     Select Case FadingLevel(nr)
  2220.         Case 4:object.SetValue 1:FadingLevel(nr) = 6                   'fading to off...
  2221.        Case 5:object.SetValue 0:FadingLevel(nr) = 1                   'ON
  2222.        Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1              'wait
  2223.        Case 9:object.SetValue 2:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  2224.        Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1          'wait
  2225.        Case 13:object.SetValue 3:FadingLevel(nr) = 0                  'Off
  2226.    End Select
  2227. End Sub
  2228.  
  2229. Sub FadeRm(nr, object)
  2230.     Select Case FadingLevel(nr)
  2231.         Case 4:object.SetValue 1
  2232.         Case 5:object.SetValue 0
  2233.         Case 9:object.SetValue 2
  2234.         Case 3:object.SetValue 3
  2235.     End Select
  2236. End Sub
  2237.  
  2238. 'Texts
  2239.  
  2240. Sub NFadeT(nr, object, message)
  2241.     Select Case FadingLevel(nr)
  2242.         Case 4:object.Text = "":FadingLevel(nr) = 0
  2243.         Case 5:object.Text = message:FadingLevel(nr) = 1
  2244.     End Select
  2245. End Sub
  2246.  
  2247. Sub NFadeTm(nr, object, b)
  2248.     Select Case FadingLevel(nr)
  2249.         Case 4:object.Text = ""
  2250.         Case 5:object.Text = message
  2251.     End Select
  2252. End Sub
  2253.  
  2254.  
  2255. ' *********************************************************************
  2256. '                      Supporting Ball & Sound Functions
  2257. ' *********************************************************************
  2258.  
  2259. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  2260.    Vol = Csng(BallVel(ball) ^2 / 2000)
  2261. End Function
  2262.  
  2263. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  2264.    Dim tmp
  2265.     tmp = ball.x * 2 / table1.width-1
  2266.     If tmp > 0 Then
  2267.         Pan = Csng(tmp ^10)
  2268.     Else
  2269.         Pan = Csng(-((- tmp) ^10) )
  2270.     End If
  2271. End Function
  2272.  
  2273. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  2274.    Pitch = BallVel(ball) * 20
  2275. End Function
  2276.  
  2277. Function BallVel(ball) 'Calculates the ball speed
  2278.    BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  2279. End Function
  2280.  
  2281. '*****************************************
  2282. '      JP's VP10 Rolling Sounds
  2283. '*****************************************
  2284.  
  2285. Const tnob = 10 ' total number of balls
  2286. ReDim rolling(tnob)
  2287. InitRolling
  2288.  
  2289. Sub InitRolling
  2290.     Dim i
  2291.     For i = 0 to tnob
  2292.         rolling(i) = False
  2293.     Next
  2294. End Sub
  2295.  
  2296. Sub RollingUpdate()
  2297.     Dim BOT, b
  2298.     BOT = GetBalls
  2299.  
  2300.     ' stop the sound of deleted balls
  2301.    For b = UBound(BOT) + 1 to tnob
  2302.         rolling(b) = False
  2303.         StopSound("fx_ballrolling" & b)
  2304.     Next
  2305.  
  2306.     ' exit the sub if no balls on the table
  2307.    If UBound(BOT) = -1 Then Exit Sub
  2308.  
  2309.     ' play the rolling sound for each ball
  2310.    For b = 0 to UBound(BOT)
  2311.         If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  2312.             rolling(b) = True
  2313.             PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  2314.         Else
  2315.             If rolling(b) = True Then
  2316.                 StopSound("fx_ballrolling" & b)
  2317.                 rolling(b) = False
  2318.             End If
  2319.         End If
  2320.     Next
  2321. End Sub
  2322.  
  2323. '**********************
  2324. ' Ball Collision Sound
  2325. '**********************
  2326.  
  2327. Sub OnBallBallCollision(ball1, ball2, velocity)
  2328.     PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  2329. End Sub
  2330.  
  2331. Sub AmyDownRampdrop_Hit():playsound "drop_mono", 0, 0.4, 0.1:End Sub 'name,loopcount,volume,pan,randompitch
  2332. 'Sub VukRampEnd_Hit():playsound "Ramp_Hit1", 0, 0.2, 0.1:End Sub    'handled by collection instead
  2333. Sub WireRampTrigger1_Hit():playsound "wireramp1", 0, 0.2, Pan(ActiveBall):end sub
  2334. Sub WireRampTrigger2_Hit():playsound "wireramp1", 0, 0.2, Pan(ActiveBall):end sub
  2335. Sub WireRampTrigger3_Hit():playsound "wireramp1", 0, 0.4, Pan(ActiveBall):end sub
  2336.    
  2337.    
  2338. Sub AmyDownRampTrigger_Hit()
  2339.     AmyDownRampDrop.Enabled=0
  2340.     me.timerenabled=1
  2341. End Sub
  2342.  
  2343. Sub AmyDownRampTrigger_Timer()
  2344.     AmyDownRampDrop.Enabled=1
  2345.     me.Timerenabled=0
  2346. End Sub
  2347.  
  2348. Sub RightRampdrop_Hit():playsound "drop_mono", 0, 0.5, 0.05:End Sub
  2349. 'Sub RightRampEnd_Hit():playsound "Ramp_Hit1", 0, 0.3, 0.05:End Sub 'handled by collection instead
  2350.  
  2351. Sub RightRampTrigger_Hit()
  2352.     RightRampDrop.Enabled=0
  2353.     me.timerenabled=1
  2354. End Sub
  2355.  
  2356. Sub RightRampTrigger_Timer()
  2357.     RightRampDrop.Enabled=1
  2358.     me.Timerenabled=0
  2359. End Sub
  2360.  
  2361. Sub LeftRampdrop_Hit():playsound "drop_mono", 0, 0.3, -0.03:End Sub
  2362.  
  2363. 'Collection Sounds
  2364.  
  2365.  
  2366. Sub Pins_Hit (idx)
  2367.     PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2368. End Sub
  2369.  
  2370. Sub Targets_Hit (idx)
  2371.     PlaySound SoundFx("plastichit",DOFContactors), 0, Vol(ActiveBall) * 0.2, Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  2372. End Sub
  2373.  
  2374. Sub Metals_Thin_Hit (idx)
  2375.     PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2376. End Sub
  2377.  
  2378. Sub Metals_Medium_Hit (idx)
  2379.     PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2380. End Sub
  2381.  
  2382. Sub MetalWalls_Hit (idx)
  2383.     PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2384. End Sub
  2385.  
  2386. Sub Gates_Hit (idx)
  2387.     PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2388. End Sub
  2389.  
  2390. Sub Rubbers_O_Hit (idx)
  2391.     PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2392. End Sub
  2393.  
  2394. Sub Rubbers_U_Hit (idx)
  2395.     PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2396. End Sub
  2397.  
  2398. Sub Rubbers_Hit(idx)
  2399.     dim finalspeed
  2400.     finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  2401.     If finalspeed > 20 then
  2402.         PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2403.     End if
  2404.     If finalspeed >= 6 AND finalspeed <= 20 then
  2405.         RandomSoundRubber()
  2406.     End If
  2407. End Sub
  2408.  
  2409. Sub Posts_Hit(idx)
  2410.     dim finalspeed
  2411.     finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  2412.     If finalspeed > 16 then
  2413.         PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2414.     End if
  2415.     If finalspeed >= 6 AND finalspeed <= 16 then
  2416.         RandomSoundRubber()
  2417.     End If
  2418. End Sub
  2419.  
  2420. Sub RandomSoundRubber()
  2421.     Select Case Int(Rnd*3)+1
  2422.         Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2423.         Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2424.         Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2425.     End Select
  2426. End Sub
  2427.  
  2428. 'Flipper Sounds
  2429.  
  2430. Sub ULeftFlipper_Collide(parm)
  2431.     RandomSoundFlipper()
  2432. End Sub
  2433.  
  2434. Sub LeftFlipper_Collide(parm)
  2435.     RandomSoundFlipper()
  2436. End Sub
  2437.  
  2438. Sub RightFlipper_Collide(parm)
  2439.     RandomSoundFlipper()
  2440. End Sub
  2441.  
  2442. Sub RandomSoundFlipper()
  2443.     Select Case Int(Rnd*3)+1
  2444.         Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2445.         Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2446.         Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  2447.     End Select
  2448. End Sub
  2449.  
  2450. '*DOF method for rom controller tables by Arngrim********************
  2451. '*******Use DOF 1**, 1 to activate a ledwiz output*******************
  2452. '*******Use DOF 1**, 0 to deactivate a ledwiz output*****************
  2453. '*******Use DOF 1**, 2 to pulse a ledwiz output**********************
  2454. Sub DOF(dofevent, dofstate)
  2455.     If cController>2 Then
  2456.         If dofstate = 2 Then
  2457.             Controller.B2SSetData dofevent, 1:Controller.B2SSetData dofevent, 0
  2458.         Else
  2459.             Controller.B2SSetData dofevent, dofstate
  2460.         End If
  2461.     End If
  2462. End Sub
  2463. '********************************************************************
  2464.  
  2465. Sub Table1_exit()
  2466.     Controller.Pause = False
  2467.     Controller.Stop
  2468. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement