Jump to content

New StreamDeck Plugin


Recommended Posts

@Bailey Good news, I got the Spitfire (non-CW) and Mossie working. Thanks for your help! There was a slight hiccup where most of the Spitfire 3xxx IDs weren't getting to DCS for some reason, but resaving the LUA and a DCS restart fixed that.

Just wanted to ask about the Spitfire CW. I noticed the LUA is missing most of the code that the non-CW script has in it. Just wondered if there was a reason for it before I tried copying across the functions and probably making a mess of it, haha.

 

 

PC specs:

 

 

Link to comment
Share on other sites

13 hours ago, bones1014 said:

@Bailey I was using your fuel flow readout for the F-16. It works mostly except for skipping over the 7000- 7900 fuel flow range. The 1000's place stays at 6k through both the 6k and 7k ranges.

Darn. I likely used round()? you might be able to change that to math.floor() to fix it. That happened with another module recently, the UH-60L iirc. The issue being that the display of the graphic does not exactly match the parameters for the rounding for that specific number.

1 hour ago, bell_rj said:

@Bailey Good news, I got the Spitfire (non-CW) and Mossie working. Thanks for your help! There was a slight hiccup where most of the Spitfire 3xxx IDs weren't getting to DCS for some reason, but resaving the LUA and a DCS restart fixed that.

Just wanted to ask about the Spitfire CW. I noticed the LUA is missing most of the code that the non-CW script has in it. Just wondered if there was a reason for it before I tried copying across the functions and probably making a mess of it, haha.

 

 

Nope. Go for it. Let me know if it turns out well.

  • Like 1
Link to comment
Share on other sites

21 hours ago, bones1014 said:

@bailey I was trying to make the A-4 radar tilt angle better by making it a continuous range instead of set at 5 deg increments. I haven't thought up a way to do this yet. What is your technique?

Sent from my SM-G781U using Tapatalk
 

 

Iirc the knob in the game is "continuous" and fluid. If that is the case, what you will need to do is make an equation that translate the position of the knob to the position of the radar (aka, what degree the knob is pointing to). That equation may take a bit to figure out. What I would likely do is, say for example the radar degrees go from -50 to +50. I dont like to think in negatives so I'll add 50 to make the new range 0 to +100. That makes it much easier because with a knob that is 0 to 1 the equation will be `knobPosition x 100 = radarAngle`. Doing that for knob that is half way (0.50) will give us 50 degrees. But wait, remember that 50 we added before? We need to take it back. So now our equation becomes `(knobPosition x 100) - 50 = radarAngle`. Which in the above scenario gives us 0 degrees. Done.


Edited by Bailey
Link to comment
Share on other sites

3 hours ago, Bailey said:

Iirc the knob in the game is "continuous" and fluid. If that is the case, what you will need to do is make an equation that translate the position of the knob to the position of the radar (aka, what degree the knob is pointing to). That equation may take a but to figure out. What I would likely do is, say for example the radar degrees go from -50 to +50. I dont like to think in negatives so I'll add 50 to make the new range 0 to +100. That makes it much easier because with a knob that is 0 to 1 the equation will be `knobPosition x 100 = radarAngle`. doing that for a half-way knob will give us 50 degrees. But wait, remember that 50 we added before? We need to take it back. So now our equation becomes `(knobPosition x 100) - 50 = radarAngle`. Which in the above scenario gives us 0 degrees. Done.

I'll work with that.

Link to comment
Share on other sites

@bailey how about this for the A-4 Radar? For some reason the 0 value was giving me -0 which doesn't make a lick of sense hence that extra if/then to make it a regular 0. 🤔

function ExportScript.radar_mode_and_tilt(mainPanelDevice)
	--[120] = "%0.4f",	--AN/APG-53A Radar Mode Switch	{0.1,0,0.4}
	--[122] = "%0.4f",	--Radar Antenna Tilt Switch	{0.4,0,1}
		local radar_mode
		if mainPanelDevice:get_argument_value(120) > 0 and mainPanelDevice:get_argument_value(120) < 0.2 then --0.1
			radar_mode = "STBY"
			elseif mainPanelDevice:get_argument_value(120) > 0.1 and mainPanelDevice:get_argument_value(120) < 0.3 then --0.2
			radar_mode = "SRCH"
			elseif mainPanelDevice:get_argument_value(120) > 0.2 and mainPanelDevice:get_argument_value(120) < 0.4 then --0.3
			radar_mode = "TC"
			elseif mainPanelDevice:get_argument_value(120) > 0.3 then
			radar_mode = "A/G"
			else radar_mode = "OFF"
		end
		
		local radar_tilt 
		
		if ExportScript.Tools.round(mainPanelDevice:get_argument_value(122), 2)  < 0.36 or  ExportScript.Tools.round(mainPanelDevice:get_argument_value(122), 2) >  		0.44 then
			radar_tilt = ((ExportScript.Tools.round(mainPanelDevice:get_argument_value(122), 2)  * 25 ) - 10) * -1 
			else radar_tilt = 0
		end
		if radar_tilt == -0 then
			radar_tilt = 0
		end

 


Edited by bones1014
Link to comment
Share on other sites

20 hours ago, Bailey said:

Nope. Go for it. Let me know if it turns out well.

Thank you @Bailey! So I've made good progress getting to grips with the SpitfireLFMkIX LUA code (made a lot of mistakes haha) but I have created a new tile that returns oil pressure, temp, and rad temp and also highlights if they are low or high (I'd be pleased to share this if interested).

I need a pointer though on the SpitfireLFMkIXCW LUA please. The DCS Comms function doesn't seem to be able to 'see' the CW variant. So I see the error 'DCS module not detected.' and obvioucly no IDs are therefore visible. The module name in the LUA looks ok. Is this to be expected? From looking at the DCS folder structure in \DCS World\CoreMods\WWII Units\SpitfireLFMkIX there isn't even a separate folder for the CW variant, so I wonder if DCS even thinks of this as a separate module. Have you ever seen DCS Comms connect to the CW variant? Thanks!


Edited by bell_rj

PC specs:

 

 

Link to comment
Share on other sites

On 2/4/2022 at 8:53 AM, bones1014 said:

@bailey how about this for the A-4 Radar? For some reason the 0 value was giving me -0 which doesn't make a lick of sense hence that extra if/then to make it a regular 0. 🤔

function ExportScript.radar_mode_and_tilt(mainPanelDevice)
	--[120] = "%0.4f",	--AN/APG-53A Radar Mode Switch	{0.1,0,0.4}
	--[122] = "%0.4f",	--Radar Antenna Tilt Switch	{0.4,0,1}
		local radar_mode
		if mainPanelDevice:get_argument_value(120) > 0 and mainPanelDevice:get_argument_value(120) < 0.2 then --0.1
			radar_mode = "STBY"
			elseif mainPanelDevice:get_argument_value(120) > 0.1 and mainPanelDevice:get_argument_value(120) < 0.3 then --0.2
			radar_mode = "SRCH"
			elseif mainPanelDevice:get_argument_value(120) > 0.2 and mainPanelDevice:get_argument_value(120) < 0.4 then --0.3
			radar_mode = "TC"
			elseif mainPanelDevice:get_argument_value(120) > 0.3 then
			radar_mode = "A/G"
			else radar_mode = "OFF"
		end
		
		local radar_tilt 
		
		if ExportScript.Tools.round(mainPanelDevice:get_argument_value(122), 2)  < 0.36 or  ExportScript.Tools.round(mainPanelDevice:get_argument_value(122), 2) >  		0.44 then
			radar_tilt = ((ExportScript.Tools.round(mainPanelDevice:get_argument_value(122), 2)  * 25 ) - 10) * -1 
			else radar_tilt = 0
		end
		if radar_tilt == -0 then
			radar_tilt = 0
		end

 

 

That look fine to me. Does it look good ingame?

19 hours ago, bell_rj said:

Thank you @Bailey! So I've made good progress getting to grips with the SpitfireLFMkIX LUA code (made a lot of mistakes haha) but I have created a new tile that returns oil pressure, temp, and rad temp and also highlights if they are low or high (I'd be pleased to share this if interested).

I need a pointer though on the SpitfireLFMkIXCW LUA please. The DCS Comms function doesn't seem to be able to 'see' the CW variant. So I see the error 'DCS module not detected.' and obvioucly no IDs are therefore visible. The module name in the LUA looks ok. Is this to be expected? From looking at the DCS folder structure in \DCS World\CoreMods\WWII Units\SpitfireLFMkIX there isn't even a separate folder for the CW variant, so I wonder if DCS even thinks of this as a separate module. Have you ever seen DCS Comms connect to the CW variant? Thanks!

 

I am getting both normal and CW DCS Comms and outputs. You can attach your CW lua and I can compare.

Link to comment
Share on other sites

4 hours ago, Bailey said:

I am getting both normal and CW DCS Comms and outputs. You can attach your CW lua and I can compare.

So, good news. I re-saved the original LUA from Github and now it works. That's not the first time I've tried that so I don't know what's going on. I did see some odd behaviour with the non-CW Spit where I had to save the LUA twice before it would work. No idea why. I suspected file corruption but didn't see any differences when doing a compare in Notepad++.

Another quick question if I may, is there a way to force DCS to re-read the LUA file without restarting the game?

If you plan on doing any further development to DCS interface then I have a suggestion. I am trying to make a tile that shows low, normal and high oil pressure. I have used text for now, but it would be great to have a version of Momentary Button with Lamp that allows 3 image states, so I could use both > and < conditions in the same DCS Interface element.

One bug (I think) I noticed with Momentary Button/Display (UFC) is that though it allows setting a condition to show a second state image, it doesn't seem to allow setting what that image is, unlike Momentary Button with Lamp.

And finally, thanks for all this. I'm really enjoying using Stream Deck with all these elements that you have created. It's brought an extra level of enjoyment to DCS world. I'm even enjoying the coding and tracking down issues when I mess it up.


Edited by bell_rj

PC specs:

 

 

Link to comment
Share on other sites

A10 Digital Clock

I've managed to 'stack' the A10 digital clock on a Streamdeck tile (i.e. hours and minutes above seconds), but I'm struggling to add the colon between the hours and minutes.  It's probably an easy fix but so far it has eluded me.

Line of code is below, any advice would be welcome.

ExportScript.Tools.SendData(2010, string.format("%s%s%s%s", lDigitalClock.txtHours, lDigitalClock.txtMinutes, "\n" .. lDigitalClock.txtSeconds, "\n" .. lCET))

Link to comment
Share on other sites

2 minutes ago, Tess said:

A10 Digital Clock

I've managed to 'stack' the A10 digital clock on a Streamdeck tile (i.e. hours and minutes above seconds), but I'm struggling to add the colon between the hours and minutes.  It's probably an easy fix but so far it has eluded me.

Line of code is below, any advice would be welcome.

ExportScript.Tools.SendData(2010, string.format("%s%s%s%s", lDigitalClock.txtHours, lDigitalClock.txtMinutes, "\n" .. lDigitalClock.txtSeconds, "\n" .. lCET))

 

My LUA experience totals about 3 days so this may not work but my guesses are:

ExportScript.Tools.SendData(2010, string.format("%s%s%s%s", lDigitalClock.txtHours .. ":", lDigitalClock.txtMinutes, "\n" .. lDigitalClock.txtSeconds, "\n" .. lCET))

OR, what about adding another %s to get:

ExportScript.Tools.SendData(2010, string.format("%s%s%s%s%s", lDigitalClock.txtHours, ":", lDigitalClock.txtMinutes, "\n" .. lDigitalClock.txtSeconds, "\n" .. lCET))

(I'm assuming adding another %s argument is valid).

PC specs:

 

 

Link to comment
Share on other sites

9 hours ago, bell_rj said:

 

Another quick question if I may, is there a way to force DCS to re-read the LUA file without restarting the game?

 

Restart the mission using LShift+R.
 

 

6 hours ago, Tess said:

A10 Digital Clock

I've managed to 'stack' the A10 digital clock on a Streamdeck tile (i.e. hours and minutes above seconds), but I'm struggling to add the colon between the hours and minutes.  It's probably an easy fix but so far it has eluded me.

Line of code is below, any advice would be welcome.

ExportScript.Tools.SendData(2010, string.format("%s%s%s%s", lDigitalClock.txtHours, lDigitalClock.txtMinutes, "\n" .. lDigitalClock.txtSeconds, "\n" .. lCET))

I think DCS-ExportScripts uses ":" as some kind of important thing. I haven't found a way to use it in a display.

  • Thanks 1
Link to comment
Share on other sites

6 hours ago, bell_rj said:

 

My LUA experience totals about 3 days so this may not work but my guesses are:

ExportScript.Tools.SendData(2010, string.format("%s%s%s%s", lDigitalClock.txtHours .. ":", lDigitalClock.txtMinutes, "\n" .. lDigitalClock.txtSeconds, "\n" .. lCET))

OR, what about adding another %s to get:

ExportScript.Tools.SendData(2010, string.format("%s%s%s%s%s", lDigitalClock.txtHours, ":", lDigitalClock.txtMinutes, "\n" .. lDigitalClock.txtSeconds, "\n" .. lCET))

(I'm assuming adding another %s argument is valid).

 

52 minutes ago, Bailey said:

Restart the mission using LShift+R.
 

 

I think DCS-ExportScripts uses ":" as some kind of important thing. I haven't found a way to use it in a display.

Thanks for the replies.  Tried the first 2 methods with no luck so it looks like Bailey is right about it being a limitation of Lua.

Looking on the bright side "LShift + R" is going to save me a load of time!

Link to comment
Share on other sites

2 hours ago, Tess said:

 

Thanks for the replies.  Tried the first 2 methods with no luck so it looks like Bailey is right about it being a limitation of Lua.

Looking on the bright side "LShift + R" is going to save me a load of time!

So I might be barking up the wrong tree but how about using ASCII char &#58; (decimal 58)  and string.char? https://www.tutorialspoint.com/string-char-function-in-lua-programming

Thanks @Bailey for the restart tip!  
  • Like 1

PC specs:

 

 

Link to comment
Share on other sites

20 hours ago, Tess said:

The :(colon) operator in Lua is used when you want to pass an invisible parameter to the method of an object that you are calling.

Where did you find that? I guess I need to polish up on my GoogleFu.

Link to comment
Share on other sites

maddog726

I have put "dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\ExportScript.lua]])"  at the begining and at the end of the export file and cannot seem to get it to work with Helios.  How did you do it?

Here is the export.log

ExportScript Version: 1.2.1
17:52:15:28 : Create UDPSender
17:52:15:28 : Create UDPListner
17:52:15:282 : File Path: C:\Users\13057\Saved Games\DCS.openbeta\Scripts\DCS-ExportScript\ExportsModules\A-10C_2.lua
17:52:15:291 : File 'C:\Users\13057\Saved Games\DCS.openbeta\Scripts\DCS-ExportScript\ExportsModules\A-10C_2.lua' loaded
17:52:15:291 : Version:
17:52:15:291 : Config: 1.2.1
17:52:15:291 : Maps: 1.2.1
17:52:15:291 : Tools: 1.2.1
17:52:15:291 : genericRadio: 1.2.1
17:52:15:291 : A10C: 1.2.1
17:52:15:291 : ExportScript: 1.2.1
17:52:15:291 : Detected Map: CaucasusBase
17:52:32:419 : reset dcs ikarus
17:53:15:954 : ====== Logfile close ======


Edited by sobe
added the export log

Trackir4 using the latest Trackir 5 software, Win10 Pro [Creator Update] updated from Win7Pro Pro 64Bit, Intel® Core™ i5-2500 3.30 GHz 6M Intel Smart Cache LGA115 , GigaByte GA-Z68XP-UD4 Intel Z68 Chipset DDR3 16GB Ram, GTX MSI Gaming 1060 [6 GB] Video Card, Main Monitor 1 on left 1920x1080 Touchscreen Monitor 2 on right 1920x1080 .

Link to comment
Share on other sites

On 2/7/2022 at 3:28 AM, Tess said:

I don’t think this explains the problem. Colons inside strings aren’t showing up. But, that link was a great read. I know more about lua now!

Link to comment
Share on other sites

Hi All, sorry I haven't been as responsive on this thread lately, but I have pushed up a beta test version of DCS-BIOS compatibility. It still supports your existing DCS-ExportScript buttons if you'd like to try it out and share feedback I've started a new thread for that topic here: 

For now I plan to keep supporting DCS-ExportScript since there's a lot of functionality people have worked into the export scripts here, but I'd like to see if the DCS-BIOS functionality can mature to accomplish everything as a full replacement at some point. Right now it just has core functionality to do the basics.

  • Like 6
Link to comment
Share on other sites

My head hurts.  Not because of an accident.  But because I banged it against the wall several times this morning.  Why?  Simple.  I woke up this morning and checked my virus scanner and of course, the interface exe was blacklisted.  No wonder it would not work.  I wonder if I will ever learn to check that first when a program does not work as it should.

Anyhow, the ID lookup and DCS Comms buttons on the Interface buttons on the Streamdeck all produce the charts that are shown in the video so I assume any plugin based on the interface should work.  I will test that shortly as I am still learning how to use the streamdeck. 

For future reference, here is my combined Helios and Interface export.lua file.  The helios part works and I will be checking the interface part in the next day or two.  Some uses suggest that the interface export script should go on top, but when I did that, Helios had some issues.  So the order is still a work in progress.

=================

--load the HELIOS export script

dofile(lfs.writedir()..[[Scripts\Helios\HeliosExport16.lua]])

 

local vaicomlfs = require('lfs'); dofile(vaicomlfs.writedir()..[[Scripts\VAICOMPRO\VAICOMPRO.export.lua]])

 

--local DCSDTClfs=require('lfs'); dofile(DCSDTClfs.writedir()..'Scripts/DCSDTC.lua')

 

local Tacviewlfs=require('lfs');dofile(Tacviewlfs.writedir()..'Scripts/TacviewGameExport.lua')

 

--pcall(function() local dcsSr=require('lfs');dofile(dcsSr.writedir()..[[Mods\Services\DCS-SRS\Scripts\DCS-SimpleRadioStandalone.lua]]); end,nil);

 

-- load the DCS ExportScript for DAC and Ikarus

dofile(lfs.writedir()..[[Scripts\DCS-ExportScript\ExportScript.lua]])

Just a word about the future of Helios.  As Helios has lost one of its key developers and as CZ appears to be very business with his real-life job and as DCS keeps tinkering with the DCS code (causing issues with Helios), I am afraid that the future of complex profiles such as the ones that CZ is famous for-may be at an end.  Therefore, the importance of Streamdeck/DCS interface plugins will only increase in importance and popularity.  Just my opinion. 

Trackir4 using the latest Trackir 5 software, Win10 Pro [Creator Update] updated from Win7Pro Pro 64Bit, Intel® Core™ i5-2500 3.30 GHz 6M Intel Smart Cache LGA115 , GigaByte GA-Z68XP-UD4 Intel Z68 Chipset DDR3 16GB Ram, GTX MSI Gaming 1060 [6 GB] Video Card, Main Monitor 1 on left 1920x1080 Touchscreen Monitor 2 on right 1920x1080 .

Link to comment
Share on other sites

Hi All,

I have a Stream Deck XL, and fully familiar and obviously configured a full F/A-18C profile using direct interface, as appose to keyboard shortcuts

F/A-18C profile here - https://www.digitalcombatsimulator.com/en/files/3319825/

I have downloaded the new button etc, and it appears in the DCS Interface tab. When I drag and then click the configure..>.. setup then point it to the location of my install, as per the instructions, nothing comes up as per the guide.

In addition, the path to my saved games contains spaces etc, I have tried putting it in quotes around the path

"E:\..just for privacy.................\Personal-Systems\System-Profiles\TC-I7-ASUS\Saved Games\DCS\Scripts\DCS-BIOS"

I assume that you have to have DCS running, and in flight with a suitable aircraft, but still nothing comes up. Everything in my Saved Games is excluded in my Anti-Virus setup

Just nothing appears in terms of the listings as per how the manual/guide looks

Please help me, if you can

Toni

ps. I can access the web console fine as you can see

image.png


Edited by Toni Carrera

Toni Carrera (Ice Rhino)

 

ThrustMaster HOTAS Warthog Throttle & A10C Stick, ThrustMaster F/A-18C Stick, ThrustMaster TFRP Pedals, ThrustMaster Cougars x 2, fitted to CubeSim USB Screens, TrackIR 4 Active LED & Cap Reflector, Stream Deck XL

Intel® Core™ i7-5820K 12 Core Processor, 32GB RAM, 1 x 500GB SSD, 2 x 256GB SSD, 1 x 1TB SSD 4 x 4TB Western Digital Mechanical. 2 x ASUS GTX 1080's SLI, ASUS 29" Ultrawide flanked by 2 x 22" IPS Monitors

Link to comment
Share on other sites

1 hour ago, Toni Carrera said:

Hi All,

I have a Stream Deck XL, and fully familiar and obviously configured a full F/A-18C profile using direct interface, as appose to keyboard shortcuts

F/A-18C profile here - https://www.digitalcombatsimulator.com/en/files/3319825/

I have downloaded the new button etc, and it appears in the DCS Interface tab. When I drag and then click the configure..>.. setup then point it to the location of my install, as per the instructions, nothing comes up as per the guide.

In addition, the path to my saved games contains spaces etc, I have tried putting it in quotes around the path

"E:\..just for privacy.................\Personal-Systems\System-Profiles\TC-I7-ASUS\Saved Games\DCS\Scripts\DCS-BIOS"

I assume that you have to have DCS running, and in flight with a suitable aircraft, but still nothing comes up. Everything in my Saved Games is excluded in my Anti-Virus setup

Just nothing appears in terms of the listings as per how the manual/guide looks

Please help me, if you can

Toni

ps. I can access the web console fine as you can see

image.png

 

You might want to post on the new dcs-interface thread for the dcs bios implementation. The link is about 2 posts above your post. 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...