Jump to content



Photo
* * * * * 8 votes

Attack from Mars (Midway 1995) [Visual Pinball X]

Attack mars

  • Please log in to reply
277 replies to this topic

#141 BleedinFingers

BleedinFingers

    Hobbyist

  • Platinum Supporter
  • 18 posts

  • Flag: United Kingdom

  • Favorite Pinball: Spider-Man

Posted 09 May 2021 - 08:59 AM

Thanks JP :) 

 

Just realised I was using an older version I had updated myself with your Arcade physics, now I can't remember what else I tweaked Haha



#142 bolt

bolt

    VPF Veteran

  • VIP
  • 5,164 posts
  • Location:Kiel / Schleswig Holstein

  • Flag: Germany

  • Favorite Pinball: JP's Deadpool, Harlem Globetrotters, Spiderman and much more

Posted 09 May 2021 - 10:48 AM

Thank you for the update. Less than 10MB, unbelievable. :otvclap:


Posted Image

#143 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 09 May 2021 - 11:26 AM

@JP

are the saucers no longer supposed to jiggle when nudging?

 

the previous version the saucers and the Martians jiggle, the new version, no jiggle


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#144 marcio clauss

marcio clauss

    Enthusiast

  • Members
  • PipPipPip
  • 185 posts

  • Flag: Brazil

  • Favorite Pinball: Shark TAITO

Posted 09 May 2021 - 12:30 PM

Thanks for the update JP :tup:



#145 tmpc

tmpc

    Enthusiast

  • Members
  • PipPipPip
  • 279 posts
  • Location:New Berlin Wi.

  • Flag: United States of America

  • Favorite Pinball: fish tales

Posted 09 May 2021 - 01:06 PM

This is great, thank you.



#146 uers1983

uers1983

    Enthusiast

  • Members
  • PipPipPip
  • 95 posts
  • Location:Siegen

  • Flag: Germany

  • Favorite Pinball: Monster Bash,AFM,T2

Posted 09 May 2021 - 07:41 PM

Thank you for the update JP! The table size is really incredible! :otvclap: 

The last time I had so much fun playin´ a game with less than 10MB was in MS-DOS times :lol:



#147 remdwaas1986

remdwaas1986

    Enthusiast

  • Platinum Supporter
  • 284 posts
  • Location:Netherlands

  • Flag: Netherlands

  • Favorite Pinball: Pokemon

Contributor

Posted 10 May 2021 - 06:39 AM

Thank you for the update JP! The table size is really incredible! :otvclap: 
The last time I had so much fun playin´ a game with less than 10MB was in MS-DOS times :lol:

So you where loading everytime 8 floppy-disks to play one game? Hahaha

gallery_139054_567_13031.pnggallery_139054_567_2859.png


#148 jpsalas

jpsalas

    Grand Schtroumpf

  • VIP
  • 7,333 posts
  • Location:I'm Spanish, but I live in Oslo (Norway)

  • Flag: Norway

  • Favorite Pinball: I like both new and old, but I guess I prefer modern tables with some rules and goals to achieve.



Posted 10 May 2021 - 07:12 AM

@JP

are the saucers no longer supposed to jiggle when nudging?

 

the previous version the saucers and the Martians jiggle, the new version, no jiggle

 

Yes, I stopped that. It is just a matter of changing the 3 nudge lines. 


 For the sausers "jiggle" just add back those extra 2 commands (in red) to these lines:

 

    If keycode = LeftTiltKey Then Nudge 90, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25:aSaucerShake:a3BankShake2
    If keycode = RightTiltKey Then Nudge 270, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25:aSaucerShake:a3BankShake2
    If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25:aSaucerShake:a3BankShake2
 
Some people complained about that slowing down the table. But it is easy to get it back :)

If you want to check my latest uploads then click on the image below:

 

vp.jpg

 

 


#149 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 10 May 2021 - 08:10 AM

 

@JP

are the saucers no longer supposed to jiggle when nudging?

 

the previous version the saucers and the Martians jiggle, the new version, no jiggle

 

Yes, I stopped that. It is just a matter of changing the 3 nudge lines. 


 For the sausers "jiggle" just add back those extra 2 commands (in red) to these lines:

 

    If keycode = LeftTiltKey Then Nudge 90, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25:aSaucerShake:a3BankShake2
    If keycode = RightTiltKey Then Nudge 270, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25:aSaucerShake:a3BankShake2
    If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25:aSaucerShake:a3BankShake2
 
Some people complained about that slowing down the table. But it is easy to get it back :)

 

odd, even on my laptop i dont think i noticed a slow down, but thanks for the jigglys back

it's the only way i ever get revenge on them


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#150 HWurst

HWurst

    Enthusiast

  • Members
  • PipPipPip
  • 61 posts

  • Flag: Germany

  • Favorite Pinball: All of them...they all have something beautiful 😍

Posted 10 May 2021 - 08:40 AM

 

it's the only way i ever get revenge on them

 

 

LOL  :otvclap:



#151 pablo99

pablo99

    Enthusiast

  • Silver Supporter
  • 54 posts

  • Flag: United Kingdom

  • Favorite Pinball: JP's Deadpool

Posted 10 May 2021 - 09:17 AM

Thanks for the update JP. I love destroying saucers.



#152 jpsalas

jpsalas

    Grand Schtroumpf

  • VIP
  • 7,333 posts
  • Location:I'm Spanish, but I live in Oslo (Norway)

  • Flag: Norway

  • Favorite Pinball: I like both new and old, but I guess I prefer modern tables with some rules and goals to achieve.



Posted 10 May 2021 - 09:44 AM

 

 

@JP

are the saucers no longer supposed to jiggle when nudging?

 

the previous version the saucers and the Martians jiggle, the new version, no jiggle

 

Yes, I stopped that. It is just a matter of changing the 3 nudge lines. 


 For the sausers "jiggle" just add back those extra 2 commands (in red) to these lines:

 

    If keycode = LeftTiltKey Then Nudge 90, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25:aSaucerShake:a3BankShake2
    If keycode = RightTiltKey Then Nudge 270, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25:aSaucerShake:a3BankShake2
    If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25:aSaucerShake:a3BankShake2
 
Some people complained about that slowing down the table. But it is easy to get it back :)

 

odd, even on my laptop i dont think i noticed a slow down, but thanks for the jigglys back

it's the only way i ever get revenge on them

 

 

I just uploaded version 3.02 with the saucer shake re-enabled :)


If you want to check my latest uploads then click on the image below:

 

vp.jpg

 

 


#153 haggi

haggi

    Enthusiast

  • Platinum Supporter
  • 343 posts

  • Flag: Germany

  • Favorite Pinball: Flintstones

Posted 10 May 2021 - 01:58 PM

Thanks for 3.02 Updated. I love it.



#154 tmpc

tmpc

    Enthusiast

  • Members
  • PipPipPip
  • 279 posts
  • Location:New Berlin Wi.

  • Flag: United States of America

  • Favorite Pinball: fish tales

Posted 10 May 2021 - 08:42 PM

Great update, thank you.



#155 Csilk

Csilk

    Enthusiast

  • Members
  • PipPipPip
  • 208 posts
  • Location:Halifax, Nova Scotia

  • Flag: Canada

  • Favorite Pinball: Bram Stoker's Dracula

Posted 15 June 2021 - 02:06 PM

sorry if this has been mentioned I searched some of the pages but there is a problem regarding double DMD being displayed when using DESKTOP mode and colorizations

 

the issue is if you colorize by pressing F1 and turning it on for the DMD it will then always have the double DMDs showing in desktop mode.

 

simple workaround fix is to always have script not use colorization like below

 

Dim VarHidden, UseVPMColoredDMD
If Table1.ShowDT = True then
    UseVPMColoredDMD = False
    VarHidden = 1
Else
    UseVPMColoredDMD = False
    VarHidden = 1
End If
 
this will then only show the freezy DMD with colors, unsure why the UseVPMColoredDMD is always showing the vpinmame DMD when = 1 but thats the behavior as of 10.7 revision 203.
 
took me a solid amount of time to figure it out.

Alternate Script that fixes issues for freezy users in Desktop mode.

' Attack from Mars / IPD No. 3781 / December, 1995 / 4 Players
' Based on the table by Bally/Williams 1995
' DOF by arngrim
' VPX 10.7 - version by JPSalas 2021, version 3.0.2

Option Explicit
Randomize

Const Ballsize = 50
Const Ballmass = 1.7

On Error Resume Next
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
On Error Goto 0

' Use Modulated Flashers
Const UseVPMModSol = False

LoadVPM "01560000", "WPC.VBS", 3.26

'********************
'Standard definitions
'********************

Const UseSolenoids = 2
Const UseLamps = 0
Const UseSync = 0
Const HandleMech = 0

' special fastflips
Const cSingleLFlip = 0
Const cSingleRFlip = 0

' Standard Sounds
Const SSolenoidOn = "fx_Solenoidon"
Const SSolenoidOff = "fx_solenoidoff"
Const SCoin = "fx_Coin"

' Set GiCallback2 = GetRef("UpdateGI2") 'modulated Gi
Set GiCallback = GetRef("UpdateGI")

Dim bsTrough, bsL, bsR, dtDrop, x, BallFrame, plungerIM, Mech3bank

'******************
' RealTime Updates
'******************

Sub RealTime_Timer
    BigUfoUpdate
    RollingUpdate
    DivP.RotZ = DivF.CurrentAngle
    LeftFlipperTop.RotZ = LeftFlipper.CurrentAngle
    RightFlipperTop.RotZ = RightFlipper.CurrentAngle
End Sub

'************
' Table init.
'************

Const cGameName = "afm_113b" 'arcade rom - with credits
'Const cGameName = "afm_113"  'home rom - free play

Sub Table1_Init
    vpmInit Me
    With Controller
        .GameName = cGameName
        If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
        .SplashInfoLine = "Attack from Mars" & vbNewLine & "VPX table by JPSalas v3.0.2"
        .Games(cGameName).Settings.Value("sound") = 1
        .Games(cGameName).Settings.Value("rol") = 0
        .HandleKeyboard = 0
        .ShowTitle = 0
        .ShowDMDOnly = 1
        .ShowFrame = 0
        .HandleMechanics = 0
        .Hidden = 0
        On Error Resume Next
        .Run GetPlayerHWnd
        If Err Then MsgBox Err.Description
        On Error Goto 0
        .Switch(22) = 1 'close coin door
        .Switch(24) = 1 'and keep it close
    End With

    ' Nudging
    vpmNudge.TiltSwitch = 14
    vpmNudge.Sensitivity = 1
    vpmNudge.TiltObj = Array(bumper1, bumper2, bumper3, LeftSlingshot, RightSlingshot)

    ' Trough
    Set bsTrough = New cvpmTrough
    With bsTrough
        .size = 4
        '.entrySw = 18
        .initSwitches Array(32, 33, 34, 35)
        .Initexit BallRelease, 80, 6
        .InitExitSounds SoundFX("fx_Solenoid", DOFContactors), SoundFX("fx_ballrel", DOFContactors)
        .Balls = 4
    End With

    ' Droptarget
    Set dtDrop = New cvpmDropTarget
    With dtDrop
        .InitDrop sw77, 77
        .initsnd SoundFX("fx_droptarget", DOFContactors), SoundFX("fx_resetdrop", DOFContactors)
    End With

    ' Left hole
    Set bsL = New cvpmTrough
    With bsL
        .size = 1
        .initSwitches Array(36)
        .Initexit sw36, 180, 0
        .InitExitSounds SoundFX("fx_Solenoid", DOFContactors), SoundFX("fx_popper", DOFContactors)
        .InitExitVariance 3, 2
    End With

    ' Right hole
    Set bsR = New cvpmBallStack
    With bsR
        .InitSw 0, 37, 0, 0, 0, 0, 0, 0
        .InitKick sw37, 210, 20
        .InitExitSnd SoundFX("fx_Solenoid", DOFContactors), SoundFX("fx_popper", DOFContactors)
        .KickZ = 1.1344645 '65 Degrees
        .KickForceVar = 2
    End With

    '   Set bsR = New cvpmTrough
    '   With bsR
    '       .size = 4
    '       .initSwitches Array(37)
    '       .Initexit sw37, 200, 24
    '       .InitExitSounds SoundFX("fx_Solenoid",DOFContactors), SoundFX("fx_popper",DOFContactors)
    '       .InitExitVariance 2, 2
    '       .MaxBallsPerKick = 1
    '   End With

    '3 Targets Bank
    Set Mech3Bank = new cvpmMech
    With Mech3Bank
        .Sol1 = 24
        .Mtype = vpmMechLinear + vpmMechReverse + vpmMechOneSol
        .Length = 60
        .Steps = 55
        .AddSw 67, 0, 0
        .AddSw 66, 55, 55
        .Callback = GetRef("Update3Bank")
        .Start
    End With

    ' Impulse Plunger
    Const IMPowerSetting = 38 'Plunger Power
    Const IMTime = 0.6        ' Time in seconds for Full Plunge
    Set plungerIM = New cvpmImpulseP
    With plungerIM
        .InitImpulseP swplunger, IMPowerSetting, IMTime
        .Random 0.7
        .switch 18
        .InitExitSnd SoundFX("fx_plunger", DOFContactors), SoundFX("fx_plunger", DOFContactors)
        .CreateEvents "plungerIM"
    End With

    ' Main Timer init
    PinMAMETimer.Interval = PinMAMEInterval
    PinMAMETimer.Enabled = 1

    ' Init other dropwalls - animations
    UpdateGI 0, 0:UpdateGI 1, 0:UpdateGI 2, 0
    UFORotSpeedSlow
    UfoLed.Enabled = 1
    DivW1.IsDropped = 1

    RealTime.Enabled = 1

    'Load LUT
    LoadLUT
End Sub

'**********
' Keys
'**********

Sub table1_KeyDown(ByVal Keycode)
    If keycode = PlungerKey Then Controller.Switch(11) = 1
    If keycode = LeftTiltKey Then Nudge 90, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25:aSaucerShake:a3BankShake2
    If keycode = RightTiltKey Then Nudge 270, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25:aSaucerShake:a3BankShake2
    If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25:aSaucerShake:a3BankShake2
    If keycode = LeftMagnaSave Then bLutActive = True
    If keycode = RightMagnaSave Then
        If bLutActive Then NextLUT:End If
    End If
    If vpmKeyDown(keycode)Then Exit Sub
End Sub

Sub table1_KeyUp(ByVal Keycode)
    If keycode = LeftMagnaSave Then bLutActive = False
    If keycode = PlungerKey Then Controller.Switch(11) = 0
    If vpmKeyUp(keycode)Then Exit Sub
End Sub

'*********
'   LUT
'*********

Dim bLutActive, LUTImage
Sub LoadLUT
    bLutActive = False
    x = LoadValue(cGameName, "LUTImage")
    If(x <> "")Then LUTImage = x Else LUTImage = 0
    UpdateLUT
End Sub

Sub SaveLUT
    SaveValue cGameName, "LUTImage", LUTImage
End Sub

Sub NextLUT:LUTImage = (LUTImage + 1)MOD 9:UpdateLUT:SaveLUT:End Sub

Sub UpdateLUT
    Select Case LutImage
        Case 0:table1.ColorGradeImage = "LUT0"
        Case 1:table1.ColorGradeImage = "LUT1"
        Case 2:table1.ColorGradeImage = "LUT2"
        Case 3:table1.ColorGradeImage = "LUT3"
        Case 4:table1.ColorGradeImage = "LUT4"
        Case 5:table1.ColorGradeImage = "LUT5"
        Case 6:table1.ColorGradeImage = "LUT6"
        Case 7:table1.ColorGradeImage = "LUT7"
        Case 8:table1.ColorGradeImage = "LUT8"
    End Select
End Sub

'*********
' Switches
'*********

' Slings & div switches

Dim LStep, RStep

Sub LeftSlingShot_Slingshot
    PlaySoundAt SoundFX("fx_Slingshot", DOFContactors), Lemk
    LeftSling4.Visible = 1
    Lemk.RotX = 26
    LStep = 0
    vpmTimer.PulseSw 51
    LeftSlingShot.TimerEnabled = 1
End Sub

Sub LeftSlingShot_Timer
    Select Case LStep
        Case 1:LeftSLing4.Visible = 0:LeftSLing3.Visible = 1:Lemk.RotX = 14
        Case 2:LeftSLing3.Visible = 0:LeftSLing2.Visible = 1:Lemk.RotX = 2
        Case 3:LeftSLing2.Visible = 0:Lemk.RotX = -10:LeftSlingShot.TimerEnabled = 0
    End Select
    LStep = LStep + 1
End Sub

Sub RightSlingShot_Slingshot
    PlaySoundAt SoundFX("fx_Slingshot", DOFContactors), Remk
    RightSling4.Visible = 1
    Remk.RotX = 26
    RStep = 0
    vpmTimer.PulseSw 52
    RightSlingShot.TimerEnabled = 1
End Sub

Sub RightSlingShot_Timer
    Select Case RStep
        Case 1:RightSLing4.Visible = 0:RightSLing3.Visible = 1:Remk.RotX = 14
        Case 2:RightSLing3.Visible = 0:RightSLing2.Visible = 1:Remk.RotX = 2
        Case 3:RightSLing2.Visible = 0:Remk.RotX = -10:RightSlingShot.TimerEnabled = 0
    End Select
    RStep = RStep + 1
End Sub

' Bumpers
Sub Bumper1_Hit:vpmTimer.PulseSw 53:PlaySoundAt SoundFX("fx_bumper", DOFContactors), Bumper1:End Sub

Sub Bumper2_Hit:vpmTimer.PulseSw 54:PlaySoundAt SoundFX("fx_bumper", DOFContactors), Bumper2:End Sub

Sub Bumper3_Hit:vpmTimer.PulseSw 55:PlaySoundAt SoundFX("fx_bumper", DOFContactors), Bumper3:End Sub

' Drain holes, vuks & saucers
Sub Drain_Hit:PlaysoundAt "fx_drain", drain:bsTrough.AddBall Me:End Sub
Sub sw36a_Hit:PlaySoundAt "fx_kicker_enter", sw36a:bsL.AddBall Me:End Sub
Sub sw37a_Hit:PlaySoundAt "fx_hole_enter", sw37a:bsR.AddBall Me:End Sub

Sub sw78_Hit
    PlaySoundAt "fx_hole_enter", sw78
    vpmTimer.PulseSwitch(78), 150, "bsl.addball sw78 '"
End Sub

Dim bBall

Sub sw37_Hit
    PlaySoundAt "fx_hole_enter", sw37
    Set bBall = ActiveBall
    Me.TimerEnabled = 1
End Sub

Sub sw37_Timer
    If bBall.Z> 0 Then
        bBall.Z = bBall.Z -5
    Else
        bsR.AddBall Me
        Me.TimerEnabled = 0
    End If
End Sub

' Rollovers & Ramp Switches
Sub sw16_Hit:Controller.Switch(16) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub
Sub sw16_UnHit:Controller.Switch(16) = 0:End Sub

Sub sw26_Hit:Controller.Switch(26) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub
Sub sw26_UnHit:Controller.Switch(26) = 0:End Sub

Sub sw17_Hit:Controller.Switch(17) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub
Sub sw17_UnHit:Controller.Switch(17) = 0:End Sub

Sub sw27_Hit:Controller.Switch(27) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub
Sub sw27_UnHit:Controller.Switch(27) = 0:End Sub

Sub sw38_Hit:Controller.Switch(38) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub
Sub sw38_Unhit:Controller.Switch(38) = 0:End Sub

Sub sw48_Hit:Controller.Switch(48) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub
Sub sw48_Unhit:Controller.Switch(48) = 0:End Sub

Sub sw71_Hit:Controller.Switch(71) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub
Sub sw71_UnHit:Controller.Switch(71) = 0:End Sub

Sub sw72_Hit:Controller.Switch(72) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub
Sub sw72_Unhit:Controller.Switch(72) = 0:End Sub

Sub sw73_Hit:Controller.Switch(73) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub
Sub sw73_Unhit:Controller.Switch(73) = 0:End Sub

Sub sw74_Hit:Controller.Switch(74) = 1:PlaySound "fx_sensor", 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub
Sub sw74_Unhit:Controller.Switch(74) = 0:End Sub

Sub sw61_Hit:Controller.Switch(61) = 1:End Sub
Sub sw61_Unhit:Controller.Switch(61) = 0:End Sub

Sub sw62_Hit:Controller.Switch(62) = 1:End Sub
Sub sw62_Unhit:Controller.Switch(62) = 0:End Sub

Sub sw63_Hit:Controller.Switch(63) = 1:End Sub
Sub sw63_Unhit:Controller.Switch(63) = 0:End Sub

Sub sw64_Hit:Controller.Switch(64) = 1:End Sub
Sub sw64_Unhit:Controller.Switch(64) = 0:End Sub

Sub sw65_Hit:Controller.Switch(65) = 1:End Sub
Sub sw65_Unhit:Controller.Switch(65) = 0:End Sub

' Targets
Sub sw56_Hit:vpmTimer.PulseSw 56:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

Sub sw57_Hit:vpmTimer.PulseSw 57:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

Sub sw58_Hit:vpmTimer.PulseSw 58:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

Sub sw41_Hit:vpmTimer.PulseSw 41:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

Sub sw42_Hit:vpmTimer.PulseSw 42:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

Sub sw43_Hit:vpmTimer.PulseSw 43:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

Sub sw44_Hit:vpmTimer.PulseSw 44:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

Sub sw75_Hit:vpmTimer.PulseSw 75:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

Sub sw76_Hit:vpmTimer.PulseSw 76:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

' 3 bank
Sub sw45_Hit:vpmTimer.PulseSw 45:a3BankShake:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

Sub sw46_Hit:vpmTimer.PulseSw 46:a3BankShake:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

Sub sw47_Hit:vpmTimer.PulseSw 47:a3BankShake:PlaySound SoundFX("fx_target", DOFTargets), 0, 1, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall):End Sub

' Droptarget

Sub sw77_Hit:dtDrop.Hit 1:UFORotSpeedFast:End Sub

'*********
'Solenoids
'*********

SolCallback(1) = "Auto_Plunger"
SolCallback(2) = "SolRelease"
SolCallback(3) = "bsL.SolOut"
SolCallback(4) = "Sol4" ' bsR.SolOut
SolCallback(5) = "SolAlien5"
SolCallback(6) = "SolAlien6"
SolCallback(7) = "vpmSolSound SoundFX(""fx_Knocker"",DOFKnocker),"
SolCallback(8) = "SolAlien8"
SolCallback(14) = "SolAlien14"
SolCallBack(15) = "SolUfoShake"
SolCallback(16) = "SolDropTargetUp"
SolCallback(23) = "SetLamp 123," ' SolUfoFlash"
'SolCallback(24) = "SolBank" 'used in the Mech
SolCallback(33) = "vpmSolGate RGate,false,"
SolCallback(34) = "vpmSolGate LGate,false,"
SolCallback(36) = "SolDiv"
SolCallback(43) = "SetLamp 130,"

If UseVPMModSol Then
    SolModCallback(17) = "SetModLamp 117,"
    SolModCallback(18) = "SetModLamp 118,"
    SolModCallback(19) = "SetModLamp 119,"
    SolModCallback(20) = "SetModLamp 120,"
    SolModCallback(21) = "SetModLamp 121,"
    SolModCallback(22) = "SetModLamp 122,"
    SolModCallback(25) = "SetModLamp 125,"
    SolModCallback(26) = "SetModLamp 126,"
    SolModCallback(27) = "SetModLamp 127,"
    SolModCallback(28) = "SetModLamp 128,"
Else
    SolCallback(17) = "SetLamp 117,"
    SolCallback(18) = "SetLamp 118,"
    SolCallback(19) = "SetLamp 119,"
    SolCallback(20) = "SetLamp 120,"
    SolCallback(21) = "SetLamp 121,"
    SolCallback(22) = "SetLamp 122,"
    SolCallback(25) = "SetLamp 125,"
    SolCallback(26) = "SetLamp 126,"
    SolCallback(27) = "SetLamp 127,"
    SolCallback(28) = "SetLamp 128,"
End If

Sub SolRelease(Enabled)
    If Enabled And bsTrough.Balls> 0 Then
        vpmTimer.PulseSw 31
        bsTrough.ExitSol_On
    End If
End Sub

Sub Sol4(Enabled) 'bsR
    sw37a.TimerEnabled = 1
End Sub

Sub sw37a_Timer
    If bsR.Balls Then
        bsR.ExitSol_On
    Else
        sw37a.TimerEnabled = 0
    End If
End Sub

Sub Auto_Plunger(Enabled)
    If Enabled Then
        PlungerIM.AutoFire
    End If
End Sub

Sub SolDropTargetUp(Enabled)
    If Enabled Then
        dtDrop.DropSol_On
    End If
End Sub

'****************
' Alien solenoids
'****************

Sub SolAlien5(Enabled)
    If Enabled Then
        Alien5.TransZ = 20
        PlaySoundAt "fx_solenoidon", Alien5
    Else
        Alien5.TransZ = 0
        PlaySoundAt "fx_solenoidoff", Alien5
    End If
End Sub

Sub SolAlien6(Enabled)
    If Enabled Then
        Alien6.TransZ = 20
        PlaySoundAt "fx_solenoidon", Alien6
    Else
        Alien6.TransZ = 0
        PlaySoundAt "fx_solenoidoff", Alien6
    End If
End Sub

Sub SolAlien8(Enabled)
    If Enabled Then
        Alien8.TransZ = 20
        PlaySoundAt "fx_solenoidon", Alien8
    Else
        Alien8.TransZ = 0
        PlaySoundAt "fx_solenoidoff", Alien8
    End If
End Sub

Sub SolAlien14(Enabled)
    If Enabled Then
        Alien14.TransZ = 20
        PlaySoundAt "fx_solenoidon", Alien14
    Else
        Alien14.TransZ = 0
        PlaySoundAt "fx_solenoidoff", Alien14
    End If
End Sub

'***********
' Diverter
'***********

Sub SolDiv(Enabled)
    PlaySoundAt SoundFX("fx_diverter", DOFContactors), DivF
    If Enabled Then
        DivF.RotateToEnd
        DivW1.IsDropped = 0
        DivW2.IsDropped = 1
    Else
        DivF.RotateToStart
        DivW1.IsDropped = 1
        DivW2.IsDropped = 0
    End If
End Sub

'*******************
' Flipper Subs v3.0
'*******************

SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"

Sub SolLFlipper(Enabled)
    If UseSolenoids = 2 then Controller.Switch(swULFlip) = Enabled
    If Enabled Then
        PlaySoundAt SoundFX("fx_flipperup", DOFContactors), LeftFlipper
        LeftFlipper.EOSTorque = 0.75:LeftFlipper.RotateToEnd
    Else
        PlaySoundAt SoundFX("fx_flipperdown", DOFContactors), LeftFlipper
        LeftFlipper.EOSTorque = 0.2:LeftFlipper.RotateToStart
    End If
End Sub

Sub SolRFlipper(Enabled)
    if UseSolenoids = 2 then Controller.Switch(swURFlip) = Enabled
    If Enabled Then
        PlaySoundAt SoundFX("fx_flipperup", DOFContactors), RightFlipper
        RightFlipper.EOSTorque = 0.75:RightFlipper.RotateToEnd
    Else
        PlaySoundAt SoundFX("fx_flipperdown", DOFContactors), RightFlipper
        RightFlipper.EOSTorque = 0.2:RightFlipper.RotateToStart
    End If
End Sub

Sub LeftFlipper_Collide(parm)
    PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
End Sub

Sub RightFlipper_Collide(parm)
    PlaySound "fx_rubber_flipper", 0, parm / 60, pan(ActiveBall), 0.2, 0, 0, 0, AudioFade(ActiveBall)
End Sub

'******************
'Motor Bank Up Down
'******************

Sub Update3Bank(currpos, currspeed, lastpos)
    If currpos <> lastpos Then
        PlaySound "fx_motor2"
        BackBank.Z = - currpos
        swp45.Z = -(22 + currpos)
        swp46.Z = -(22 + currpos)
        swp47.Z = -(22 + currpos)
    End If
    If currpos> 40 Then
        sw45.Isdropped = 1
        sw46.Isdropped = 1
        sw47.Isdropped = 1
        UFORotSpeedMedium
    End If
    If currpos <10 Then
        sw45.Isdropped = 0
        sw46.Isdropped = 0
        sw47.Isdropped = 0
        UFORotSpeedSlow
    End If
End Sub

'***********
' Update GI
'***********

Sub UpdateGI2(no, step)
    Dim gistep, ii, a
    gistep = step / 8
    Select Case no
        Case 0
            For each ii in aGiLLights
                ii.IntensityScale = gistep
            Next
        Case 1
            For each ii in aGiMLights
                ii.IntensityScale = gistep
            Next
        Case 2 ' also the bumpers er GI
            For each ii in aGiTLights
                ii.IntensityScale = gistep
            Next
    End Select
End Sub

Sub UpdateGI(no, step)
    Dim gistep, ii, a
    gistep = ABS(step)
    Select Case no
        Case 0
            For each ii in aGiLLights
                ii.state = gistep
            Next
        Case 1
            For each ii in aGiMLights
                ii.state = gistep
            Next
        Case 2 ' also the bumpers er GI
            For each ii in aGiTLights
                ii.state = gistep
            Next
    End Select
End Sub

'*************
' 3Bank Shake
'*************

Dim ccBall
Const cMod = .65 'percentage of hit power transfered to the 3 Bank of targets

a3BankInit

Sub a3BankShake
    ccball.velx = activeball.velx * cMod
    ccball.vely = activeball.vely * cMod
    a3BankTimer.enabled = True
    b3BankTimer.enabled = True
End Sub

Sub a3BankShake2 'when nudging
    a3BankTimer.enabled = True
    b3BankTimer.enabled = True
End Sub

Sub a3BankInit
    Set ccBall = hball.createball
    hball.Kick 0, 0
End Sub

Sub a3BankTimer_Timer            'start animation
    Dim x, y
    x = (hball.x - ccball.x) / 4 'reduce the X axis movement
    y = (hball.y - ccball.y) / 2
    backbank.transy = x
    backbank.transx = - y
    swp45.transy = x
    swp45.transx = - y
    swp46.transy = x
    swp46.transx = - y
    swp47.transy = x
    swp47.transx = - y
End Sub

Sub b3BankTimer_Timer 'stop animation
    backbank.transx = 0
    backbank.transy = 0
    swp45.transz = 0
    swp45.transx = 0
    swp46.transz = 0
    swp46.transx = 0
    swp47.transz = 0
    swp47.transx = 0
    a3BankTimer.enabled = False
    b3BankTimer.enabled = False
End Sub

'***************
' Big UFO Shake
'***************
Dim cBall, UFOLedPos
BigUfoInit

Sub BigUfoInit
    UFOLedPos = 0
    Set cBall = ckicker.createball
    ckicker.Kick 0, 0
End Sub

Sub SolUfoShake(Enabled)
    If Enabled Then
        BigUfoShake
    End If
End Sub

Sub BigUfoShake
    cball.velx = -2 + 2 * RND(1)
    cball.vely = -10 + 2 * RND(1)
End Sub

Sub UFOLed_Timer()
    Select Case UfoLedPos
        Case 0:ufo1.image = "bigufo1":UfoLedPos = 1
        Case 1:ufo1.image = "bigufo2":UfoLedPos = 2
        Case 2:ufo1.image = "bigufo3":UfoLedPos = 0
    End Select
End Sub

Sub BigUfoUpdate
    Dim a, b
    a = ckicker.y - cball.y
    b = cball.x - ckicker.x

    Ufo1.rotx = - a
    Ufo1.transy = a
    Ufo1.roty = b
    Ufo1d.rotx = - a
    Ufo1d.transy = a
    Ufo1d.roty = b
End Sub

'**********************************
'   Small UFOs Rotation Speed
'**********************************

Sub UFORotSpeedSlow()
    UfoLed.Interval = 600
    RotateUFO.Interval = 100
End Sub

Sub UFORotSpeedMedium()
    UfoLed.Interval = 300
    RotateUFO.Interval = 50
End Sub

Sub UFORotSpeedFast()
    UfoLed.Interval = 150
    RotateUFO.Interval = 25
End Sub

Dim UFOSmallPos
UFOSmallPos = 0

Sub RotateUFO_Timer()
    Ufo2.RotZ = (Ufo2.RotZ - 2)MOD 360
    Ufo4.RotZ = (Ufo4.RotZ - 2)MOD 360
    Ufo5.RotZ = (Ufo5.RotZ - 2)MOD 360
    Ufo6.RotZ = (Ufo6.RotZ - 2)MOD 360
    Ufo7.RotZ = (Ufo7.RotZ - 2)MOD 360
    Ufo8.RotZ = (Ufo8.RotZ - 2)MOD 360
    Select Case UFOSmallPos
        Case 0:ufo2.image = "saucer1":ufo4.image = "saucer4":ufo5.image = "saucer5":ufo6.image = "saucer6":ufo7.image = "saucer7":ufo8.image = "saucer8":UFOSmallPos = 1
        Case 1:ufo2.image = "saucer2":ufo4.image = "saucer5":ufo5.image = "saucer6":ufo6.image = "saucer7":ufo7.image = "saucer8":ufo8.image = "saucer1":UFOSmallPos = 2
        Case 2:ufo2.image = "saucer3":ufo4.image = "saucer6":ufo5.image = "saucer7":ufo6.image = "saucer8":ufo7.image = "saucer1":ufo8.image = "saucer2":UFOSmallPos = 3
        Case 3:ufo2.image = "saucer4":ufo4.image = "saucer7":ufo5.image = "saucer8":ufo6.image = "saucer1":ufo7.image = "saucer2":ufo8.image = "saucer3":UFOSmallPos = 4
        Case 4:ufo2.image = "saucer5":ufo4.image = "saucer8":ufo5.image = "saucer1":ufo6.image = "saucer2":ufo7.image = "saucer3":ufo8.image = "saucer4":UFOSmallPos = 5
        Case 5:ufo2.image = "saucer6":ufo4.image = "saucer1":ufo5.image = "saucer2":ufo6.image = "saucer3":ufo7.image = "saucer4":ufo8.image = "saucer5":UFOSmallPos = 6
        Case 6:ufo2.image = "saucer7":ufo4.image = "saucer2":ufo5.image = "saucer3":ufo6.image = "saucer4":ufo7.image = "saucer5":ufo8.image = "saucer6":UFOSmallPos = 7
        Case 7:ufo2.image = "saucer8":ufo4.image = "saucer3":ufo5.image = "saucer4":ufo6.image = "saucer5":ufo7.image = "saucer6":ufo8.image = "saucer7":UFOSmallPos = 0
    End Select
End Sub

'**********************************************************
' Small shake of small Ufos and other objects when nudging
'**********************************************************

Dim SmallShake:SmallShake = 0

Sub aSaucerShake
    SmallShake = 6
    SaucerShake.Enabled = True
End Sub

Sub SaucerShake_Timer
    ufo2.Rotx = SmallShake
    ufo2a.Rotx = - SmallShake
    ufo7.Rotx = SmallShake
    ufo7a.Rotx = - SmallShake
    ufo8.Rotx = SmallShake
    ufo8a.Rotx = - SmallShake
    ufo6.Rotx = SmallShake
    ufo6a.Rotx = - SmallShake
    ufo5.Rotx = SmallShake
    ufo5a.Rotx = - SmallShake
    ufo4.Rotx = SmallShake
    ufo4a.Rotx = - SmallShake
    alien5.Transz = SmallShake / 2
    alien6.Transz = SmallShake / 2
    alien8.Transz = SmallShake / 2
    alien14.Transz = SmallShake / 2
    If SmallShake = 0 Then SaucerShake.Enabled = False:Exit Sub
    If SmallShake <0 Then
        SmallShake = ABS(SmallShake)- 0.1
    Else
        SmallShake = - SmallShake + 0.1
    End If
End Sub

'**********************************************************
'     JP's Flasher Fading for VPX and Vpinmame
'       (Based on Pacdude's Fading Light System)
' This is a fast fading for the Flashers in vpinmame tables
'  just 4 steps, like in Pacdude's original script.
' Included the new Modulated flashers & Lights for WPC
'**********************************************************

Dim LampState(200), FadingState(200), FlashLevel(200)

InitLamps() ' turn off the lights and flashers and reset them to the default parameters

' vpinmame Lamp & Flasher Timers

Sub LampTimer_Timer()
    Dim chgLamp, num, chg, ii
    chgLamp = Controller.ChangedLamps
    If Not IsEmpty(chgLamp)Then
        For ii = 0 To UBound(chgLamp)
            LampState(chgLamp(ii, 0)) = chgLamp(ii, 1)       'keep the real state in an array
            FadingState(chgLamp(ii, 0)) = chgLamp(ii, 1) + 3 'fading step
        Next
    End If
    UpdateLamps
End Sub

Sub UpdateLamps
    Lamp 11, l11
    Lamp 12, l12
    Lamp 13, l13
    Lamp 14, l14
    Lampm 15, l15a
    Lamp 15, l15
    Lamp 16, l16
    Lamp 17, l17
    Lamp 18, l18
    Lamp 21, l21
    Lamp 22, l22
    Lamp 23, l23
    Lamp 24, l24
    Lamp 25, l25
    Lamp 26, l26
    Lamp 27, l27
    Lamp 28, l28
    Lamp 31, l31
    Lamp 32, l32
    Lamp 33, l33
    Lamp 34, l34
    Lamp 35, l35
    Lamp 36, l36
    Lamp 37, l37
    Lamp 38, l38
    Lamp 41, l41
    Lamp 42, l42
    Lamp 43, l43
    Lamp 44, l44
    Lamp 45, l45
    Lamp 46, l46
    Lamp 47, l47
    Lamp 48, l48
    Lamp 51, l51
    Lamp 52, l52
    Lamp 53, l53
    Lamp 54, l54
    Lamp 55, l55
    Lamp 56, l56
    Lamp 57, l57
    Lamp 58, l58
    Lamp 61, l61
    Lamp 62, l62
    Lamp 63, l63
    Lamp 64, l64
    Lamp 65, l65
    Lamp 66, l66
    Lamp 67, l67
    Lamp 68, l68
    Lamp 71, l71
    Lamp 72, l72
    Lamp 73, l73
    Lamp 74, l74
    Lamp 75, l75
    Lamp 76, l76
    Lamp 77, l77
    Lamp 78, l78
    Lamp 81, l81
    Lamp 82, l82
    Lamp 83, l83
    Lamp 84, l84
    Lamp 85, l85
    Lamp 86, l86
    Lamp 88, l88
    ' ufo red lights
    'Lamp 91, l91
    'Lamp 92, l92
    'Lamp 93, l93
    'Lamp 94, l94
    'Lamp 95, l95
    'Lamp 96, l96
    'Lamp 97, l97
    'Lamp 98, l98
    'Lamp 101, l101
    'Lamp 102, l102
    'Lamp 103, l103
    'Lamp 104, l104
    'Lamp 105, l105
    'Lamp 106, l106
    'Lamp 107, l107
    'Lamp 108, l108
    'flashers
    Lampm 123, f23
    Lamp 123, f23a
    Flash 130, Strobe
    If UseVPMModSol Then
        FlashMod 117, f17b
        FlashMod 117, f17c
        FlashMod 117, f17a
        FlashMod 118, f18b
        FlashMod 118, f18c
        FlashMod 118, f18a
        FlashMod 119, f19b
        FlashMod 119, f19a
        LampMod 120, f20
        FlashMod 120, f20b
        LampMod 121, f21a
        FlashMod 121, f21
        LampMod 122, f22
        FlashMod 125, f25b
        FlashMod 125, f25c
        FlashMod 125, f25a
        FlashMod 126, f26b
        FlashMod 126, f26a
        FlashMod 127, f27b
        FlashMod 127, f27a
        LampMod 128, f28
        FlashMod 128, f28b
    Else
        Flashm 117, f17b
        Flashm 117, f17c
        Flash 117, f17a
        Flashm 118, f18b
        Flashm 118, f18c
        Flash 118, f18a
        Flashm 119, f19b
        Flash 119, f19a
        Lampm 120, f20
        Flash 120, f20b
        Lampm 121, f21a
        Flash 121, f21
        Lamp 122, f22
        Flashm 125, f25b
        Flashm 125, f25c
        Flash 125, f25a
        Flashm 126, f26b
        Flash 126, f26a
        Flashm 127, f27b
        Flash 127, f27a
        Lampm 128, f28
        Flash 128, f28b
    End If
End Sub

' div lamp subs

' Normal Lamp & Flasher subs

Sub InitLamps()
    Dim x
    LampTimer.Interval = 30 ' flasher fading speed
    LampTimer.Enabled = 1
    For x = 0 to 200
        FadingState(x) = 3 ' used to track the fading state
        FlashLevel(x) = 0
    Next
End Sub

Sub SetLamp(nr, value) ' 0 is off, 1 is on
    FadingState(nr) = abs(value) + 3
End Sub

' Lights: used for VPX standard lights, the fading is handled by VPX itself, they are here to be able to make them work together with the flashers

Sub Lamp(nr, object)
    Select Case FadingState(nr)
        Case 4:object.state = 1:FadingState(nr) = 0
        Case 3:object.state = 0:FadingState(nr) = 0
    End Select
End Sub

Sub Lampm(nr, object) ' used for multiple lights, it doesn't change the fading state
    Select Case FadingState(nr)
        Case 4:object.state = 1
        Case 3:object.state = 0
    End Select
End Sub

' Flashers: 4 is on,3,2,1 fade steps. 0 is off

Sub Flash(nr, object)
    Select Case FadingState(nr)
        Case 4:Object.IntensityScale = 1:FadingState(nr) = 0
        Case 3:Object.IntensityScale = 0.66:FadingState(nr) = 2
        Case 2:Object.IntensityScale = 0.33:FadingState(nr) = 1
        Case 1:Object.IntensityScale = 0:FadingState(nr) = 0
    End Select
End Sub

Sub Flashm(nr, object) 'multiple flashers, it doesn't change the fading state
    Select Case FadingState(nr)
        Case 4:Object.IntensityScale = 1
        Case 3:Object.IntensityScale = 0.66
        Case 2:Object.IntensityScale = 0.33
        Case 1:Object.IntensityScale = 0
    End Select
End Sub

' Desktop Objects: Reels & texts (you may also use lights on the desktop)

' Reels

Sub Reel(nr, object)
    Select Case FadingState(nr)
        Case 4:object.SetValue 1:FadingState(nr) = 0
        Case 3:object.SetValue 2:FadingState(nr) = 2
        Case 2:object.SetValue 3:FadingState(nr) = 1
        Case 1:object.SetValue 0:FadingState(nr) = 0
    End Select
End Sub

Sub Reelm(nr, object)
    Select Case FadingState(nr)
        Case 4:object.SetValue 1
        Case 3:object.SetValue 2
        Case 2:object.SetValue 3
        Case 1:object.SetValue 0
    End Select
End Sub

'Texts

Sub Text(nr, object, message)
    Select Case FadingState(nr)
        Case 4:object.Text = message:FadingState(nr) = 0
        Case 3:object.Text = "":FadingState(nr) = 0
    End Select
End Sub

Sub Textm(nr, object, message)
    Select Case FadingState(nr)
        Case 4:object.Text = message
        Case 3:object.Text = ""
    End Select
End Sub

' Modulated Subs for the WPC tables

Sub SetModLamp(nr, level)
    FlashLevel(nr) = level / 150 'lights & flashers
End Sub

Sub LampMod(nr, object)          ' modulated lights used as flashers
    Object.IntensityScale = FlashLevel(nr)
    Object.State = 1             'in case it was off
End Sub

Sub FlashMod(nr, object)         'sets the flashlevel from the SolModCallback
    Object.IntensityScale = FlashLevel(nr)
End Sub

'Walls and mostly Primitives used as 4 step fading lights
'a,b,c,d are the images used from on to off

Sub FadeObj(nr, object, a, b, c, d)
    Select Case FadingState(nr)
        Case 4:object.image = a:FadingState(nr) = 0 'fading to off...
        Case 3:object.image = b:FadingState(nr) = 2
        Case 2:object.image = c:FadingState(nr) = 1
        Case 1:object.image = d:FadingState(nr) = 0
    End Select
End Sub

Sub FadeObjm(nr, object, a, b, c, d)
    Select Case FadingState(nr)
        Case 4:object.image = a
        Case 3:object.image = b
        Case 2:object.image = c
        Case 1:object.image = d
    End Select
End Sub

Sub NFadeObj(nr, object, a, b)
    Select Case FadingState(nr)
        Case 4:object.image = a:FadingState(nr) = 0 'off
        Case 3:object.image = b:FadingState(nr) = 0 'on
    End Select
End Sub

Sub NFadeObjm(nr, object, a, b)
    Select Case FadingState(nr)
        Case 4:object.image = a
        Case 3:object.image = b
    End Select
End Sub

'************************************
' Diverse Collection Hit Sounds v3.0
'************************************

Sub aMetals_Hit(idx):PlaySoundAtBall "fx_MetalHit":End Sub
Sub aRubber_Bands_Hit(idx):PlaySoundAtBall "fx_rubber_band":End Sub
Sub aRubber_LongBands_Hit(idx):PlaySoundAtBall "fx_rubber_longband":End Sub
Sub aRubber_Posts_Hit(idx):PlaySoundAtBall "fx_rubber_post":End Sub
Sub aRubber_Pins_Hit(idx):PlaySoundAtBall "fx_rubber_pin":End Sub
Sub aRubber_Pegs_Hit(idx):PlaySoundAtBall "fx_rubber_peg":End Sub
Sub aPlastics_Hit(idx):PlaySoundAtBall "fx_PlasticHit":End Sub
Sub aGates_Hit(idx):PlaySoundAtBall "fx_Gate":End Sub
Sub aWoods_Hit(idx):PlaySoundAtBall "fx_Woodhit":End Sub

'***************************************************************
'             Supporting Ball & Sound Functions v3.0
'  includes random pitch in PlaySoundAt and PlaySoundAtBall
'***************************************************************

Dim TableWidth, TableHeight

TableWidth = Table1.width
TableHeight = Table1.height

Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
    Vol = Csng(BallVel(ball) ^2 / 2000)
End Function

Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
    Dim tmp
    tmp = ball.x * 2 / TableWidth-1
    If tmp> 0 Then
        Pan = Csng(tmp ^10)
    Else
        Pan = Csng(-((- tmp) ^10))
    End If
End Function

Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
    Pitch = BallVel(ball) * 20
End Function

Function BallVel(ball) 'Calculates the ball speed
    BallVel = (SQR((ball.VelX ^2) + (ball.VelY ^2)))
End Function

Function AudioFade(ball) 'only on VPX 10.4 and newer
    Dim tmp
    tmp = ball.y * 2 / TableHeight-1
    If tmp> 0 Then
        AudioFade = Csng(tmp ^10)
    Else
        AudioFade = Csng(-((- tmp) ^10))
    End If
End Function

Sub PlaySoundAt(soundname, tableobj) 'play sound at X and Y position of an object, mostly bumpers, flippers and other fast objects
    PlaySound soundname, 0, 1, Pan(tableobj), 0.1, 0, 0, 0, AudioFade(tableobj)
End Sub

Sub PlaySoundAtBall(soundname) ' play a sound at the ball position, like rubbers, targets, metals, plastics
    PlaySound soundname, 0, Vol(ActiveBall), pan(ActiveBall), 0.4, 0, 0, 0, AudioFade(ActiveBall)
End Sub

'***********************************************
'   JP's VP10 Rolling Sounds + Ballshadow v3.0
'   uses a collection of shadows, aBallShadow
'***********************************************

Const tnob = 19   'total number of balls
Const lob = 2     'number of locked balls
Const maxvel = 42 'max ball velocity
ReDim rolling(tnob)
InitRolling

Sub InitRolling
    Dim i
    For i = 0 to tnob
        rolling(i) = False
    Next
End Sub

Sub RollingUpdate()
    Dim BOT, b, ballpitch, ballvol, speedfactorx, speedfactory
    BOT = GetBalls

    ' stop the sound of deleted balls
    For b = UBound(BOT) + 1 to tnob
        rolling(b) = False
        StopSound("fx_ballrolling" & b)
        aBallShadow(b).Y = 3000
    Next

    ' exit the sub if no balls on the table
    If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table

    ' play the rolling sound for each ball and draw the shadow
    For b = lob to UBound(BOT)
        aBallShadow(b).X = BOT(b).X
        aBallShadow(b).Y = BOT(b).Y

        If BallVel(BOT(b))> 1 Then
            If BOT(b).z <30 Then
                ballpitch = Pitch(BOT(b))
                ballvol = Vol(BOT(b))
            Else
                ballpitch = Pitch(BOT(b)) + 25000 'increase the pitch on a ramp
                ballvol = Vol(BOT(b)) * 10
            End If
            rolling(b) = True
            PlaySound("fx_ballrolling" & b), -1, ballvol, Pan(BOT(b)), 0, ballpitch, 1, 0, AudioFade(BOT(b))
        Else
            If rolling(b) = True Then
                StopSound("fx_ballrolling" & b)
                rolling(b) = False
            End If
        End If

        ' rothbauerw's Dropping Sounds
        If BOT(b).VelZ <-1 and BOT(b).z <55 and BOT(b).z> 27 Then 'height adjust for ball drop sounds
            PlaySound "fx_balldrop", 0, ABS(BOT(b).velz) / 17, Pan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
        End If

        ' jps ball speed control
        If BOT(b).VelX AND BOT(b).VelY <> 0 Then
            speedfactorx = ABS(maxvel / BOT(b).VelX)
            speedfactory = ABS(maxvel / BOT(b).VelY)
            If speedfactorx <1 Then
                BOT(b).VelX = BOT(b).VelX * speedfactorx
                BOT(b).VelY = BOT(b).VelY * speedfactorx
            End If
            If speedfactory <1 Then
                BOT(b).VelX = BOT(b).VelX * speedfactory
                BOT(b).VelY = BOT(b).VelY * speedfactory
            End If
        End If
    Next
End Sub

'**********************
' Ball Collision Sound
'**********************

Sub OnBallBallCollision(ball1, ball2, velocity)
    PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
End Sub


#156 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 15 June 2021 - 07:29 PM

That is not a table issue

 

When you colorize AFM you are using external DLL cause you are using external color

in which case you need to hide the VPM DMD, which is normal and it does not see the external color patches anyways

 

You dont need to change the vpmcolored though

That is for the flasher DMD display, which if you do not want that showing (which you probably do not since using a ROM colorization) just set that flasher's

visible flag to off

 

Unfortunately usevpmcolored can only see colors that come directly from the ROM as far as i can tell
It does not appear to be able to see external color patches just like VPM can not, kind of a bummer but


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#157 Csilk

Csilk

    Enthusiast

  • Members
  • PipPipPip
  • 208 posts
  • Location:Halifax, Nova Scotia

  • Flag: Canada

  • Favorite Pinball: Bram Stoker's Dracula

Posted 15 June 2021 - 10:32 PM

the problem is that when you add color it ignores the fact you want the DMD display hidden, the script segment is in many tables where it checks if its in desktop mode and if it does and you have colorization on it will never hide the DMD, soon as you turn colorization off the DMD then hides (the external DLL shows but is not colored at all) so you turn it on and then the second pinmame DMD comes back.

 

I had to edit a good many of the tables to get rid of the check for desktop mode.

 

but you are right its not specific to this table but for my purposes it gets in the way of what I want it to do and I'm assuming also anyone using 1080x1920 portrait mode.



#158 wiesshund

wiesshund

    VPF Legend

  • Members
  • PipPipPipPipPipPipPip
  • 11,871 posts

  • Flag: United States of America

  • Favorite Pinball: How many can i have?

Posted 15 June 2021 - 11:36 PM

DMD Colorization is external
No way for the table to know about it that i can think of off hand unfortunately, if you find one, i would love to know too.

 

I normally just have all the VPM displays defaulted to off
If i am showing one, it is freezy's DMD or Alphanumerics anyways

the only exception is strikes and spares and pac man as nothing else but PinMAME is capable of displaying those.

 

In your case, as you are running basically in cab orientation, just a different way of getting there
I would probably set vpx to use fs backdrop settings for all tables, and then make an autopov.pov with 0 rotation

 

POV files are just XML docs, so you can edit one to just change the rotation and not make other changes like inclination etc if you wanted.

Then it will disable the desktop stuff that you probably dont want anyways, like the backdrop etc

 

You are running something kind of like this i take it?
Except on a  much bigger and better screen

ay4vCPR.jpg

 

qooMQwx.jpg

 

 

KUUCyay.jpg


If you feel the need to empty your wallet in my direction, i don't have any way to receive it anyways

Spend it on Hookers and Blow


#159 Csilk

Csilk

    Enthusiast

  • Members
  • PipPipPip
  • 208 posts
  • Location:Halifax, Nova Scotia

  • Flag: Canada

  • Favorite Pinball: Bram Stoker's Dracula

Posted 15 June 2021 - 11:55 PM

easier to just change script

'****************************************************************************
'Ignore DT Mode and use Portrait Mode Monitor with Freezy or External DLL DMD
' 1 = External DLL DMD, 0 = Use Normal DT Detection for DMD
'****************************************************************************
PortraitMode = 1
'****************************************************************************

If PortraitMode = 1 then
UseVPMColoredDMD = false
VarHidden = 1
end if

If PortraitMode = 0 then
If Table1.ShowDT = true then
    UseVPMColoredDMD = true
    VarHidden = 1
else
    UseVPMColoredDMD = false
    VarHidden = 0
end if
end if

if JPSalas would be so kind to start using this as standard (as well as any other author)

 

it accounts for someone with my setup and allows it to be easily changed with 1 line while still retaining the other 2 options. when I do as you say by defaulting it hidden the script turns it back on since it sees that I'm in DT mode.


if not its fine I mean I can easily add this to all my table scripts to get the desired behavior

 

I do have some coding knowledge in C#, LUA, BASIC and GML.


DMD Colorization is external
No way for the table to know about it that i can think of off hand unfortunately, if you find one, i would love to know too.

 

I normally just have all the VPM displays defaulted to off
If i am showing one, it is freezy's DMD or Alphanumerics anyways

the only exception is strikes and spares and pac man as nothing else but PinMAME is capable of displaying those.

 

In your case, as you are running basically in cab orientation, just a different way of getting there
I would probably set vpx to use fs backdrop settings for all tables, and then make an autopov.pov with 0 rotation

 

POV files are just XML docs, so you can edit one to just change the rotation and not make other changes like inclination etc if you wanted.

Then it will disable the desktop stuff that you probably dont want anyways, like the backdrop etc

 

You are running something kind of like this i take it?
Except on a  much bigger and better screen

ay4vCPR.jpg

 

qooMQwx.jpg

 

 

KUUCyay.jpg

 

yes and no I have a second screen to the left of my portrait mode monitor with the DMD and backglass. Any table that uses that same snippet as JPSalas table has this issue with not being able to hide the DMD because its using the DT mode to determine if it should hide it or not.

 

My initial assumption about colorization was wrong, its simply unhiding it when it sees I'm in DT mode but what I'm saying is DO NOT use this snippet of code because the default behavior of simply not checking is superior because it works without having to edit anything but if you wish to use that piece of script still then please add a 3rd option to it to easily ignore the DT detection as it only causes headaches for certain setups.

 

I'm guessing this snippet of code has been passed on from table to table for a very long amount of years but is really unnessacery in VPX.


Edited by Csilk, 16 June 2021 - 12:18 AM.


#160 Csilk

Csilk

    Enthusiast

  • Members
  • PipPipPip
  • 208 posts
  • Location:Halifax, Nova Scotia

  • Flag: Canada

  • Favorite Pinball: Bram Stoker's Dracula

Posted 16 June 2021 - 12:24 AM

my-setup.png

 

this is my setup until my cabinet arrives.







Also tagged with one or more of these keywords: Attack, mars