Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ACTIONFILE V4
- ENABLED True
- INSTALL Version=1.0.0.1
- INSTALL MinEDVersion=10.6.0.0
- INSTALL ShortDescription="LED and MFD actions for the Saitek X52 Pro HOTAS"
- EVENT UIFsdMassLocked, UIFsdMassLocked, "", Condition AlwaysTrue
- EVENT onRefreshEnd, StartupShutdown, "", Condition AlwaysTrue
- EVENT onShutdown, StartupShutdown, "", Condition AlwaysTrue
- EVENT UIFsdCharging, UIFsdCharging, "", Condition AlwaysTrue
- EVENT UIFsdCooldown, UIFsdCooldown, "", Condition AlwaysTrue
- EVENT UISupercruise, UISupercruise, "", Condition AlwaysTrue
- EVENT UILandingGear, UILandingGear, "", Condition AlwaysTrue
- EVENT FSDJump, FSDJump, "", Condition AlwaysTrue
- EVENT Docked, JournalDocked, "", Condition AlwaysTrue
- EVENT UIDocked, UIDocked, "", Condition AlwaysTrue
- EVENT onStartup, onStartup, "", Condition AlwaysTrue
- EVENT StartJump, StartJump, "", Condition AlwaysTrue
- EVENT Location, AtLocation, "", Condition AlwaysTrue
- // ****************************************************************************************************************
- // This script provides feedback of FSD status, Landing gear state, and MFD info about current system/docking state
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- // FSD state is on light for button T3/T4 (because I have FSD on T3)
- // When FSD is on cooldown, slow flashing red.
- // When Mass locked, steady red
- // When FSD available and not in supercruise, steady green
- // When FSD is charging, flash flashing amber
- // When FSD is in hyperdrive, steady amber
- // When FSD is in supercruise, slow flashing green
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- // Landing gear state is on light for button T1/T2 (Gear is on T1 for me)
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- // When gear is up, steady green
- // When gear is down, steady red
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- // MFD will store star class when a jump is made, before that point star class is not known
- // Otherwise when not docked, it will show "System:" on line 1, the system name on line 2.
- // If star class is known "Type: x" with the class of star will be shown.
- // When performing a hyperspace jump it will show "Jumping to:" line 1, system name on line 2, and "Type: x" with
- // star class on line 3.
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- // Todo:
- // Use lights on throttle to indicate some status, under attack, heat warning, interdiction etc
- // Perhaps some other status for other activities as they come along, fuel scoop etc
- // Another idea is to have some lights change based on posture, e.g. most pips to engine, normal running (green)
- // most pips to systems, defensive (amber, flashing if under attack), most pips to weapons (red, flashing if under attack)
- // It's a real shame there's no feedback of the engine bars (not pips). Would have been good to give feedback of
- // boost availability.
- // Another idea is to turn off certain lights when they're not applicable. When docked for example
- // ****************************************************************************************************************
- //*************************************************************
- // onStartup
- // Events: onStartup
- //*************************************************************
- PROGRAM onStartup
- // Declare set set flags
- Global isMassLocked = 0
- Global isFsdCooldown = 0
- Global isFsdCharging = 0
- Global isStartHyperJump = 0
- Global isStartSupercruise = 0
- Global isDocked = 0
- Global isGearDown = 0
- Global superCruiseState = 0
- // Declare and set strings
- Global currentSystem = ""
- Global starClass = ""
- Global currentDock = ""
- END PROGRAM
- //*************************************************************
- // StartupShutdown
- // Events: onRefreshEnd, onShutdown
- //*************************************************************
- PROGRAM StartupShutdown
- // When starting/shutting down EDDProfile, set some default lighting settings (all green)
- DLLCall EDDX52, setLED, FIRE, GREEN
- DLLCall EDDX52, setLED, FIRE_A, GREEN
- DLLCall EDDX52, setLED, FIRE_B, GREEN
- DLLCall EDDX52, setLED, FIRE_D, GREEN
- DLLCall EDDX52, setLED, FIRE_E, GREEN
- DLLCall EDDX52, setLED, TOGGLE_1_2, GREEN
- DLLCall EDDX52, setLED, TOGGLE_3_4, GREEN
- DLLCall EDDX52, setLED, TOGGLE_5_6, GREEN
- DLLCall EDDX52, setLED, POV_2, GREEN
- DLLCall EDDX52, setLED, CLUTCH, GREEN
- DLLCall EDDX52, setLED, THROTTLE, ON
- END PROGRAM
- //*************************************************************
- // updateMFD
- //*************************************************************
- PROGRAM updateMFD
- // Always reset MFD
- DLLCall EDDX52, resetMFD
- // Set first line based on state
- If isStartHyperJump IsTrue
- DLLCall EDDX52, setString, 0, "Jumping to:", MFD_STARTJUMP1
- ElseIf isDocked IsTrue
- DLLCall EDDX52, setString, 0, "Docked:", MFD_JDOCKED1
- Else
- DLLCall EDDX52, setString, 0, "System:", MFD_FSDJUMP1
- // Set second line based on state
- If currentSystem $!= ""
- DLLCall EDDX52, setString, 1, %(currentSystem), MFD_STARTJUMP2
- Else
- DLLCall EDDX52, setString, 1, "UNKNOWN", MFD_STARTJUMP2
- // Set third line based on state
- If isDocked IsTrue
- DLLCall EDDX52, setString, 2, %(currentDock), MFD_JDOCKED3
- ElseIf starClass $!= ""
- DLLCall EDDX52, setString, 2, "Type: %(starClass)", MFD_STARTJUMP3
- END PROGRAM
- //*************************************************************
- // updateFsdLights
- //*************************************************************
- PROGRAM updateFsdLights
- // This handles the lighting on T3/T4 which shows the FSD state using the following priority.
- // isFsdCooldown > isStartHyperJump > isStartSupercruise > isFsdCharging > isMassLocked > superCruiseState
- If isFsdCooldown IsTrue
- // Cooldown state T3/T4 = Red flashing 1s on 1s off
- DLLCall EDDX52, setLED, TOGGLE_3_4, RED
- DLLCall EDDX52, advSetLED, 11, 1, 1, 1, 1, 0
- DLLCall EDDX52, syncFlashPatterns
- ElseIf isStartHyperJump IsTrue
- // Hyperspace jump in progress = T3/T4 = fast flash green/amber
- DLLCall EDDX52, setLED, TOGGLE_3_4, GREEN
- DLLCall EDDX52, advSetLED, 11, 1, 1, 0.25, 0.25, 0
- //DLLCall EDDX52, advSetLED, 12, 1, 1, 0.25, 0.25, 0.5
- DLLCall EDDX52, syncFlashPatterns
- //DLLCall EDDX52, permaSyncTo, 11, 12
- ElseIf isStartSupercruise IsTrue
- // Supercruise charging = T3/T4 = Green flashing .25s on .25s off
- DLLCall EDDX52, setLED, TOGGLE_3_4, OFF
- DLLCall EDDX52, advSetLED, 12, 1, 1, 0.25, 0.25, 0
- DLLCall EDDX52, syncFlashPatterns
- ElseIf isFsdCharging IsTrue
- // Charging state T3/T4 = Amber flashing .25s on .25s off
- DLLCall EDDX52, setLED, TOGGLE_3_4, OFF
- DLLCall EDDX52, advSetLED, 11, 1, 1, 0.25, 0.25, 0
- DLLCall EDDX52, advSetLED, 12, 1, 1, 0.25, 0.25, 0
- DLLCall EDDX52, syncFlashPatterns
- ElseIf isMassLocked IsTrue
- // Mass locked = T3/T4 = Red
- DLLCall EDDX52, setLED, TOGGLE_3_4, RED
- ElseIf superCruiseState IsTrue
- // In supercruise = T3/T4 = Green flashing 1s on 1s off
- DLLCall EDDX52, setLED, TOGGLE_3_4, OFF
- DLLCall EDDX52, advSetLED, 12, 1, 1, 1, 1, 0
- DLLCall EDDX52, syncFlashPatterns
- Else
- // Otherwise in regular space = T3/T4 = Green
- DLLCall EDDX52, setLED, TOGGLE_3_4, GREEN
- END PROGRAM
- //*************************************************************
- // updateGearLight
- //*************************************************************
- PROGRAM updateGearLight
- // This handles the lighting on T1/T2 which shows the landing gear state
- If isGearDown IsTrue
- DLLCall EDDX52, setLED, TOGGLE_1_2, RED
- Else
- DLLCall EDDX52, setLED, TOGGLE_1_2, GREEN
- END PROGRAM
- //*************************************************************
- // UIFsdMassLocked
- // Events: UIFsdMassLocked
- //*************************************************************
- PROGRAM UIFsdMassLocked
- // Update mass locked status then update FSD light state
- If EventClass_MassLocked IsTrue
- Global isMassLocked = 1
- Else
- Global isMassLocked = 0
- Call updateFsdLights
- END PROGRAM
- //*************************************************************
- // UIFsdCooldown
- // Events: UIFsdCooldown
- //*************************************************************
- PROGRAM UIFsdCooldown
- // Update FSD cooldown status then update FSD light state
- If EventClass_CoolDown IsTrue
- Global isFsdCooldown = 1
- Else
- Global isFsdCooldown = 0
- Call updateFsdLights
- END PROGRAM
- //*************************************************************
- // UISupercruise
- // Events: UISupercruise
- //*************************************************************
- PROGRAM UISupercruise
- // Update supercruise status then update FSD light state
- If EventClass_Supercruise IsTrue
- Global superCruiseState = 1
- Global isStartSupercruise = 0
- Else
- Global superCruiseState = 0
- Call updateFsdLights
- END PROGRAM
- //*************************************************************
- // UIFsdCharging
- // Events: UIFsdCharging
- //*************************************************************
- PROGRAM UIFsdCharging
- // Update charging status then update FSD light state
- If EventClass_Charging IsTrue
- Global isFsdCharging = 1
- Else
- Global isFsdCharging = 0
- Call updateFsdLights
- END PROGRAM
- //*************************************************************
- // AtLocation
- // Events: Location
- //*************************************************************
- PROGRAM AtLocation
- // Seems to be called at game start so let's populate info we can get
- // Set current system and dock if set, and docked state then update MFD
- If EventClass_Docked IsTrue
- Global isDocked = 1
- Else
- Global isDocked = 0
- If EventClass_StarSystem $!= ""
- Global currentSystem = %(EventClass_StarSystem)
- If EventClass_StationName $!= ""
- Global currentDock = %(EventClass_StationName)
- Call updateMFD
- END PROGRAM
- //*************************************************************
- // StartJump
- // Events: StartJump
- //*************************************************************
- PROGRAM StartJump
- // If we're hyperspace jumping, make sure to update current system to target system
- // (can the jump not happen at this point? Might be a problem if it can)
- // Update FSD status and MFD
- If EventClass_JumpType $== Hyperspace
- Global isStartSupercruise = 0
- Global isStartHyperJump = 1
- Global currentSystem = %(EventClass_StarSystem)
- Global starClass = %(EventClass_StarClass)
- Else
- Global isStartHyperJump = 0
- Global isStartSupercruise = 1
- if EventClass_StarSystem $!= ""
- Global currentSystem = %(EventClass_StarSystem)
- Call updateFsdLights
- Call updateMFD
- END PROGRAM
- //*************************************************************
- // FSDJump
- // Events: FSDJump
- //*************************************************************
- PROGRAM FSDJump
- // Update status to normal (we just finished a jump), then update FSD status and MFD
- Global isStartHyperJump = 0
- Global currentSystem = %(EventClass_StarSystem)
- Call updateFsdLights
- Call updateMFD
- END PROGRAM
- //*************************************************************
- // UILandingGear
- // Events: UILandingGear
- //*************************************************************
- PROGRAM UILandingGear
- // Update gear state and then update gear light
- If EventClass_Gear IsTrue
- Global isGearDown = 1
- Else
- Global isGearDown = 0
- Call updateGearLight
- END PROGRAM
- //*************************************************************
- // JournalDocked
- // Events: Docked
- //*************************************************************
- PROGRAM JournalDocked
- // Set docked state, and station name then update MFD
- Global isDocked = 1
- Global currentDock = %(EventClass_StationName)
- If currentSystem $== ""
- Global currentSystem = %(EventClass_StarSystem)
- Call updateMFD
- END PROGRAM
- //*************************************************************
- // UIDocked
- // Events: UIDocked
- //*************************************************************
- PROGRAM UIDocked
- // If we undocked, change state and update MFD
- If EventClass_Docked IsFalse
- Global isDocked = 0
- Global currentDock = ""
- If currentSystem $!= ""
- Call updateMFD
- END PROGRAM
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement