

nosaMtrevoC
Members-
Posts
209 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by nosaMtrevoC
-
Ok, as promised, I'm posting this here so that someone stumbling across this can get a real life working example. this isn't designed as a "how-to". when I wanted to do this I couldn't find an example of anyone calling the objects i required, so i took the day and started pumping through the code and what was called from where etc.. This type of example would have saved me a number of hours of slow progress. Secondly, Yesterday was the first time I've ever laid eyes on lua, so suggestions and comments on code improvement (especially relating to the fuel function) are welcome, although the fuel function is less a lua logic problem and just a logic problem in general. You asked where to insert? This is in the P-51D.lua file located in the C:\Users\YOU\Saved Games\DCS\Scripts\DCS-ExportScript\ExportsModules folder, obviously (to me) a part of the DCS-ExportScript Script that is required to run this streamdeck plugin. Both are great. Below the ConfigArguments {} are the comments HIGH IMPORTANCE EXPORTS and the first function that starts: -- Pointed to by ProcessIkarusDCSHighImportance function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice) --some comments about an a10c radio end you can replace the entire function above with the code below which includes the same function and a fuel function that I basically just outlined last night for future work. From the below and the stream deck plugin I can now have a number of things I wanted like live heading and TAS and Altimeter information on the buttons including a single button that shows all the temperature and pressure information live with warnings, proper fuel guages etc. I plan to change some of these numerical values into actual working guages on the streamdeck in the future. Maybe analog fuel guages or on jets having weapon systems that show the loadouts like the mfd's etc.. Anyways, here you go, hope this saves someone an hour or two as an example, not necessarily a pop this in my script and it works. keep in mind that although the code works, you would still need to setup the streamdeck plugin to work with it. ----------------------------- -- HIGH IMPORTANCE EXPORTS -- -- done every export event -- ----------------------------- function ExportScript.CalculateFuel(fuelNeedlePosition) --This is inaccurate at best, but gives a much better option than a straight multiplier. Have to figure out something better --which multiplier applies (e.g. falls between 0.0 and 0.2, multiplier is value from dcs * (5.0 / 0.2) or .125 * 25 = us gallons) -- Fuel_Tank_Left {0.0,5.0,15.0,30.0,45.0,60.0,75.0,92.0} {0.0,0.2,0.36,0.52,0.65,0.77,0.92,1.0} This is the multiplier's to position of needle index local usGallons if fuelNeedlePosition >= 0.96 then usGallons = fuelNeedlePosition * (92.9) elseif fuelNeedlePosition >= 0.92 and fuelNeedlePosition < 0.96 then --0.92 = 75usg - 92usg MULTIPLIER = usGallons = fuelNeedlePosition * (92.9-6) elseif fuelNeedlePosition >= 0.77 and fuelNeedlePosition < 0.92 then --0.77 = 60 usg - 75 usg MULTIPLIER = usGallons = fuelNeedlePosition * (81.5-2) elseif fuelNeedlePosition >= 0.65 and fuelNeedlePosition < 0.77 then --0.65 = 45 usg - 60 usg MULTIPLIER = usGallons = fuelNeedlePosition * (77.9-4) elseif fuelNeedlePosition >= 0.52 and fuelNeedlePosition < 0.65 then --0.52 = 30 usg - 45 usg MULTIPLIER = usGallons = fuelNeedlePosition * (69.2-6) elseif fuelNeedlePosition >= 0.36 and fuelNeedlePosition < 0.52 then --0.36 = 15 usg - 30 usg MULTIPLIER = usGallons = fuelNeedlePosition * (57.7-8) elseif fuelNeedlePosition >= 0.2 and fuelNeedlePosition < 0.36 then --0.20 = 5 usg - 15 usg MULTIPLIER = usGallons = fuelNeedlePosition * (41.7-8) elseif fuelNeedlePosition >= 0.0 and fuelNeedlePosition < 0.2 then --0.00 = 0 usg - 5 usg MULTIPLIER = usGallons = fuelNeedlePosition * 25 end return usGallons end -- Pointed to by ProcessIkarusDCSHighImportance function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice) local trueHeading = string.format("%d", (mainPanelDevice:get_argument_value(12) * 360)) .. "°" .. "\nHDG" ExportScript.Tools.SendData(2012, trueHeading) --True heading ExportScript.Tools.SendData(2002, string.format("%d", (mainPanelDevice:get_argument_value(2) * 360)).. '° HDG') --commanded heading knob -- [96] = "%.4f", -- Altimeter_10000_footPtr {0.0, 100000.0}{0.0, 1.0} --add altimeter values up local digAltitude = mainPanelDevice:get_argument_value(96) * 100000 local lowAltitude = 0 if digAltitude > 90000 then ExportScript.Tools.SendData(2025, "-") --ten thousands else ExportScript.Tools.SendData(2025, string.format("%d", digAltitude)) --ten thousands end if digAltitude <= 50 then lowAltitude = 1 elseif digAltitude > 90000 then lowAltitude = 1 else lowAltitude = 0 end ExportScript.Tools.SendData(2096, lowAltitude) --[[ [160] = "%.4f", -- Fuel_Tank_Fuselage {0.0,10.0,20.0,30.0,40.0,50.0,60.0,70.0,80.0,85.0} {0.0,0.12,0.28,0.40,0.51,0.62,0.72,0.83,0.96,1.0} ]] ExportScript.Tools.SendData(2155, string.format("%d", ExportScript.CalculateFuel(mainPanelDevice:get_argument_value(155))) .. ' gal' ) --155 Left Fuel Tank ExportScript.Tools.SendData(2156, string.format("%d", ExportScript.CalculateFuel(mainPanelDevice:get_argument_value(156))) .. ' gal' ) --156 Right Fuel Tank --ExportScript.Tools.SendData(2155, string.format("%.4f", mainPanelDevice:get_argument_value(155))..' gal') --155 Left Fuel Tank --ExportScript.Tools.SendData(2156, string.format("%d", mainPanelDevice:get_argument_value(156))..' gal') --156 Right Fuel Tank local fuel_fuselage = mainPanelDevice:get_argument_value(160) * 100 if fuel_fuselage > 0.25 then ExportScript.Tools.SendData(2160, string.format("%d", (fuel_fuselage))..' gal') --160 Fuselage Tank else ExportScript.Tools.SendData(2160, '- gal') --160 Fuselage Tank end local speedNum = mainPanelDevice:get_argument_value(11) * 1000 local speedNeedle = string.format("%d", (mainPanelDevice:get_argument_value(11) * 1000)) .. "\nMPH" ExportScript.Tools.SendData(2011, speedNeedle) --Air Speed Needle if speedNum < 455 then ExportScript.Tools.SendData(3011, 0) --Within Limits else ExportScript.Tools.SendData(3011, 1) --About to Overspeed end local manifold = mainPanelDevice:get_argument_value(10) * 75 --manifold pressure local rpm = mainPanelDevice:get_argument_value(23) * 4500 local tofTemp = mainPanelDevice:get_argument_value(30) * 100 --Oil.Temp. local tofOil = mainPanelDevice:get_argument_value(31) * 200 local tofFuel = mainPanelDevice:get_argument_value(32) * 25 local FullInfoString = "Man. " .. string.format("%d", manifold) .. " inHg" .. "\nEngRPM " .. string.format("%d", rpm) .. "\nOil Temp " .. string.format("%d", tofTemp) .. " °C" .. "\nOil " .. string.format("%d", tofOil) .. " PSI" .. "\nFuel " .. string.format("%d", tofFuel) .. " PSI" ExportScript.Tools.SendData(3033, FullInfoString) --SYSTEMS MONITORING FOR ABOVE VALUES (changes stream deck buutton to red for one of the above values out of range (danger)) local infoDanger = 0 if manifold > 60 then --Manifold no more than 60 inches mercury infoDanger = 1 elseif rpm > 3025 then --rpm no more than 3000 infoDanger = 1 elseif tofTemp > 90 then --temp no more than 90c infoDanger = 1 elseif tofOil > 90 then --Oil press. no more than 90PSI infoDanger = 1 elseif tofOil < 50 then --oil press. no less than 50 infoDanger = 1 elseif tofFuel > 19 then --fuel press. no more than 19 infoDanger = 1 elseif tofFuel < 12 then --fuel press. no less than 12 infoDanger = 1 end ExportScript.Tools.SendData(3032, infoDanger) end
-
I'll post my full p-51 additions for this streamdeck plugin tomorrow for you.
-
In case anyone haps upon this looking for the answer to my above questions I asked (about applying modifiers or math to the data), I edited my planes export dcs lua file and added the following to the following: function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice) ExportScript.Tools.SendData(2001, string.format("%d", (mainPanelDevice:get_argument_value(12) * 360))..'°') end This now creates a new ID that i can monitor "2001" that displays 180° for my heading instead of 0.5000 Now I can apply similiar formatting to all the other values that look strange.
-
In case anyone haps upon this looking for one of the questions I asked above (about applying modifiers or math to the data), I edited my planes export dcs lua file and added the following to the following: function ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice) ExportScript.Tools.SendData(2001, string.format("%d", (mainPanelDevice:get_argument_value(12) * 360))..'°') end This now creates a new ID that i can monitor "2001" that displays 180° for my heading instead of 0.5000 Now I can apply similiar formatting to all the other values that look strange.
-
Using DCS-ExportScript successfully to output plane data. Awesome script. Hoping i'm posting in the correct thread here, but I'm wondering if anyone can poke me in the right direction. I would like to change the output for a given piece of data. For example, Heading is displayed as a range from 0.0000 to 1.0000, 0.5000 being 180 degrees. I can obviously take 0.5 * 360 to get my correct 180 heading displayed but am having trouble figuring out where to get the variable data from in the export plane lua file. In P-51D.lua (DCS-ExportScript) within the ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice) function ExportScript.Tools.SendData(2001, string.format("%d", (0.12345678 * 360))) allows me to monitor the DCS ID of 2001 and correctly takes the decimal number 0.12345678 and formats it to heading of 44 degress. What i need to figure out now is how to get the raw heading data as a variable, for exampe: MyGyroHeading = liveData ExportScript.Tools.SendData(2001, string.format("%d", (MyGyroHeading * 360))) Have played with GetDevice(20) which seems to return an Array I digress, need to figure out how to find the variables and access them. Something like: myGyroHeading = ExportScript.gyroheading[1]['value'] Any help would be greatly appreciated.
-
Made some progress, In P-51D.lua (DCS-ExportScript) within the ExportScript.ProcessIkarusDCSConfigHighImportance(mainPanelDevice) function ExportScript.Tools.SendData(2001, string.format("%d", (0.12345678 * 360))) allows me to monitor the DCS ID of 2001 in the "Title Text Change..." options in this stream deck plugin and correctly takes the decimal number 0.12345678 and formats it to heading of 44 degress. What i need to figure out now is how to get the raw heading data as a variable, for exampe: MyGyroHeading = liveData ExportScript.Tools.SendData(2001, string.format("%d", (MyGyroHeading * 360))) Have played with GetDevice(20) which seems to return an Array, next step for me is to figure out how to access an array in .lua files (not familiar with lua at all but i assume its something like var[0] or simliar. I digress, need to figure out how to find the variables and access them. Output from export to streamdeck is working, just can't access the raw data from here yet.
-
A big one for me is figuring out how to display the output of some of the monitored DCS id's. Think I'll have to play with how the values are output from the .lua file somehow. The plugin is awesome, and I'm displaying things like heading and what heading my knob is tuned to so that i don't have to be looking down at my instruments while flying to set my runway heading for approach etc... righ not a 180 degree heading shows as 0.5000 which is fine for headings that ar obvious, but 0.8424 is less obvious. Need to figure out where to put heading=heading*360 to get a nice output, or for example rpm=rpm*1000 to show 1200 rpm instead of 0.1200 rpm. Any ideas are appreciated.
-
First of all, great plugin. An awesome contribution. Have a few questions that I'll try to keep short: First of all, on the display string unaltered option text box (when unchecked) I have a heading indicator of 0.0000 - 1.0000 range (10,000 increments) which are way to many options to make key=text or 0.5000=180,0.5001=180 etc.... Is there a way to display key=key*360? to show 180 for 0.5000? Secondly, is there a way to support three way switches with image state changes. On my electrical and lighting panels, all the two way switches work great with your plugin (reducing two buttons to one), but I still have to have 3 hotkey buttons for 3 way switches. Would be nice to reduce this to one switch. Lastly, is it possible to monitor values from DCS that are not in your ID lookup? Is your lookup all inclusive of the items I can use, or can I go beyond this somehow (by knowing the id myself, or adding to the export script to export these values etc..) Last question. Do you have a donate page? Again, awesome plugin, appreciate your time.
-
StreamDeck plugin for DCS
nosaMtrevoC replied to Mad Jack's topic in PC Hardware and Related Software
Just wondering the status of your stream deck plugin. Was the development of this continued? Is it in a working state. I like the above video, but I find touch screens difficult compared to the tactile feedback of the stream deck. I'm also wondering if your stream deck plugin would work better than my current setup which works for the most part (no 2 way obviously), stream deck just acting as a keyboard but for some reason, some key combinations don't work. Mostly I find PAUSE (as in pause/break key) never works on stream deck (for pausing game or for fps counter for instance) I also can't interact directly with dcs for things like request taxi or request start unless the module has a key binding for that. Anyways, nice work, just wondering if you have any updates on the stream deck side of things.