Levinsky Posted September 18, 2013 Posted September 18, 2013 Hi guys, anyone know of a way to get the current number of chaff and flares on a given aircraft? I can't see anything. I found this below but its rather cryptic and not sure it means anything. LoGetSnares = {chaff,flare} Ken.
Levinsky Posted September 20, 2013 Author Posted September 20, 2013 Found the answer Hi guys, turns out it is pretty simple to get the chaff and flare count. local CM = LoGetSnares() default_output_file:write(string.format("Chaff count = %d \n",CM.chaff)) default_output_file:write(string.format("Flare count = %d \n",CM.flare)) Of course you could push this out to external app via UDP or whatever you want. I intend to use this for the counter measure panels to write to an LCD via probably an Arduino board. Ken. 2
Duckling Posted September 20, 2013 Posted September 20, 2013 Hehe, you may call it simple but you way ahead of me. How/where sid you found the extract command for the chaffs & flares? Is there a 'complete' list of existing ones ? - - - -
Levinsky Posted September 21, 2013 Author Posted September 21, 2013 Hi Gus, yeah it's simple now.. but simple was not the right word when working it out. No documentation around this unfortunately. I installed cygwin and ran the Unix commands "strings" and "grep" over every file in the DCS folder looking for references of "chaff" and "flare". In the original export.lua (it's about 39KB) there is a section towards the end that has the code: LoGetSnares = {chaff,flare} Then through a bit of trial and error with that function I found out that it returns a table. If you put the code from original post into the processafternextframe function of Export.lua it just constantly sends you the chaff and flare count. Tested it by dropping chaff and it decrements along with what the cockpit was telling me. So for the CMSP panel. Pretty much everything is a known state from start except how many chaff and flares. My intention is just track when the switches or buttons are used on the panel and update both the sim and my own values driving the LCD display. You can also get the error/damage state of the counter measures and ECM gear so you can put the correct error message on or shutdown the display/panel if the sim is reporting your counter measures are out. I think with this I can avoid either exporting the display and chewing up another monitor port or using OCR. But will see. Will be cutting and engraving the panel soon so will report on how it works out. Definitely going with the Arduino for driving the LCD as I have more experience coding and working with Arduino. Ken.
Levinsky Posted September 21, 2013 Author Posted September 21, 2013 Hi Gus, also - unfortunately I couldn't find a complete listing of functions (spent a lot of time looking :)). I use "strings" and "grep" a lot when trying to solve a particular problem. If I find any others I will post them up. I should probably start a thread for my cockpit build. Ken.
Hansolo Posted September 22, 2013 Posted September 22, 2013 Very nice find :thumbup: Looking forward to hear the results of your export. I am currently using Gremlin/Tacno's OCR but it is eating 10 FPS probably due to CPU load. Cheers Hans 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album
Bailey Posted December 7, 2020 Posted December 7, 2020 On 9/21/2013 at 1:09 AM, Levinsky said: Found the answer Hi guys, turns out it is pretty simple to get the chaff and flare count. local CM = LoGetSnares() default_output_file:write(string.format("Chaff count = %d \n",CM.chaff)) default_output_file:write(string.format("Flare count = %d \n",CM.flare)) Of course you could push this out to external app via UDP or whatever you want. I intend to use this for the counter measure panels to write to an LCD via probably an Arduino board. Ken. Thank you. I used local chaffNumber = Export.LoGetSnares().chaff local flareNumber = Export.LoGetSnares().flare WAIFU2.log(chaffNumber) WAIFU2.log(flareNumber) and it worked. DCS VoiceAttack Profiles | My Mods and Utilities on ED User Files | DiCE: DCS Integrated Countermeasure Editor DCS Update Witching Utility | DCS-ExportScripts for Stream Deck Community Github Library | Kiowa Integrated Overlays
Recommended Posts