Jump to content

New StreamDeck Plugin


Recommended Posts

23 hours ago, Mordants said:

Super effort, you're so good at this. Thanks very much!  Could I be cheeky and ask you to look at digitising the compass? I think that would be super cool especially for these old eyes lol.

 

Done. I'll post the raw code here. It has a lot of stuff that you wont see or need in the lua file. Give it a look if you are curious. It is unfortunate that the forum messes up the code spacing.
 

Spoiler
function ExportScript.CompassReadouts(mainPanelDevice)

--[[

	[25] = "%.4f",		-- UGR_4K_heading_L {0.0, 1.0}
	[27] = "%.4f",		-- UGR_4K_commanded_course_L {0.0, 1.0}
	[28] = "%.4f",		-- UGR_4K_bearing_needle_L {0.0, 1.0}
	----
	[101] = "%.4f",		-- UGR_4K_heading_R {0.0, 1.0}
	[103] = "%.4f",		-- UGR_4K_commanded_course_R {0.0, 1.0}
	[104] = "%.4f",		-- UGR_4K_bearing_needle_R {0.0, 1.0}
	
]]

	--ExportScript.Tools.SendData(3000, "Hi")
	local pilotCompassHeadingValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(25),2)
	local pilotCompassCommandedCourseValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(27),2)
	local pilotCompassBearingNeedleValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(28),2)
	
--[[
	we know for the HeadingValue, 	0.0 = 000
									0.5 = 180
									1.0 = 000
	
	For both the commanded course and the bearing needle are similar, 
	but they are based on the orentation of the Heading value.
	
	This means that if we subtract their values from the Heading value,
	the absolute value should represent the fraction of the compass that
	is shown. Hopefully...
	
	Examples:
	
	if pilotCompassHeadingValue = 0.0, the top is indicating 000
	pilotCompassCommandedCourseValue at 0.0 will show 000
	pilotCompassBearingNeedleValue at 0.0 will show 000
	
	We realize that we only need to solve for CommandedCourse bc the
	bearingNeedle will be the same code.
	
	if pilotCompassHeadingValue = 0.25, the top is indicating 090
	if pilotCompassCommandedCourseValue at 0.0 will point to 090
	if pilotCompassCommandedCourseValue at 0.25 will point to 180
	
	Now let's make up some math that works. Science!
	
	We know that 180 should "be" 0.50. That turns out to be the vaules combined...
	Let's see if that works in a different example.
	
	if pilotCompassHeadingValue = 0.75, the top is indicating 270
	if pilotCompassCommandedCourseValue at 0.0 will point to 270
	if pilotCompassCommandedCourseValue at 0.50 will point to 090
	
	Does it work? Well, 0.75 plus 0.50 = 1.25, which reduced by 1 = 0.25, which 
	represents a compass value of 090. Yes! The logic works!
	All of the above was assumed and varified via ModelViewer.
	
	Now lets write that in code.
	
]]

	-- Let's print out some easy, basic, raw values to monitor our base assumptions
	-- This step is import so that we don't go in a random direction with our code.
	-- Dont use the ':' symbol. Export Scripts does not like that.
	ExportScript.Tools.SendData(3000, "HDG\n" 
										.. "Raw " .. pilotCompassHeadingValue .. "\n" 
										.. "DEG " .. pilotCompassHeadingValue*360)
	ExportScript.Tools.SendData(3001, "Needle 2\n" 
										.. "Raw " .. pilotCompassCommandedCourseValue .. "\n" 
										.. "Abs " .. pilotCompassCommandedCourseValue*360)
	ExportScript.Tools.SendData(3002, "Needle 1\n" 
										.. "Raw " .. pilotCompassBearingNeedleValue .. "\n" 
										.. "Abs " .. pilotCompassBearingNeedleValue*360)
	
	-- Now we code the code we think is going to work using out thought process from above.
	
	local additiveCommandedValue = pilotCompassHeadingValue + pilotCompassCommandedCourseValue
	local pilotCompassCommandedNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if additiveCommandedValue > 1 then
		pilotCompassCommandedNeedleValue_adjusted = additiveCommandedValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassCommandedNeedleValue_adjusted = additiveCommandedValue
	end
	

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassCommandedNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassCommandedNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassCommandedNeedleValue_adjusted == 2 then
		pilotCompassCommandedNeedleValue_adjusted = "0" .. pilotCompassCommandedNeedleValue_adjusted
	elseif #pilotCompassCommandedNeedleValue_adjusted == 1 then
		pilotCompassCommandedNeedleValue_adjusted = "00" .. pilotCompassCommandedNeedleValue_adjusted
	end
	
	
	ExportScript.Tools.SendData(3003, "Needle 2\n" 
										.. "Deg " .. pilotCompassCommandedNeedleValue_adjusted)
										
										
	ExportScript.Tools.SendData(3004, "Additive\n" .. additiveCommandedValue .. "=\n" 
											.. pilotCompassHeadingValue .. "+\n" 
											.. pilotCompassCommandedCourseValue)								
	
	-- Yay, it works! Now we need to format into solid degrees and round the result
	-- After that we will clean the code up a bit and then replicate for the other needle.
	
	local additiveBearingValue = pilotCompassHeadingValue + pilotCompassBearingNeedleValue
	local pilotCompassBearingNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if additiveBearingValue > 1 then
		pilotCompassBearingNeedleValue_adjusted = additiveBearingValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassBearingNeedleValue_adjusted = additiveBearingValue
	end
	

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassBearingNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassBearingNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassBearingNeedleValue_adjusted == 2 then
		pilotCompassBearingNeedleValue_adjusted = "0" .. pilotCompassBearingNeedleValue_adjusted
	elseif #pilotCompassBearingNeedleValue_adjusted == 1 then
		pilotCompassBearingNeedleValue_adjusted = "00" .. pilotCompassBearingNeedleValue_adjusted
	end
	
	ExportScript.Tools.SendData(3005, "Needle 1\n" 
										.. "Deg " .. pilotCompassBearingNeedleValue_adjusted)
										
	-- Now that we have all of that information, it's time to put in onto one tile.
	
	--turn the number into a string 
	pilotCompassHeadingValue = string.format("%.1d" , round(pilotCompassHeadingValue*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassHeadingValue == 2 then
		pilotCompassHeadingValue = "0" .. pilotCompassHeadingValue
	elseif #pilotCompassHeadingValue == 1 then
		pilotCompassHeadingValue = "00" .. pilotCompassHeadingValue
	end
	
	--last minute string adjustment for this aircraft's compass
	if pilotCompassHeadingValue == "360" then pilotCompassHeadingValue = "000" end
	if pilotCompassCommandedNeedleValue_adjusted == "360" then pilotCompassCommandedNeedleValue_adjusted = "000" end
	if pilotCompassBearingNeedleValue_adjusted == "360" then pilotCompassBearingNeedleValue_adjusted = "000" end
	
	ExportScript.Tools.SendData(3006, "HDG " .. pilotCompassHeadingValue
											.. "\nN1 " .. pilotCompassCommandedNeedleValue_adjusted
											.. "\nN2 " .. pilotCompassBearingNeedleValue_adjusted)

end

 


The actual code is this:
 

Spoiler
function ExportScript.CompassReadouts(mainPanelDevice)

--[[

	[25] = "%.4f",		-- UGR_4K_heading_L {0.0, 1.0}
	[27] = "%.4f",		-- UGR_4K_commanded_course_L {0.0, 1.0}
	[28] = "%.4f",		-- UGR_4K_bearing_needle_L {0.0, 1.0}
	----
	[101] = "%.4f",		-- UGR_4K_heading_R {0.0, 1.0}
	[103] = "%.4f",		-- UGR_4K_commanded_course_R {0.0, 1.0}
	[104] = "%.4f",		-- UGR_4K_bearing_needle_R {0.0, 1.0}
	
]]

	--ExportScript.Tools.SendData(3000, "Hi") --test
	local pilotCompassHeadingValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(25),8)--rounds to the 8th digit after the decimal
	local pilotCompassCommandedCourseValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(27),8)--makes it more accurate compared to 2
	local pilotCompassBearingNeedleValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(28),8)
	
--[[
	we know for the HeadingValue, 	0.0 = 000
									0.5 = 180
									1.0 = 000
	
	For both the commanded course and the bearing needle are similar, 
	but they are based on the orentation of the Heading value.
	
	This means that if we subtract their values from the Heading value,
	the absolute value should represent the fraction of the compass that
	is shown. Hopefully...
	
	Examples:
	
	if pilotCompassHeadingValue = 0.0, the top is indicating 000
	pilotCompassCommandedCourseValue at 0.0 will show 000
	pilotCompassBearingNeedleValue at 0.0 will show 000
	
	We realize that we only need to solve for CommandedCourse bc the
	bearingNeedle will be the same code.
	
	if pilotCompassHeadingValue = 0.25, the top is indicating 090
	if pilotCompassCommandedCourseValue at 0.0 will point to 090
	if pilotCompassCommandedCourseValue at 0.25 will point to 180
	
	Now let's make up some math that works. Science!
	
	We know that 180 should "be" 0.50. That turns out to be the vaules combined...
	Let's see if that works in a different example.
	
	if pilotCompassHeadingValue = 0.75, the top is indicating 270
	if pilotCompassCommandedCourseValue at 0.0 will point to 270
	if pilotCompassCommandedCourseValue at 0.50 will point to 090
	
	Does it work? Well, 0.75 plus 0.50 = 1.25, which reduced by 1 = 0.25, which 
	represents a compass value of 090. Yes! The logic works!
	All of the above was assumed and varified via ModelViewer.
	
	Now lets write that in code.
	
]]

	-- Let's print out some easy, basic, raw values to monitor our base assumptions
	-- This step is import so that we don't go in a random direction with our code.
	-- Dont use the ':' symbol. Export Scripts does not like that.
--[[
	ExportScript.Tools.SendData(3000, "HDG\n" 
										.. "Raw " .. pilotCompassHeadingValue .. "\n" 
										.. "DEG " .. pilotCompassHeadingValue*360)
	ExportScript.Tools.SendData(3001, "Needle 2\n" 
										.. "Raw " .. pilotCompassCommandedCourseValue .. "\n" 
										.. "Abs " .. pilotCompassCommandedCourseValue*360)
	ExportScript.Tools.SendData(3002, "Needle 1\n" 
										.. "Raw " .. pilotCompassBearingNeedleValue .. "\n" 
										.. "Abs " .. pilotCompassBearingNeedleValue*360)
]]
	
	-- Now we code the code we think is going to work using out thought process from above.
	
	local pilotadditiveCommandedValue = pilotCompassHeadingValue + pilotCompassCommandedCourseValue
	local pilotCompassCommandedNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if pilotadditiveCommandedValue > 1 then
		pilotCompassCommandedNeedleValue_adjusted = pilotadditiveCommandedValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassCommandedNeedleValue_adjusted = pilotadditiveCommandedValue
	end

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassCommandedNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassCommandedNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassCommandedNeedleValue_adjusted == 2 then
		pilotCompassCommandedNeedleValue_adjusted = "0" .. pilotCompassCommandedNeedleValue_adjusted
	elseif #pilotCompassCommandedNeedleValue_adjusted == 1 then
		pilotCompassCommandedNeedleValue_adjusted = "00" .. pilotCompassCommandedNeedleValue_adjusted
	end
	
--[[
	ExportScript.Tools.SendData(3003, "Needle 2\n" 
										.. "Deg " .. pilotCompassCommandedNeedleValue_adjusted)
										
										
	ExportScript.Tools.SendData(3004, "Additive\n" .. pilotadditiveCommandedValue .. "=\n" 
											.. pilotCompassHeadingValue .. "+\n" 
											.. pilotCompassCommandedCourseValue)								
]]

	-- Yay, it works! Now we need to format into solid degrees and round the result
	-- After that we will clean the code up a bit and then replicate for the other needle.
	
	local pilotadditiveBearingValue = pilotCompassHeadingValue + pilotCompassBearingNeedleValue
	local pilotCompassBearingNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if pilotadditiveBearingValue > 1 then
		pilotCompassBearingNeedleValue_adjusted = pilotadditiveBearingValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassBearingNeedleValue_adjusted = pilotadditiveBearingValue
	end
	

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassBearingNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassBearingNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassBearingNeedleValue_adjusted == 2 then
		pilotCompassBearingNeedleValue_adjusted = "0" .. pilotCompassBearingNeedleValue_adjusted
	elseif #pilotCompassBearingNeedleValue_adjusted == 1 then
		pilotCompassBearingNeedleValue_adjusted = "00" .. pilotCompassBearingNeedleValue_adjusted
	end

--[[
	ExportScript.Tools.SendData(3005, "Needle 1\n" 
										.. "Deg " .. pilotCompassBearingNeedleValue_adjusted)
]]									
	-- Now that we have all of that information, it's time to put in onto one tile.
	
	--turn the number into a string 
	pilotCompassHeadingValue = string.format("%.1d" , round(pilotCompassHeadingValue*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassHeadingValue == 2 then
		pilotCompassHeadingValue = "0" .. pilotCompassHeadingValue
	elseif #pilotCompassHeadingValue == 1 then
		pilotCompassHeadingValue = "00" .. pilotCompassHeadingValue
	end
	
	--last minute string adjustment for this aircraft's compass
	if pilotCompassHeadingValue == "360" then pilotCompassHeadingValue = "000" end
	if pilotCompassCommandedNeedleValue_adjusted == "360" then pilotCompassCommandedNeedleValue_adjusted = "000" end
	if pilotCompassBearingNeedleValue_adjusted == "360" then pilotCompassBearingNeedleValue_adjusted = "000" end
	
	ExportScript.Tools.SendData(3000, 		"PLT\n"
											.. "HDG " .. pilotCompassHeadingValue
											.. "\nN1 " .. pilotCompassCommandedNeedleValue_adjusted
											.. "\nN2 " .. pilotCompassBearingNeedleValue_adjusted)
											
											
--=====Copilot Side=====--

	local copilotCompassHeadingValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(101),2)
	local copilotCompassCommandedCourseValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(103),2)
	local copilotCompassBearingNeedleValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(104),2)


	local copilotadditiveCommandedValue = copilotCompassHeadingValue + copilotCompassCommandedCourseValue
	local copilotCompassCommandedNeedleValue_adjusted

	if copilotadditiveCommandedValue > 1 then
		copilotCompassCommandedNeedleValue_adjusted = copilotadditiveCommandedValue - 1
	else 
		copilotCompassCommandedNeedleValue_adjusted = copilotadditiveCommandedValue
	end
	
	local copilotCompassCommandedNeedleValue_adjustedInt = round(copilotCompassCommandedNeedleValue_adjusted*360,0) --used for later
	copilotCompassCommandedNeedleValue_adjusted = string.format("%.1d" , round(copilotCompassCommandedNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #copilotCompassCommandedNeedleValue_adjusted == 2 then
		copilotCompassCommandedNeedleValue_adjusted = "0" .. copilotCompassCommandedNeedleValue_adjusted
	elseif #copilotCompassCommandedNeedleValue_adjusted == 1 then
		copilotCompassCommandedNeedleValue_adjusted = "00" .. copilotCompassCommandedNeedleValue_adjusted
	end					
	

	local copilotadditiveBearingValue = copilotCompassHeadingValue + copilotCompassBearingNeedleValue
	local copilotCompassBearingNeedleValue_adjusted
	
	if copilotadditiveBearingValue > 1 then
		copilotCompassBearingNeedleValue_adjusted = copilotadditiveBearingValue - 1
	else 
		copilotCompassBearingNeedleValue_adjusted = copilotadditiveBearingValue
	end

	copilotCompassBearingNeedleValue_adjustedInt = round(copilotCompassBearingNeedleValue_adjusted*360,0)--used for later
	--turn the number into a string 
	copilotCompassBearingNeedleValue_adjusted = string.format("%.1d" , round(copilotCompassBearingNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #copilotCompassBearingNeedleValue_adjusted == 2 then
		copilotCompassBearingNeedleValue_adjusted = "0" .. copilotCompassBearingNeedleValue_adjusted
	elseif #copilotCompassBearingNeedleValue_adjusted == 1 then
		copilotCompassBearingNeedleValue_adjusted = "00" .. copilotCompassBearingNeedleValue_adjusted
	end
									
	-- Now that we have all of that information, it's time to put in onto one tile.
	
	
	--turn the number into a string 
	copilotCompassHeadingValue = string.format("%.1d" , round(copilotCompassHeadingValue*360,0))
	
	--if the values string length is 2 then
	if #copilotCompassHeadingValue == 2 then
		copilotCompassHeadingValue = "0" .. copilotCompassHeadingValue
	elseif #copilotCompassHeadingValue == 1 then
		copilotCompassHeadingValue = "00" .. copilotCompassHeadingValue
	end
	
	--last minute string adjustment for this aircraft's compass
	if copilotCompassHeadingValue == "360" then copilotCompassHeadingValue = "000" end
	if copilotCompassCommandedNeedleValue_adjusted == "360" then copilotCompassCommandedNeedleValue_adjusted = "000" end
	if copilotCompassBearingNeedleValue_adjusted == "360" then copilotCompassBearingNeedleValue_adjusted = "000" end
	
	ExportScript.Tools.SendData(3001, 		"CPLT\n"
											.. "HDG " .. copilotCompassHeadingValue
											.. "\nN1 " .. copilotCompassCommandedNeedleValue_adjusted
											.. "\nN2 " .. copilotCompassBearingNeedleValue_adjusted)
											
	
	-- something a little extra. an "on course" or "on bearing" detector that changes colors
	-- if the commanded course is within 5 degrees of the way you are going, then you are on course
	-- if the ndb bearing line is within 5 degrees of the way you are going, then you are on bearing
	-- You can code this some other day.
end

 


2022-01-16_21_39_31-Stream_Deck.jpg


And there you go! Extra credit if you can code that last 4 lines about the "on course" and "on bearing" detectors. 😉
I have updated the Library wiki and hip lua. 
https://github.com/asherao/DCS-ExportScripts
https://github.com/asherao/DCS-ExportScripts/wiki/Mi-8MT-Hip
https://github.com/asherao/DCS-ExportScripts/blob/master/Scripts/DCS-ExportScript/ExportsModules/Mi-8MT.lua

17 minutes ago, bones1014 said:

Isn't that UH-60 a mod? How did you get it working with the stream deck script? It would be nice to get one working for the A-4 mod.

 

Yep. All I am doing is looking at the augments via the modelViewer, adjusting each one, and hopefully seeing what it moves. The ID Lookup feature works too, to my surprise as I am writing this...


Edited by Bailey
  • Thanks 1
Link to comment
Share on other sites

4 minutes ago, Bailey said:

Done. I'll post the raw code here. It has a lot of stuff that you wont see or need in the lua file. Give it a look if you are curious. It is unfortunate that the forum messes up the code spacing.
 

  Reveal hidden contents
function ExportScript.CompassReadouts(mainPanelDevice)

--[[

	[25] = "%.4f",		-- UGR_4K_heading_L {0.0, 1.0}
	[27] = "%.4f",		-- UGR_4K_commanded_course_L {0.0, 1.0}
	[28] = "%.4f",		-- UGR_4K_bearing_needle_L {0.0, 1.0}
	----
	[101] = "%.4f",		-- UGR_4K_heading_R {0.0, 1.0}
	[103] = "%.4f",		-- UGR_4K_commanded_course_R {0.0, 1.0}
	[104] = "%.4f",		-- UGR_4K_bearing_needle_R {0.0, 1.0}
	
]]

	--ExportScript.Tools.SendData(3000, "Hi")
	local pilotCompassHeadingValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(25),2)
	local pilotCompassCommandedCourseValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(27),2)
	local pilotCompassBearingNeedleValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(28),2)
	
--[[
	we know for the HeadingValue, 	0.0 = 000
									0.5 = 180
									1.0 = 000
	
	For both the commanded course and the bearing needle are similar, 
	but they are based on the orentation of the Heading value.
	
	This means that if we subtract their values from the Heading value,
	the absolute value should represent the fraction of the compass that
	is shown. Hopefully...
	
	Examples:
	
	if pilotCompassHeadingValue = 0.0, the top is indicating 000
	pilotCompassCommandedCourseValue at 0.0 will show 000
	pilotCompassBearingNeedleValue at 0.0 will show 000
	
	We realize that we only need to solve for CommandedCourse bc the
	bearingNeedle will be the same code.
	
	if pilotCompassHeadingValue = 0.25, the top is indicating 090
	if pilotCompassCommandedCourseValue at 0.0 will point to 090
	if pilotCompassCommandedCourseValue at 0.25 will point to 180
	
	Now let's make up some math that works. Science!
	
	We know that 180 should "be" 0.50. That turns out to be the vaules combined...
	Let's see if that works in a different example.
	
	if pilotCompassHeadingValue = 0.75, the top is indicating 270
	if pilotCompassCommandedCourseValue at 0.0 will point to 270
	if pilotCompassCommandedCourseValue at 0.50 will point to 090
	
	Does it work? Well, 0.75 plus 0.50 = 1.25, which reduced by 1 = 0.25, which 
	represents a compass value of 090. Yes! The logic works!
	All of the above was assumed and varified via ModelViewer.
	
	Now lets write that in code.
	
]]

	-- Let's print out some easy, basic, raw values to monitor our base assumptions
	-- This step is import so that we don't go in a random direction with our code.
	-- Dont use the ':' symbol. Export Scripts does not like that.
	ExportScript.Tools.SendData(3000, "HDG\n" 
										.. "Raw " .. pilotCompassHeadingValue .. "\n" 
										.. "DEG " .. pilotCompassHeadingValue*360)
	ExportScript.Tools.SendData(3001, "Needle 2\n" 
										.. "Raw " .. pilotCompassCommandedCourseValue .. "\n" 
										.. "Abs " .. pilotCompassCommandedCourseValue*360)
	ExportScript.Tools.SendData(3002, "Needle 1\n" 
										.. "Raw " .. pilotCompassBearingNeedleValue .. "\n" 
										.. "Abs " .. pilotCompassBearingNeedleValue*360)
	
	-- Now we code the code we think is going to work using out thought process from above.
	
	local additiveCommandedValue = pilotCompassHeadingValue + pilotCompassCommandedCourseValue
	local pilotCompassCommandedNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if additiveCommandedValue > 1 then
		pilotCompassCommandedNeedleValue_adjusted = additiveCommandedValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassCommandedNeedleValue_adjusted = additiveCommandedValue
	end
	

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassCommandedNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassCommandedNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassCommandedNeedleValue_adjusted == 2 then
		pilotCompassCommandedNeedleValue_adjusted = "0" .. pilotCompassCommandedNeedleValue_adjusted
	elseif #pilotCompassCommandedNeedleValue_adjusted == 1 then
		pilotCompassCommandedNeedleValue_adjusted = "00" .. pilotCompassCommandedNeedleValue_adjusted
	end
	
	
	ExportScript.Tools.SendData(3003, "Needle 2\n" 
										.. "Deg " .. pilotCompassCommandedNeedleValue_adjusted)
										
										
	ExportScript.Tools.SendData(3004, "Additive\n" .. additiveCommandedValue .. "=\n" 
											.. pilotCompassHeadingValue .. "+\n" 
											.. pilotCompassCommandedCourseValue)								
	
	-- Yay, it works! Now we need to format into solid degrees and round the result
	-- After that we will clean the code up a bit and then replicate for the other needle.
	
	local additiveBearingValue = pilotCompassHeadingValue + pilotCompassBearingNeedleValue
	local pilotCompassBearingNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if additiveBearingValue > 1 then
		pilotCompassBearingNeedleValue_adjusted = additiveBearingValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassBearingNeedleValue_adjusted = additiveBearingValue
	end
	

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassBearingNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassBearingNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassBearingNeedleValue_adjusted == 2 then
		pilotCompassBearingNeedleValue_adjusted = "0" .. pilotCompassBearingNeedleValue_adjusted
	elseif #pilotCompassBearingNeedleValue_adjusted == 1 then
		pilotCompassBearingNeedleValue_adjusted = "00" .. pilotCompassBearingNeedleValue_adjusted
	end
	
	ExportScript.Tools.SendData(3005, "Needle 1\n" 
										.. "Deg " .. pilotCompassBearingNeedleValue_adjusted)
										
	-- Now that we have all of that information, it's time to put in onto one tile.
	
	--turn the number into a string 
	pilotCompassHeadingValue = string.format("%.1d" , round(pilotCompassHeadingValue*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassHeadingValue == 2 then
		pilotCompassHeadingValue = "0" .. pilotCompassHeadingValue
	elseif #pilotCompassHeadingValue == 1 then
		pilotCompassHeadingValue = "00" .. pilotCompassHeadingValue
	end
	
	--last minute string adjustment for this aircraft's compass
	if pilotCompassHeadingValue == "360" then pilotCompassHeadingValue = "000" end
	if pilotCompassCommandedNeedleValue_adjusted == "360" then pilotCompassCommandedNeedleValue_adjusted = "000" end
	if pilotCompassBearingNeedleValue_adjusted == "360" then pilotCompassBearingNeedleValue_adjusted = "000" end
	
	ExportScript.Tools.SendData(3006, "HDG " .. pilotCompassHeadingValue
											.. "\nN1 " .. pilotCompassCommandedNeedleValue_adjusted
											.. "\nN2 " .. pilotCompassBearingNeedleValue_adjusted)

end

 


The actual code is this:
 

  Reveal hidden contents
function ExportScript.CompassReadouts(mainPanelDevice)

--[[

	[25] = "%.4f",		-- UGR_4K_heading_L {0.0, 1.0}
	[27] = "%.4f",		-- UGR_4K_commanded_course_L {0.0, 1.0}
	[28] = "%.4f",		-- UGR_4K_bearing_needle_L {0.0, 1.0}
	----
	[101] = "%.4f",		-- UGR_4K_heading_R {0.0, 1.0}
	[103] = "%.4f",		-- UGR_4K_commanded_course_R {0.0, 1.0}
	[104] = "%.4f",		-- UGR_4K_bearing_needle_R {0.0, 1.0}
	
]]

	--ExportScript.Tools.SendData(3000, "Hi") --test
	local pilotCompassHeadingValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(25),8)--rounds to the 8th digit after the decimal
	local pilotCompassCommandedCourseValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(27),8)--makes it more accurate compared to 2
	local pilotCompassBearingNeedleValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(28),8)
	
--[[
	we know for the HeadingValue, 	0.0 = 000
									0.5 = 180
									1.0 = 000
	
	For both the commanded course and the bearing needle are similar, 
	but they are based on the orentation of the Heading value.
	
	This means that if we subtract their values from the Heading value,
	the absolute value should represent the fraction of the compass that
	is shown. Hopefully...
	
	Examples:
	
	if pilotCompassHeadingValue = 0.0, the top is indicating 000
	pilotCompassCommandedCourseValue at 0.0 will show 000
	pilotCompassBearingNeedleValue at 0.0 will show 000
	
	We realize that we only need to solve for CommandedCourse bc the
	bearingNeedle will be the same code.
	
	if pilotCompassHeadingValue = 0.25, the top is indicating 090
	if pilotCompassCommandedCourseValue at 0.0 will point to 090
	if pilotCompassCommandedCourseValue at 0.25 will point to 180
	
	Now let's make up some math that works. Science!
	
	We know that 180 should "be" 0.50. That turns out to be the vaules combined...
	Let's see if that works in a different example.
	
	if pilotCompassHeadingValue = 0.75, the top is indicating 270
	if pilotCompassCommandedCourseValue at 0.0 will point to 270
	if pilotCompassCommandedCourseValue at 0.50 will point to 090
	
	Does it work? Well, 0.75 plus 0.50 = 1.25, which reduced by 1 = 0.25, which 
	represents a compass value of 090. Yes! The logic works!
	All of the above was assumed and varified via ModelViewer.
	
	Now lets write that in code.
	
]]

	-- Let's print out some easy, basic, raw values to monitor our base assumptions
	-- This step is import so that we don't go in a random direction with our code.
	-- Dont use the ':' symbol. Export Scripts does not like that.
--[[
	ExportScript.Tools.SendData(3000, "HDG\n" 
										.. "Raw " .. pilotCompassHeadingValue .. "\n" 
										.. "DEG " .. pilotCompassHeadingValue*360)
	ExportScript.Tools.SendData(3001, "Needle 2\n" 
										.. "Raw " .. pilotCompassCommandedCourseValue .. "\n" 
										.. "Abs " .. pilotCompassCommandedCourseValue*360)
	ExportScript.Tools.SendData(3002, "Needle 1\n" 
										.. "Raw " .. pilotCompassBearingNeedleValue .. "\n" 
										.. "Abs " .. pilotCompassBearingNeedleValue*360)
]]
	
	-- Now we code the code we think is going to work using out thought process from above.
	
	local pilotadditiveCommandedValue = pilotCompassHeadingValue + pilotCompassCommandedCourseValue
	local pilotCompassCommandedNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if pilotadditiveCommandedValue > 1 then
		pilotCompassCommandedNeedleValue_adjusted = pilotadditiveCommandedValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassCommandedNeedleValue_adjusted = pilotadditiveCommandedValue
	end

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassCommandedNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassCommandedNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassCommandedNeedleValue_adjusted == 2 then
		pilotCompassCommandedNeedleValue_adjusted = "0" .. pilotCompassCommandedNeedleValue_adjusted
	elseif #pilotCompassCommandedNeedleValue_adjusted == 1 then
		pilotCompassCommandedNeedleValue_adjusted = "00" .. pilotCompassCommandedNeedleValue_adjusted
	end
	
--[[
	ExportScript.Tools.SendData(3003, "Needle 2\n" 
										.. "Deg " .. pilotCompassCommandedNeedleValue_adjusted)
										
										
	ExportScript.Tools.SendData(3004, "Additive\n" .. pilotadditiveCommandedValue .. "=\n" 
											.. pilotCompassHeadingValue .. "+\n" 
											.. pilotCompassCommandedCourseValue)								
]]

	-- Yay, it works! Now we need to format into solid degrees and round the result
	-- After that we will clean the code up a bit and then replicate for the other needle.
	
	local pilotadditiveBearingValue = pilotCompassHeadingValue + pilotCompassBearingNeedleValue
	local pilotCompassBearingNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if pilotadditiveBearingValue > 1 then
		pilotCompassBearingNeedleValue_adjusted = pilotadditiveBearingValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassBearingNeedleValue_adjusted = pilotadditiveBearingValue
	end
	

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassBearingNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassBearingNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassBearingNeedleValue_adjusted == 2 then
		pilotCompassBearingNeedleValue_adjusted = "0" .. pilotCompassBearingNeedleValue_adjusted
	elseif #pilotCompassBearingNeedleValue_adjusted == 1 then
		pilotCompassBearingNeedleValue_adjusted = "00" .. pilotCompassBearingNeedleValue_adjusted
	end

--[[
	ExportScript.Tools.SendData(3005, "Needle 1\n" 
										.. "Deg " .. pilotCompassBearingNeedleValue_adjusted)
]]									
	-- Now that we have all of that information, it's time to put in onto one tile.
	
	--turn the number into a string 
	pilotCompassHeadingValue = string.format("%.1d" , round(pilotCompassHeadingValue*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassHeadingValue == 2 then
		pilotCompassHeadingValue = "0" .. pilotCompassHeadingValue
	elseif #pilotCompassHeadingValue == 1 then
		pilotCompassHeadingValue = "00" .. pilotCompassHeadingValue
	end
	
	--last minute string adjustment for this aircraft's compass
	if pilotCompassHeadingValue == "360" then pilotCompassHeadingValue = "000" end
	if pilotCompassCommandedNeedleValue_adjusted == "360" then pilotCompassCommandedNeedleValue_adjusted = "000" end
	if pilotCompassBearingNeedleValue_adjusted == "360" then pilotCompassBearingNeedleValue_adjusted = "000" end
	
	ExportScript.Tools.SendData(3000, 		"PLT\n"
											.. "HDG " .. pilotCompassHeadingValue
											.. "\nN1 " .. pilotCompassCommandedNeedleValue_adjusted
											.. "\nN2 " .. pilotCompassBearingNeedleValue_adjusted)
											
											
--=====Copilot Side=====--

	local copilotCompassHeadingValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(101),2)
	local copilotCompassCommandedCourseValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(103),2)
	local copilotCompassBearingNeedleValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(104),2)


	local copilotadditiveCommandedValue = copilotCompassHeadingValue + copilotCompassCommandedCourseValue
	local copilotCompassCommandedNeedleValue_adjusted

	if copilotadditiveCommandedValue > 1 then
		copilotCompassCommandedNeedleValue_adjusted = copilotadditiveCommandedValue - 1
	else 
		copilotCompassCommandedNeedleValue_adjusted = copilotadditiveCommandedValue
	end
	
	local copilotCompassCommandedNeedleValue_adjustedInt = round(copilotCompassCommandedNeedleValue_adjusted*360,0) --used for later
	copilotCompassCommandedNeedleValue_adjusted = string.format("%.1d" , round(copilotCompassCommandedNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #copilotCompassCommandedNeedleValue_adjusted == 2 then
		copilotCompassCommandedNeedleValue_adjusted = "0" .. copilotCompassCommandedNeedleValue_adjusted
	elseif #copilotCompassCommandedNeedleValue_adjusted == 1 then
		copilotCompassCommandedNeedleValue_adjusted = "00" .. copilotCompassCommandedNeedleValue_adjusted
	end					
	

	local copilotadditiveBearingValue = copilotCompassHeadingValue + copilotCompassBearingNeedleValue
	local copilotCompassBearingNeedleValue_adjusted
	
	if copilotadditiveBearingValue > 1 then
		copilotCompassBearingNeedleValue_adjusted = copilotadditiveBearingValue - 1
	else 
		copilotCompassBearingNeedleValue_adjusted = copilotadditiveBearingValue
	end

	copilotCompassBearingNeedleValue_adjustedInt = round(copilotCompassBearingNeedleValue_adjusted*360,0)--used for later
	--turn the number into a string 
	copilotCompassBearingNeedleValue_adjusted = string.format("%.1d" , round(copilotCompassBearingNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #copilotCompassBearingNeedleValue_adjusted == 2 then
		copilotCompassBearingNeedleValue_adjusted = "0" .. copilotCompassBearingNeedleValue_adjusted
	elseif #copilotCompassBearingNeedleValue_adjusted == 1 then
		copilotCompassBearingNeedleValue_adjusted = "00" .. copilotCompassBearingNeedleValue_adjusted
	end
									
	-- Now that we have all of that information, it's time to put in onto one tile.
	
	
	--turn the number into a string 
	copilotCompassHeadingValue = string.format("%.1d" , round(copilotCompassHeadingValue*360,0))
	
	--if the values string length is 2 then
	if #copilotCompassHeadingValue == 2 then
		copilotCompassHeadingValue = "0" .. copilotCompassHeadingValue
	elseif #copilotCompassHeadingValue == 1 then
		copilotCompassHeadingValue = "00" .. copilotCompassHeadingValue
	end
	
	--last minute string adjustment for this aircraft's compass
	if copilotCompassHeadingValue == "360" then copilotCompassHeadingValue = "000" end
	if copilotCompassCommandedNeedleValue_adjusted == "360" then copilotCompassCommandedNeedleValue_adjusted = "000" end
	if copilotCompassBearingNeedleValue_adjusted == "360" then copilotCompassBearingNeedleValue_adjusted = "000" end
	
	ExportScript.Tools.SendData(3001, 		"CPLT\n"
											.. "HDG " .. copilotCompassHeadingValue
											.. "\nN1 " .. copilotCompassCommandedNeedleValue_adjusted
											.. "\nN2 " .. copilotCompassBearingNeedleValue_adjusted)
											
	
	-- something a little extra. an "on course" or "on bearing" detector that changes colors
	-- if the commanded course is within 5 degrees of the way you are going, then you are on course
	-- if the ndb bearing line is within 5 degrees of the way you are going, then you are on bearing
	-- You can code this some other day.
end

 


2022-01-16_21_39_31-Stream_Deck.jpg


And there you go! Extra credit if you can code that last 4 lines about the "on course" and "on bearing" detectors. 😉
I have updated the Library wiki and hip lua. 
https://github.com/asherao/DCS-ExportScripts
https://github.com/asherao/DCS-ExportScripts/wiki/Mi-8MT-Hip
https://github.com/asherao/DCS-ExportScripts/blob/master/Scripts/DCS-ExportScript/ExportsModules/Mi-8MT.lua

Yep. All I am doing is looking at the augments via the modelViewer, adjusting each one, and hopefully seeing what it moves. The ID Lookup feature works too, to my surprise as I am writing this...

 

I have the clickables exported and a lua started but I can't get the stream deck to recognize the A-4 mod. how did you get the UH-60 to appear when you open the ID lookup?

Link to comment
Share on other sites

2 minutes ago, bones1014 said:

I have the clickables exported and a lua started but I can't get the stream deck to recognize the A-4 mod. how did you get the UH-60 to appear when you open the ID lookup?

To be honest, the first time I tried it I didn't see I and I was thinking, "Oh, just like the A4 mod, oh well". And then when I saw your post I thought to check again and there it was at the bottom! No clue why or why not. As I typed this I got the A4 v2.0 and no joy with that one.

Link to comment
Share on other sites

1 minute ago, Bailey said:

To be honest, the first time I tried it I didn't see I and I was thinking, "Oh, just like the A4 mod, oh well". And then when I saw your post I thought to check again and there it was at the bottom! No clue why or why not. As I typed this I got the A4 v2.0 and no joy with that one.

The only way I got the A-4 to show up was changing the install directory to point at the saved games location. The A-4 folder appeared but there were no contents.

Link to comment
Share on other sites

1 hour ago, bones1014 said:

Isn't that UH-60 a mod? How did you get it working with the stream deck script? It would be nice to get one working for the A-4 mod.

did you just copy/paste the Lua? I used the DCS Interface: Incremental Input (Text Above) buttons for the gun counters.

I inserted the file you created, whilst the doppler keys still worked the gunnery ones didn't. I use momentary button display for these outputs but tried your suggestion of Incremental Input (Text Above), again to ensure a readout I swapped the doppler number 1003 for 1004 and tried the others to no effect. The individual DCS ID numbers work as I have them mapped individually on other keys. So I'm not sure what's going on.

SYSTEM SPECS: Hardware Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3792 Mhz, 64Gb RAM, NVIDIA GeForce RTX 4090,

CONTROLS: VPC Rotor TCS Base, VPC Hawk-60 Collective Grip, VPC MongoosT-50CM3 Base, VPC Constellation ALPHA Prime [R], Thrustmaster Warthog – Throttle, Thrustmaster TPR - Pendular Rudder Pedals, Honeycomb Alpha Flight Control (For Anubis C-130 Hercules), Meta Quest Pro.

SOFTWARE: Microsoft Windows 11,

Link to comment
Share on other sites

3 minutes ago, Mordants said:

I inserted the file you created, whilst the doppler keys still worked the gunnery ones didn't. I use momentary button display for these outputs but tried your suggestion of Incremental Input (Text Above), again to ensure a readout I swapped the doppler number 1003 for 1004 and tried the others to no effect. The individual DCS ID numbers work as I have them mapped individually on other keys. So I'm not sure what's going on.

I guess I'm not sure what's going on. Try this Lua. I added Bailey's HSI code to it and it's all working together. Great stuff!

Mi-8MT.lua

  • Like 1
Link to comment
Share on other sites

6 minutes ago, bones1014 said:

I guess I'm not sure what's going on. Try this Lua. I added Bailey's HSI code to it and it's all working together. Great stuff!

Mi-8MT.lua 91.84 kB · 0 downloads

Bailey & Bones1014, wow thanks I'll put it in now. Thanks again for your time. I really don't know how you do all this so quick. Takes me longer to read it I'm sure lol.

SYSTEM SPECS: Hardware Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3792 Mhz, 64Gb RAM, NVIDIA GeForce RTX 4090,

CONTROLS: VPC Rotor TCS Base, VPC Hawk-60 Collective Grip, VPC MongoosT-50CM3 Base, VPC Constellation ALPHA Prime [R], Thrustmaster Warthog – Throttle, Thrustmaster TPR - Pendular Rudder Pedals, Honeycomb Alpha Flight Control (For Anubis C-130 Hercules), Meta Quest Pro.

SOFTWARE: Microsoft Windows 11,

Link to comment
Share on other sites

33 minutes ago, bones1014 said:

I guess I'm not sure what's going on. Try this Lua. I added Bailey's HSI code to it and it's all working together. Great stuff!

Mi-8MT.lua 91.84 kB · 1 download

Bailey and Bones, this all works fine now, so not sure what went on with the other Lua. Just need to set up the colour change for the stream deck button now. I've also noticed when you fire the guns/grenades the Armed line changes to safe, when you let  go the trigger it goes back to armed. Cool. Once again thank for your efforts it's all fantastic stuff and I am humbled by your generosity in giving me and the community your valuable time. Makes an old man happy!

SYSTEM SPECS: Hardware Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3792 Mhz, 64Gb RAM, NVIDIA GeForce RTX 4090,

CONTROLS: VPC Rotor TCS Base, VPC Hawk-60 Collective Grip, VPC MongoosT-50CM3 Base, VPC Constellation ALPHA Prime [R], Thrustmaster Warthog – Throttle, Thrustmaster TPR - Pendular Rudder Pedals, Honeycomb Alpha Flight Control (For Anubis C-130 Hercules), Meta Quest Pro.

SOFTWARE: Microsoft Windows 11,

Link to comment
Share on other sites

38 minutes ago, Mordants said:

Bailey and Bones, this all works fine now, so not sure what went on with the other Lua. Just need to set up the colour change for the stream deck button now. I've also noticed when you fire the guns/grenades the Armed line changes to safe, when you let  go the trigger it goes back to armed. Cool. Once again thank for your efforts it's all fantastic stuff and I am humbled by your generosity in giving me and the community your valuable time. Makes an old man happy!

The color change and the Arm vs Safe line is based on that light above the counter in the cockpit. It turns off while the gun is firing.

Link to comment
Share on other sites

1 hour ago, bones1014 said:

The color change and the Arm vs Safe line is based on that light above the counter in the cockpit. It turns off while the gun is firing.

Ah I see what you did there, clever. That's why you used Incremental Input (Text Above) because of the two states. Whereas the button I used had just the one state. Brill well I'll alter mine then I'll have the perfect set up for the weapons states. Thanks for explaining that bit.

4 hours ago, Bailey said:

Done. I'll post the raw code here. It has a lot of stuff that you wont see or need in the lua file. Give it a look if you are curious. It is unfortunate that the forum messes up the code spacing.
 

  Reveal hidden contents
function ExportScript.CompassReadouts(mainPanelDevice)

--[[

	[25] = "%.4f",		-- UGR_4K_heading_L {0.0, 1.0}
	[27] = "%.4f",		-- UGR_4K_commanded_course_L {0.0, 1.0}
	[28] = "%.4f",		-- UGR_4K_bearing_needle_L {0.0, 1.0}
	----
	[101] = "%.4f",		-- UGR_4K_heading_R {0.0, 1.0}
	[103] = "%.4f",		-- UGR_4K_commanded_course_R {0.0, 1.0}
	[104] = "%.4f",		-- UGR_4K_bearing_needle_R {0.0, 1.0}
	
]]

	--ExportScript.Tools.SendData(3000, "Hi")
	local pilotCompassHeadingValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(25),2)
	local pilotCompassCommandedCourseValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(27),2)
	local pilotCompassBearingNeedleValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(28),2)
	
--[[
	we know for the HeadingValue, 	0.0 = 000
									0.5 = 180
									1.0 = 000
	
	For both the commanded course and the bearing needle are similar, 
	but they are based on the orentation of the Heading value.
	
	This means that if we subtract their values from the Heading value,
	the absolute value should represent the fraction of the compass that
	is shown. Hopefully...
	
	Examples:
	
	if pilotCompassHeadingValue = 0.0, the top is indicating 000
	pilotCompassCommandedCourseValue at 0.0 will show 000
	pilotCompassBearingNeedleValue at 0.0 will show 000
	
	We realize that we only need to solve for CommandedCourse bc the
	bearingNeedle will be the same code.
	
	if pilotCompassHeadingValue = 0.25, the top is indicating 090
	if pilotCompassCommandedCourseValue at 0.0 will point to 090
	if pilotCompassCommandedCourseValue at 0.25 will point to 180
	
	Now let's make up some math that works. Science!
	
	We know that 180 should "be" 0.50. That turns out to be the vaules combined...
	Let's see if that works in a different example.
	
	if pilotCompassHeadingValue = 0.75, the top is indicating 270
	if pilotCompassCommandedCourseValue at 0.0 will point to 270
	if pilotCompassCommandedCourseValue at 0.50 will point to 090
	
	Does it work? Well, 0.75 plus 0.50 = 1.25, which reduced by 1 = 0.25, which 
	represents a compass value of 090. Yes! The logic works!
	All of the above was assumed and varified via ModelViewer.
	
	Now lets write that in code.
	
]]

	-- Let's print out some easy, basic, raw values to monitor our base assumptions
	-- This step is import so that we don't go in a random direction with our code.
	-- Dont use the ':' symbol. Export Scripts does not like that.
	ExportScript.Tools.SendData(3000, "HDG\n" 
										.. "Raw " .. pilotCompassHeadingValue .. "\n" 
										.. "DEG " .. pilotCompassHeadingValue*360)
	ExportScript.Tools.SendData(3001, "Needle 2\n" 
										.. "Raw " .. pilotCompassCommandedCourseValue .. "\n" 
										.. "Abs " .. pilotCompassCommandedCourseValue*360)
	ExportScript.Tools.SendData(3002, "Needle 1\n" 
										.. "Raw " .. pilotCompassBearingNeedleValue .. "\n" 
										.. "Abs " .. pilotCompassBearingNeedleValue*360)
	
	-- Now we code the code we think is going to work using out thought process from above.
	
	local additiveCommandedValue = pilotCompassHeadingValue + pilotCompassCommandedCourseValue
	local pilotCompassCommandedNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if additiveCommandedValue > 1 then
		pilotCompassCommandedNeedleValue_adjusted = additiveCommandedValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassCommandedNeedleValue_adjusted = additiveCommandedValue
	end
	

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassCommandedNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassCommandedNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassCommandedNeedleValue_adjusted == 2 then
		pilotCompassCommandedNeedleValue_adjusted = "0" .. pilotCompassCommandedNeedleValue_adjusted
	elseif #pilotCompassCommandedNeedleValue_adjusted == 1 then
		pilotCompassCommandedNeedleValue_adjusted = "00" .. pilotCompassCommandedNeedleValue_adjusted
	end
	
	
	ExportScript.Tools.SendData(3003, "Needle 2\n" 
										.. "Deg " .. pilotCompassCommandedNeedleValue_adjusted)
										
										
	ExportScript.Tools.SendData(3004, "Additive\n" .. additiveCommandedValue .. "=\n" 
											.. pilotCompassHeadingValue .. "+\n" 
											.. pilotCompassCommandedCourseValue)								
	
	-- Yay, it works! Now we need to format into solid degrees and round the result
	-- After that we will clean the code up a bit and then replicate for the other needle.
	
	local additiveBearingValue = pilotCompassHeadingValue + pilotCompassBearingNeedleValue
	local pilotCompassBearingNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if additiveBearingValue > 1 then
		pilotCompassBearingNeedleValue_adjusted = additiveBearingValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassBearingNeedleValue_adjusted = additiveBearingValue
	end
	

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassBearingNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassBearingNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassBearingNeedleValue_adjusted == 2 then
		pilotCompassBearingNeedleValue_adjusted = "0" .. pilotCompassBearingNeedleValue_adjusted
	elseif #pilotCompassBearingNeedleValue_adjusted == 1 then
		pilotCompassBearingNeedleValue_adjusted = "00" .. pilotCompassBearingNeedleValue_adjusted
	end
	
	ExportScript.Tools.SendData(3005, "Needle 1\n" 
										.. "Deg " .. pilotCompassBearingNeedleValue_adjusted)
										
	-- Now that we have all of that information, it's time to put in onto one tile.
	
	--turn the number into a string 
	pilotCompassHeadingValue = string.format("%.1d" , round(pilotCompassHeadingValue*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassHeadingValue == 2 then
		pilotCompassHeadingValue = "0" .. pilotCompassHeadingValue
	elseif #pilotCompassHeadingValue == 1 then
		pilotCompassHeadingValue = "00" .. pilotCompassHeadingValue
	end
	
	--last minute string adjustment for this aircraft's compass
	if pilotCompassHeadingValue == "360" then pilotCompassHeadingValue = "000" end
	if pilotCompassCommandedNeedleValue_adjusted == "360" then pilotCompassCommandedNeedleValue_adjusted = "000" end
	if pilotCompassBearingNeedleValue_adjusted == "360" then pilotCompassBearingNeedleValue_adjusted = "000" end
	
	ExportScript.Tools.SendData(3006, "HDG " .. pilotCompassHeadingValue
											.. "\nN1 " .. pilotCompassCommandedNeedleValue_adjusted
											.. "\nN2 " .. pilotCompassBearingNeedleValue_adjusted)

end

 


The actual code is this:
 

  Reveal hidden contents
function ExportScript.CompassReadouts(mainPanelDevice)

--[[

	[25] = "%.4f",		-- UGR_4K_heading_L {0.0, 1.0}
	[27] = "%.4f",		-- UGR_4K_commanded_course_L {0.0, 1.0}
	[28] = "%.4f",		-- UGR_4K_bearing_needle_L {0.0, 1.0}
	----
	[101] = "%.4f",		-- UGR_4K_heading_R {0.0, 1.0}
	[103] = "%.4f",		-- UGR_4K_commanded_course_R {0.0, 1.0}
	[104] = "%.4f",		-- UGR_4K_bearing_needle_R {0.0, 1.0}
	
]]

	--ExportScript.Tools.SendData(3000, "Hi") --test
	local pilotCompassHeadingValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(25),8)--rounds to the 8th digit after the decimal
	local pilotCompassCommandedCourseValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(27),8)--makes it more accurate compared to 2
	local pilotCompassBearingNeedleValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(28),8)
	
--[[
	we know for the HeadingValue, 	0.0 = 000
									0.5 = 180
									1.0 = 000
	
	For both the commanded course and the bearing needle are similar, 
	but they are based on the orentation of the Heading value.
	
	This means that if we subtract their values from the Heading value,
	the absolute value should represent the fraction of the compass that
	is shown. Hopefully...
	
	Examples:
	
	if pilotCompassHeadingValue = 0.0, the top is indicating 000
	pilotCompassCommandedCourseValue at 0.0 will show 000
	pilotCompassBearingNeedleValue at 0.0 will show 000
	
	We realize that we only need to solve for CommandedCourse bc the
	bearingNeedle will be the same code.
	
	if pilotCompassHeadingValue = 0.25, the top is indicating 090
	if pilotCompassCommandedCourseValue at 0.0 will point to 090
	if pilotCompassCommandedCourseValue at 0.25 will point to 180
	
	Now let's make up some math that works. Science!
	
	We know that 180 should "be" 0.50. That turns out to be the vaules combined...
	Let's see if that works in a different example.
	
	if pilotCompassHeadingValue = 0.75, the top is indicating 270
	if pilotCompassCommandedCourseValue at 0.0 will point to 270
	if pilotCompassCommandedCourseValue at 0.50 will point to 090
	
	Does it work? Well, 0.75 plus 0.50 = 1.25, which reduced by 1 = 0.25, which 
	represents a compass value of 090. Yes! The logic works!
	All of the above was assumed and varified via ModelViewer.
	
	Now lets write that in code.
	
]]

	-- Let's print out some easy, basic, raw values to monitor our base assumptions
	-- This step is import so that we don't go in a random direction with our code.
	-- Dont use the ':' symbol. Export Scripts does not like that.
--[[
	ExportScript.Tools.SendData(3000, "HDG\n" 
										.. "Raw " .. pilotCompassHeadingValue .. "\n" 
										.. "DEG " .. pilotCompassHeadingValue*360)
	ExportScript.Tools.SendData(3001, "Needle 2\n" 
										.. "Raw " .. pilotCompassCommandedCourseValue .. "\n" 
										.. "Abs " .. pilotCompassCommandedCourseValue*360)
	ExportScript.Tools.SendData(3002, "Needle 1\n" 
										.. "Raw " .. pilotCompassBearingNeedleValue .. "\n" 
										.. "Abs " .. pilotCompassBearingNeedleValue*360)
]]
	
	-- Now we code the code we think is going to work using out thought process from above.
	
	local pilotadditiveCommandedValue = pilotCompassHeadingValue + pilotCompassCommandedCourseValue
	local pilotCompassCommandedNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if pilotadditiveCommandedValue > 1 then
		pilotCompassCommandedNeedleValue_adjusted = pilotadditiveCommandedValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassCommandedNeedleValue_adjusted = pilotadditiveCommandedValue
	end

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassCommandedNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassCommandedNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassCommandedNeedleValue_adjusted == 2 then
		pilotCompassCommandedNeedleValue_adjusted = "0" .. pilotCompassCommandedNeedleValue_adjusted
	elseif #pilotCompassCommandedNeedleValue_adjusted == 1 then
		pilotCompassCommandedNeedleValue_adjusted = "00" .. pilotCompassCommandedNeedleValue_adjusted
	end
	
--[[
	ExportScript.Tools.SendData(3003, "Needle 2\n" 
										.. "Deg " .. pilotCompassCommandedNeedleValue_adjusted)
										
										
	ExportScript.Tools.SendData(3004, "Additive\n" .. pilotadditiveCommandedValue .. "=\n" 
											.. pilotCompassHeadingValue .. "+\n" 
											.. pilotCompassCommandedCourseValue)								
]]

	-- Yay, it works! Now we need to format into solid degrees and round the result
	-- After that we will clean the code up a bit and then replicate for the other needle.
	
	local pilotadditiveBearingValue = pilotCompassHeadingValue + pilotCompassBearingNeedleValue
	local pilotCompassBearingNeedleValue_adjusted
	
	-- We have to reduce the number to below 1 (or below 360 if we did it later).
	
	if pilotadditiveBearingValue > 1 then
		pilotCompassBearingNeedleValue_adjusted = pilotadditiveBearingValue - 1
		-- The max the additive can be is "2". if we minus 1 from 2, we get 1, which is 360.
		-- Not more reduction logic is necessary.
	else 
		pilotCompassBearingNeedleValue_adjusted = pilotadditiveBearingValue
	end
	

	-- we need to add a '0' to the front for numbers less than three digits long
	-- or add two '0's for number less than two digits long
	-- The following code is from the mossie.lua
	
	--turn the number into a string 
	pilotCompassBearingNeedleValue_adjusted = string.format("%.1d" , round(pilotCompassBearingNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassBearingNeedleValue_adjusted == 2 then
		pilotCompassBearingNeedleValue_adjusted = "0" .. pilotCompassBearingNeedleValue_adjusted
	elseif #pilotCompassBearingNeedleValue_adjusted == 1 then
		pilotCompassBearingNeedleValue_adjusted = "00" .. pilotCompassBearingNeedleValue_adjusted
	end

--[[
	ExportScript.Tools.SendData(3005, "Needle 1\n" 
										.. "Deg " .. pilotCompassBearingNeedleValue_adjusted)
]]									
	-- Now that we have all of that information, it's time to put in onto one tile.
	
	--turn the number into a string 
	pilotCompassHeadingValue = string.format("%.1d" , round(pilotCompassHeadingValue*360,0))
	
	--if the values string length is 2 then
	if #pilotCompassHeadingValue == 2 then
		pilotCompassHeadingValue = "0" .. pilotCompassHeadingValue
	elseif #pilotCompassHeadingValue == 1 then
		pilotCompassHeadingValue = "00" .. pilotCompassHeadingValue
	end
	
	--last minute string adjustment for this aircraft's compass
	if pilotCompassHeadingValue == "360" then pilotCompassHeadingValue = "000" end
	if pilotCompassCommandedNeedleValue_adjusted == "360" then pilotCompassCommandedNeedleValue_adjusted = "000" end
	if pilotCompassBearingNeedleValue_adjusted == "360" then pilotCompassBearingNeedleValue_adjusted = "000" end
	
	ExportScript.Tools.SendData(3000, 		"PLT\n"
											.. "HDG " .. pilotCompassHeadingValue
											.. "\nN1 " .. pilotCompassCommandedNeedleValue_adjusted
											.. "\nN2 " .. pilotCompassBearingNeedleValue_adjusted)
											
											
--=====Copilot Side=====--

	local copilotCompassHeadingValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(101),2)
	local copilotCompassCommandedCourseValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(103),2)
	local copilotCompassBearingNeedleValue = ExportScript.Tools.round(mainPanelDevice:get_argument_value(104),2)


	local copilotadditiveCommandedValue = copilotCompassHeadingValue + copilotCompassCommandedCourseValue
	local copilotCompassCommandedNeedleValue_adjusted

	if copilotadditiveCommandedValue > 1 then
		copilotCompassCommandedNeedleValue_adjusted = copilotadditiveCommandedValue - 1
	else 
		copilotCompassCommandedNeedleValue_adjusted = copilotadditiveCommandedValue
	end
	
	local copilotCompassCommandedNeedleValue_adjustedInt = round(copilotCompassCommandedNeedleValue_adjusted*360,0) --used for later
	copilotCompassCommandedNeedleValue_adjusted = string.format("%.1d" , round(copilotCompassCommandedNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #copilotCompassCommandedNeedleValue_adjusted == 2 then
		copilotCompassCommandedNeedleValue_adjusted = "0" .. copilotCompassCommandedNeedleValue_adjusted
	elseif #copilotCompassCommandedNeedleValue_adjusted == 1 then
		copilotCompassCommandedNeedleValue_adjusted = "00" .. copilotCompassCommandedNeedleValue_adjusted
	end					
	

	local copilotadditiveBearingValue = copilotCompassHeadingValue + copilotCompassBearingNeedleValue
	local copilotCompassBearingNeedleValue_adjusted
	
	if copilotadditiveBearingValue > 1 then
		copilotCompassBearingNeedleValue_adjusted = copilotadditiveBearingValue - 1
	else 
		copilotCompassBearingNeedleValue_adjusted = copilotadditiveBearingValue
	end

	copilotCompassBearingNeedleValue_adjustedInt = round(copilotCompassBearingNeedleValue_adjusted*360,0)--used for later
	--turn the number into a string 
	copilotCompassBearingNeedleValue_adjusted = string.format("%.1d" , round(copilotCompassBearingNeedleValue_adjusted*360,0))
	
	--if the values string length is 2 then
	if #copilotCompassBearingNeedleValue_adjusted == 2 then
		copilotCompassBearingNeedleValue_adjusted = "0" .. copilotCompassBearingNeedleValue_adjusted
	elseif #copilotCompassBearingNeedleValue_adjusted == 1 then
		copilotCompassBearingNeedleValue_adjusted = "00" .. copilotCompassBearingNeedleValue_adjusted
	end
									
	-- Now that we have all of that information, it's time to put in onto one tile.
	
	
	--turn the number into a string 
	copilotCompassHeadingValue = string.format("%.1d" , round(copilotCompassHeadingValue*360,0))
	
	--if the values string length is 2 then
	if #copilotCompassHeadingValue == 2 then
		copilotCompassHeadingValue = "0" .. copilotCompassHeadingValue
	elseif #copilotCompassHeadingValue == 1 then
		copilotCompassHeadingValue = "00" .. copilotCompassHeadingValue
	end
	
	--last minute string adjustment for this aircraft's compass
	if copilotCompassHeadingValue == "360" then copilotCompassHeadingValue = "000" end
	if copilotCompassCommandedNeedleValue_adjusted == "360" then copilotCompassCommandedNeedleValue_adjusted = "000" end
	if copilotCompassBearingNeedleValue_adjusted == "360" then copilotCompassBearingNeedleValue_adjusted = "000" end
	
	ExportScript.Tools.SendData(3001, 		"CPLT\n"
											.. "HDG " .. copilotCompassHeadingValue
											.. "\nN1 " .. copilotCompassCommandedNeedleValue_adjusted
											.. "\nN2 " .. copilotCompassBearingNeedleValue_adjusted)
											
	
	-- something a little extra. an "on course" or "on bearing" detector that changes colors
	-- if the commanded course is within 5 degrees of the way you are going, then you are on course
	-- if the ndb bearing line is within 5 degrees of the way you are going, then you are on bearing
	-- You can code this some other day.
end

 


2022-01-16_21_39_31-Stream_Deck.jpg


And there you go! Extra credit if you can code that last 4 lines about the "on course" and "on bearing" detectors. 😉
I have updated the Library wiki and hip lua. 
https://github.com/asherao/DCS-ExportScripts
https://github.com/asherao/DCS-ExportScripts/wiki/Mi-8MT-Hip
https://github.com/asherao/DCS-ExportScripts/blob/master/Scripts/DCS-ExportScript/ExportsModules/Mi-8MT.lua

Yep. All I am doing is looking at the augments via the modelViewer, adjusting each one, and hopefully seeing what it moves. The ID Lookup feature works too, to my surprise as I am writing this...

 

This looks amazing, if I just wanted solely the compass heading, so that I could make the font bigger to read at a glance what tweak would I do in the lua?

SYSTEM SPECS: Hardware Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 3792 Mhz, 64Gb RAM, NVIDIA GeForce RTX 4090,

CONTROLS: VPC Rotor TCS Base, VPC Hawk-60 Collective Grip, VPC MongoosT-50CM3 Base, VPC Constellation ALPHA Prime [R], Thrustmaster Warthog – Throttle, Thrustmaster TPR - Pendular Rudder Pedals, Honeycomb Alpha Flight Control (For Anubis C-130 Hercules), Meta Quest Pro.

SOFTWARE: Microsoft Windows 11,

Link to comment
Share on other sites

6 hours ago, bones1014 said:

The only way I got the A-4 to show up was changing the install directory to point at the saved games location. The A-4 folder appeared but there were no contents.

Aaaaaad, it's gone. I don't see what I had thought to be the UH-60L entry. Maybe I was looking at the UH-1 the whole time. Sorry for the false alarm. /shrug
I guess that means it's time for sleep. In the meantime, I was able to get this coded up for the UH-60L mod. 

    --if radio is on and selected then green circle (you can talk)
    --if radio is on and not selected then yellow circle (radio in standby)
    --if radio is off and not selected then red circle (radio is cold)
    --if radio is off and selected then red X (basically telling you that your config is wrong, so fix it if you want to talk)


All of the radio Tiles work "as expected". After some rest I'll see if I can remember how to use it. Then I'll document and release. There's more luck and magic in the code than I'm used to. 😄
 


Edited by Bailey
Link to comment
Share on other sites

I installed the plugin. Followed the video for installation with no problems. I started DCS Open Beta and my p-51 helios profile. I went into streamdeck and created several switches and knobs and it worked great. Today when I started the same helios profile and DCS Open Beta nothing on streamdeck worked. When I went to DCS Comms I get a DCS module not running. I tried a streamdeck profile for the f-16 and none of the switches worked and still got the DCS module not running.

I went over the install again and checked the config file and everything is good.

One thing. For some reason DCS does not install to the Saved Games folder. Mine always saves to the Documents\My Games folder.

Any help would be greatly appreciated.

Link to comment
Share on other sites

On 1/16/2022 at 10:07 PM, bones1014 said:

The only way I got the A-4 to show up was changing the install directory to point at the saved games location. The A-4 folder appeared but there were no contents.

So here’s how I am making the UH-60 profile. I install the aircraft in the proper saved games location. I start dcs. I then install the aircraft in the dcs install location. This enables DCS-Interface to ready the clickable lua (etc) as if it were an actual module. It will appear in the drop down menu. After making the profile you can then remove the aircraft from the dcs install location. You will still be able to use the profile. The “only” issue I am having is that it seems that the Battery and APU switches are toggleing via the SD, but the systems don’t turn on in game. If I use either keybinds or clicking it works fine. Have you heard of that happen before? And a solution? I plan to post the UH60 profile to the ExportScripts Library once it is mostly finished with the lua. 

Link to comment
Share on other sites

16 minutes ago, maddog726 said:

I installed the plugin. Followed the video for installation with no problems. I started DCS Open Beta and my p-51 helios profile. I went into streamdeck and created several switches and knobs and it worked great. Today when I started the same helios profile and DCS Open Beta nothing on streamdeck worked. When I went to DCS Comms I get a DCS module not running. I tried a streamdeck profile for the f-16 and none of the switches worked and still got the DCS module not running.

I went over the install again and checked the config file and everything is good.

One thing. For some reason DCS does not install to the Saved Games folder. Mine always saves to the Documents\My Games folder.

Any help would be greatly appreciated.

At the top of the screen that says no module detected, have you re-entered your dcs install path and verified?

Link to comment
Share on other sites

52 minutes ago, maddog726 said:

Today when I started the same helios profile and DCS Open Beta nothing on streamdeck worked. When I went to DCS Comms I get a DCS module not running.

@maddog726 check the order of the “dofile” lines in your Export.lua file. The DCS-ExportScript needs to be first before Helios I believe (or try playing around with different orders or enabling/disabling scripts). Sometimes different export scripts don’t interact well together. 
 

Also the dcs.log file in Saved Games can be helpful if one of the export scripts is failing. 


Edited by ctytler
Link to comment
Share on other sites

22 hours ago, ctytler said:

@maddog726 check the order of the “dofile” lines in your Export.lua file. The DCS-ExportScript needs to be first before Helios I believe (or try playing around with different orders or enabling/disabling scripts). Sometimes different export scripts don’t interact well together. 
 

Also the dcs.log file in Saved Games can be helpful if one of the export scripts is failing. 

 

That was it!I moved it to the bottom and it works great. Tried all the different streamdeck profiles and success.

Thanks, its a great program.

23 hours ago, Bailey said:

At the top of the screen that says no module detected, have you re-entered your dcs install path and verified?

Turned out that had to move the dofile entry in the export.lua file to the bottom and like magic it works.

Thanks

Link to comment
Share on other sites

So here’s how I am making the UH-60 profile. I install the aircraft in the proper saved games location. I start dcs. I then install the aircraft in the dcs install location. This enables DCS-Interface to ready the clickable lua (etc) as if it were an actual module. It will appear in the drop down menu. After making the profile you can then remove the aircraft from the dcs install location. You will still be able to use the profile. The “only” issue I am having is that it seems that the Battery and APU switches are toggleing via the SD, but the systems don’t turn on in game. If I use either keybinds or clicking it works fine. Have you heard of that happen before? And a solution? I plan to post the UH60 profile to the ExportScripts Library once it is mostly finished with the lua. 
I'll try that. I don't know why those switched aren't working

Sent from my SM-G781U using Tapatalk

  • Like 1
Link to comment
Share on other sites

On 1/17/2022 at 9:15 PM, Bailey said:

So here’s how I am making the UH-60 profile. I install the aircraft in the proper saved games location. I start dcs. I then install the aircraft in the dcs install location. This enables DCS-Interface to ready the clickable lua (etc) as if it were an actual module. It will appear in the drop down menu. After making the profile you can then remove the aircraft from the dcs install location. You will still be able to use the profile. The “only” issue I am having is that it seems that the Battery and APU switches are toggleing via the SD, but the systems don’t turn on in game. If I use either keybinds or clicking it works fine. Have you heard of that happen before? And a solution? I plan to post the UH60 profile to the ExportScripts Library once it is mostly finished with the lua. 

forgot to ask. what was the title of the lua and the aircraft name inside the lua? for example:

image.png

Link to comment
Share on other sites

24 minutes ago, bones1014 said:

forgot to ask. what was the title of the lua and the aircraft name inside the lua? for example:

image.png

-- UH-60L Export Module
ExportScript.FoundDCSModule = true
ExportScript.Version.UH60L = "1.2.1"
ExportScript.ConfigEveryFrameArguments = ...
I found it by launching a quick mission in it and then going to Saved games/DCS/logs/Export.txt to see the module name exported from DCS-ExportScript.
https://github.com/asherao/DCS-ExportScripts/blob/master/Scripts/DCS-ExportScript/ExportsModules/UH-60L.lua

While I'm here, has anyone made an A4 profile that could supply a Lua?


Edited by Bailey
Link to comment
Share on other sites

On 1/18/2022 at 4:15 AM, Bailey said:

I install the aircraft in the proper saved games location. I start dcs. I then install the aircraft in the dcs install location. This enables DCS-Interface to ready the clickable lua (etc) as if it were an actual module. It will appear in the drop down menu. After making the profile you can then remove the aircraft from the dcs install location.

 

17 hours ago, Bailey said:

ExportScript.Version.UH60L = "1.2.1"
(...)
I found it by launching a quick mission in it and then going to Saved games/DCS/logs/Export.txt to see the module name exported from DCS-ExportScript.

What great tips! Thanks! 🙂 I wish I had known them before I started tinkering with the Scooter.

Speaking of which... I only have a "microLua" with 20-30 "variables" in it. Probably not what you want, but that's all I have (see the attached file). I started making the file when A-4 2.0 was in beta and never finished. I typically start with armament panel, so it's there already, but not entirely - I use my button/pot box for a few things (e.g. I have ripple interval turned with a real potentiometer, so I don't have "buttons" for it in my profile).
I put device IDs and button IDs into the Lua to facilitate creating a profile with it (like I said - I didn't know your trick at the time).

Oh, and since I didn't know your second trick, either, in the file it reads "ExportScript.Version.AV8BNA = "1.2.1" (how "smart" of me, I know 😉)

Perhaps someone else if further down the road with the Lua for A-4?

 

EDIT: I'm too slow with the forums 😄 A few hours after your post above, you published this auto-generated file:

https://github.com/asherao/DCS-ExportScripts/blob/master/Scripts/DCS-ExportScript/ExportsModules/A-4E-C.lua

BIG THANKS!

 

A-4E-C.lua


Edited by scoobie
  • Like 1

i7-8700K 32GB 2060(6GB) 27"@1080p TM Hawg HOTAS TPR TIR5 SD-XL 2xSD+ HC Bravo button/pot box

Link to comment
Share on other sites

I'm trying to find the numbers for the nav computer. I looked in the mainpanel_init.lua and found this but putting the argument numbers in the export lua doesn't work. which file are these normally in?

-- ASN-41 Navigation Computer
-- current position: XX.YY{N/S}
Nav_CurPos_Lat_Xnnnn                  = CreateGauge("parameter")
Nav_CurPos_Lat_Xnnnn.arg_number       = 178
Nav_CurPos_Lat_Xnnnn.input            = {0.0, 1.0}
Nav_CurPos_Lat_Xnnnn.output           = {0.0, 1.0}
Nav_CurPos_Lat_Xnnnn.parameter_name   = "NAV_CURPOS_LAT_Xnnnn"

Nav_CurPos_Lat_nXnnn                  = CreateGauge("parameter")
Nav_CurPos_Lat_nXnnn.arg_number       = 179
Nav_CurPos_Lat_nXnnn.input            = {0.0, 1.0}
Nav_CurPos_Lat_nXnnn.output           = {0.0, 1.0}
Nav_CurPos_Lat_nXnnn.parameter_name   = "NAV_CURPOS_LAT_nXnnn"

Nav_CurPos_Lat_nnXnn                  = CreateGauge("parameter")
Nav_CurPos_Lat_nnXnn.arg_number       = 180
Nav_CurPos_Lat_nnXnn.input            = {0.0, 1.0}
Nav_CurPos_Lat_nnXnn.output           = {0.0, 1.0}
Nav_CurPos_Lat_nnXnn.parameter_name   = "NAV_CURPOS_LAT_nnXnn"

Nav_CurPos_Lat_nnnXn                  = CreateGauge("parameter")
Nav_CurPos_Lat_nnnXn.arg_number       = 181
Nav_CurPos_Lat_nnnXn.input            = {0.0, 1.0}
Nav_CurPos_Lat_nnnXn.output           = {0.0, 1.0}
Nav_CurPos_Lat_nnnXn.parameter_name   = "NAV_CURPOS_LAT_nnnXn"

Nav_CurPos_Lat_nnnnX                  = CreateGauge("parameter")
Nav_CurPos_Lat_nnnnX.arg_number       = 182
Nav_CurPos_Lat_nnnnX.input            = {0.0, 1.0}
Nav_CurPos_Lat_nnnnX.output           = {0.0, 1.0}
Nav_CurPos_Lat_nnnnX.parameter_name   = "NAV_CURPOS_LAT_nnnnX"

 

Link to comment
Share on other sites

1 hour ago, bones1014 said:

I'm trying to find the numbers for the nav computer. I looked in the mainpanel_init.lua and found this but putting the argument numbers in the export lua doesn't work. which file are these normally in?

-- ASN-41 Navigation Computer
-- current position: XX.YY{N/S}
Nav_CurPos_Lat_Xnnnn                  = CreateGauge("parameter")
Nav_CurPos_Lat_Xnnnn.arg_number       = 178
Nav_CurPos_Lat_Xnnnn.input            = {0.0, 1.0}
Nav_CurPos_Lat_Xnnnn.output           = {0.0, 1.0}
Nav_CurPos_Lat_Xnnnn.parameter_name   = "NAV_CURPOS_LAT_Xnnnn"

Nav_CurPos_Lat_nXnnn                  = CreateGauge("parameter")
Nav_CurPos_Lat_nXnnn.arg_number       = 179
Nav_CurPos_Lat_nXnnn.input            = {0.0, 1.0}
Nav_CurPos_Lat_nXnnn.output           = {0.0, 1.0}
Nav_CurPos_Lat_nXnnn.parameter_name   = "NAV_CURPOS_LAT_nXnnn"

Nav_CurPos_Lat_nnXnn                  = CreateGauge("parameter")
Nav_CurPos_Lat_nnXnn.arg_number       = 180
Nav_CurPos_Lat_nnXnn.input            = {0.0, 1.0}
Nav_CurPos_Lat_nnXnn.output           = {0.0, 1.0}
Nav_CurPos_Lat_nnXnn.parameter_name   = "NAV_CURPOS_LAT_nnXnn"

Nav_CurPos_Lat_nnnXn                  = CreateGauge("parameter")
Nav_CurPos_Lat_nnnXn.arg_number       = 181
Nav_CurPos_Lat_nnnXn.input            = {0.0, 1.0}
Nav_CurPos_Lat_nnnXn.output           = {0.0, 1.0}
Nav_CurPos_Lat_nnnXn.parameter_name   = "NAV_CURPOS_LAT_nnnXn"

Nav_CurPos_Lat_nnnnX                  = CreateGauge("parameter")
Nav_CurPos_Lat_nnnnX.arg_number       = 182
Nav_CurPos_Lat_nnnnX.input            = {0.0, 1.0}
Nav_CurPos_Lat_nnnnX.output           = {0.0, 1.0}
Nav_CurPos_Lat_nnnnX.parameter_name   = "NAV_CURPOS_LAT_nnnnX"

 

Those look right. See here: https://github.com/asherao/DCS-ExportScripts/blob/c73fcedd9885e67332f9a7e326dbe7e5d53122c7/Scripts/DCS-ExportScript/ExportsModules/A-4E-C.lua#L566
Nav computer, aka TomTom, for now. Exports 2010-2015.

Link to comment
Share on other sites

20 minutes ago, bones1014 said:

I was doing exactly that and didn't get anything in the stream deck. emoji36.png

Sent from my SM-G781U using Tapatalk
 

Did you make sure to have the args defined in ExportScript.ConfigEveryFrameArguments or ExportScript.ConfigArguments?


Edited by Bailey
Link to comment
Share on other sites

@Bailey Feel like throwing these into your Skyhawk lua? For radar mode and tilt angle and the weapon drop interval. and yea I had them defined. Oh well you got it working.

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 = ExportScript.Tools.round(mainPanelDevice:get_argument_value(122), 1) * 5
		if radar_tilt == 1 then
		radar_tilt = "+5"
		elseif radar_tilt == 2 then
		radar_tilt = "0"
		elseif	radar_tilt == 3 then
		radar_tilt = "-5"
		elseif radar_tilt == 4 then
		radar_tilt = "-10"
		elseif radar_tilt == 5 then
		radar_tilt = "-15"
		else radar_tilt = "+10"
		end
		
		local radar_mode_and_tilt = "MODE" .. "\n" .. radar_mode .. "\n" .. "TILT" .. 
		"\n" .. radar_tilt

	ExportScript.Tools.SendData(1250, radar_mode_and_tilt)
		
end

function ExportScript.drop_interval(mainPanelDevice)
	--[742] = "%0.2f",	--AWRS Drop Interval Knob	{0,0,0.9}
	
	local drop_interval = "DRP INTVL" .. "\n" .. ((ExportScript.Tools.round(mainPanelDevice:get_argument_value(742), 2) * 10) / 0.05) + 20

	ExportScript.Tools.SendData(1251, drop_interval)

end

 


Edited by bones1014
  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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