Jump to content

Recommended Posts

Posted

can you draw from the lockon commands in these scripts eg RadarAltValue = math.floor((LoGetAltitudeAboveGroundLevel() * 3.281) / 10) * 10

I can think of nothing heavier than an airplane
I can think of no greater conglomerate of steel and metal
I can think of nothing less likely to fly

Posted
10 minutes ago, Wostg said:

can you draw from the lockon commands in these scripts eg RadarAltValue = math.floor((LoGetAltitudeAboveGroundLevel() * 3.281) / 10) * 10

I was hoping there was something basic such as that for heading, rpm etc as well but I don't believe it's possible based on some of the posts I've read. But maybe someone knows better; like I said, I really have no idea what I'm doing lol

Posted
19 minutes ago, Wostg said:

can you draw from the lockon commands in these scripts eg RadarAltValue = math.floor((LoGetAltitudeAboveGroundLevel() * 3.281) / 10) * 10

if you download the export file it'll have the arguments for each instrument and light possible in a number format.

Github source for exports

Posted
11 minutes ago, bones1014 said:

if you download the export file it'll have the arguments for each instrument and light possible in a number format.

Github source for exports

Right, so as I understand it, there are no export ID's universal to all modules and the only ID's that are exportable are limited to what the developer has included with the module?

Posted
4 minutes ago, Bearmat said:

Right, so as I understand it, there are no export ID's universal to all modules and the only ID's that are exportable are limited to what the developer has included with the module?

correct. Each module has it's own export file with arguments defined inside.

Posted (edited)
54 minutes ago, Bearmat said:

I was hoping there was something basic such as that for heading, rpm etc as well but I don't believe it's possible based on some of the posts I've read. But maybe someone knows better; like I said, I really have no idea what I'm doing lol

There are some universal commands, like LoGetAltitudeAboveGroundLevel(), LoGetAltitudeAboveSeaLevel(), LoGetAngleOfAttack() - I think the bottom-bar that displays values in external/map? views draw from these. They're not 100% accurate to the module at hand - like the Barometric sea level one dosn't account for QFE, but can be easier to apply than whatever crazy scale any given gauge in a cockpit follows.

(No idea if they work in dcs-exportscripts specifically, but I assume they would?)

Edited by Wostg

I can think of nothing heavier than an airplane
I can think of no greater conglomerate of steel and metal
I can think of nothing less likely to fly

Posted
14 minutes ago, Wostg said:

There are some universal commands, like LoGetAltitudeAboveGroundLevel(), LoGetAltitudeAboveSeaLevel(), LoGetAngleOfAttack() - I think the bottom-bar that displays values in external/map? views draw from these. They're not 100% accurate to the module at hand - like the Barometric sea level one dosn't account for QFE, but can be easier to apply than whatever crazy scale any given gauge in a cockpit follows.

(No idea if they work in dcs-exportscripts specifically, but I assume they would?)

 

All the ones so far have been linear, so it hasn't been a big deal. Either way, sounds like from what bones said above, those ID's included with the export script are the only ones exportable and the LO ID's are not in there.

Posted (edited)

Two things:

1. If possible, how do I get the export values to update faster? Is it possible to just make specific values update faster, rather than all? I think this would help me judge the accuracy of the rad alt export better.

EDIT: Moved the ID to HighImportance and this seems to have done the trick.

 

2. Here is the rad alt script. Please check it out and let me know how it's working. It appears to be within a few feet for me in my limited testing so far:

function ExportScript.RADAR_ALTITUDE(mainPanelDevice)
    local radar_altitude_value = mainPanelDevice:get_argument_value(73)

    local altitude_table = {
        {0.0000, 0},
        {0.0155, 0}, -- on ground
        {0.1681, 50},
        {0.2220, 100}, -- average between 0.2080 and 0.2220
        {0.2950, 150},
        {0.3682, 200}, -- new value
        {0.4597, 300},
        {0.5705, 500}, -- new value
        {0.6933, 1000}, -- average between 0.6933 and 0.7145
        {0.7733, 1500},
        {0.8159, 2000}, -- average between 0.8159 and 0.8224
        {0.9011, 3000}, -- average between 0.9011 and 0.9630
        {0.9839, 5000}
    }

    local function interpolate(value, table)
        for i = 1, #table - 1 do
            if value >= table[i][1] and value <= table[i + 1][1] then
                local ratio = (value - table[i][1]) / (table[i + 1][1] - table[i][1])
                return table[i][2] + ratio * (table[i + 1][2] - table[i][2])
            end
        end
        return 0 -- return 0 if value is out of bounds
    end

    local radar_altitude_feet = interpolate(radar_altitude_value, altitude_table)
    local formatted_radar_altitude = string.format("%d", radar_altitude_feet)

    ExportScript.Tools.SendData(export_ids.RADAR_ALTITUDE, formatted_radar_altitude)
end

 

Edited by Bearmat
  • Like 1
Posted
6 hours ago, Wostg said:

can you draw from the lockon commands in these scripts eg RadarAltValue = math.floor((LoGetAltitudeAboveGroundLevel() * 3.281) / 10) * 10

 

5 hours ago, Bearmat said:

I was hoping there was something basic such as that for heading, rpm etc as well but I don't believe it's possible based on some of the posts I've read. But maybe someone knows better; like I said, I really have no idea what I'm doing lol

It is possible. Example: https://github.com/asherao/DCS-ExportScripts/blob/efbdbe4320500f8c3038316258e0c8abea979c53/Scripts/DCS-ExportScript/ExportsModules/UH-1H.lua#L1046

4 hours ago, Bearmat said:

Two things:

1. If possible, how do I get the export values to update faster? Is it possible to just make specific values update faster, rather than all? I think this would help me judge the accuracy of the rad alt export better.

EDIT: Moved the ID to HighImportance and this seems to have done the trick.

 

2. Here is the rad alt script. Please check it out and let me know how it's working. It appears to be within a few feet for me in my limited testing so far:

function ExportScript.RADAR_ALTITUDE(mainPanelDevice)
    local radar_altitude_value = mainPanelDevice:get_argument_value(73)

    local altitude_table = {
        {0.0000, 0},
        {0.0155, 0}, -- on ground
        {0.1681, 50},
        {0.2220, 100}, -- average between 0.2080 and 0.2220
        {0.2950, 150},
        {0.3682, 200}, -- new value
        {0.4597, 300},
        {0.5705, 500}, -- new value
        {0.6933, 1000}, -- average between 0.6933 and 0.7145
        {0.7733, 1500},
        {0.8159, 2000}, -- average between 0.8159 and 0.8224
        {0.9011, 3000}, -- average between 0.9011 and 0.9630
        {0.9839, 5000}
    }

    local function interpolate(value, table)
        for i = 1, #table - 1 do
            if value >= table[i][1] and value <= table[i + 1][1] then
                local ratio = (value - table[i][1]) / (table[i + 1][1] - table[i][1])
                return table[i][2] + ratio * (table[i + 1][2] - table[i][2])
            end
        end
        return 0 -- return 0 if value is out of bounds
    end

    local radar_altitude_feet = interpolate(radar_altitude_value, altitude_table)
    local formatted_radar_altitude = string.format("%d", radar_altitude_feet)

    ExportScript.Tools.SendData(export_ids.RADAR_ALTITUDE, formatted_radar_altitude)
end

 

 

For F4 I assume? Looking forward to checking this out!

Posted (edited)

Thanks to @bones1014 and @Bearmat, we have some new exports!

https://github.com/asherao/DCS-ExportScripts/blob/master/Scripts/DCS-ExportScript/ExportsModules/F-4E-45MC.lua
(Use the download raw file button near the top of the code)

PILOT_GEAR_IND                 = 10060,
PILOT_ALTIMETER                = 10061,
MISSILE_LIGHTS                 = 10062,
PILOT_RADAR_ALTITUDE           = 10063,
PILOT_HSI_BEARING_POINTER      = 10064, -- WIP
LEFT_ENGINE_RPM                = 10065,
RIGHT_ENGINE_RPM               = 10066,
VSI_INDICATION                 = 10067,
AOA_INDEXER                    = 10068,

Thank you! Excellent works to the both of them!
(Bearmat, can you put leading 0's on the HSI?)
(bones1014, are you able to show if a heater is loaded and unfired?)

Edited by Bailey
Posted
6 hours ago, Bailey said:

Thanks to @bones1014 and @Bearmat, we have some new exports!

https://github.com/asherao/DCS-ExportScripts/blob/master/Scripts/DCS-ExportScript/ExportsModules/F-4E-45MC.lua
(Use the download raw file button near the top of the code)

PILOT_GEAR_IND                 = 10060,
PILOT_ALTIMETER                = 10061,
MISSILE_LIGHTS                 = 10062,
PILOT_RADAR_ALTITUDE           = 10063,
PILOT_HSI_BEARING_POINTER      = 10064, -- WIP
LEFT_ENGINE_RPM                = 10065,
RIGHT_ENGINE_RPM               = 10066,
VSI_INDICATION                 = 10067,
AOA_INDEXER                    = 10068,

Thank you! Excellent works to the both of them!
(Bearmat, can you put leading 0's on the HSI?)
(bones1014, are you able to show if a heater is loaded and unfired?)

 

This should add the leading 0's:

function ExportScript.PILOT_HSI_BEARING_POINTER(mainPanelDevice) -- Bearmat
    local bearing_value = mainPanelDevice:get_argument_value(670) * 360
    local formatted_bearing = string.format("%03.0f", bearing_value)
    ExportScript.Tools.SendData(export_ids.PILOT_HSI_BEARING_POINTER, formatted_bearing)
end

 

  • Thanks 1
Posted (edited)
8 hours ago, Bailey said:

Thanks to @bones1014 and @Bearmat, we have some new exports!

https://github.com/asherao/DCS-ExportScripts/blob/master/Scripts/DCS-ExportScript/ExportsModules/F-4E-45MC.lua
(Use the download raw file button near the top of the code)

PILOT_GEAR_IND                 = 10060,
PILOT_ALTIMETER                = 10061,
MISSILE_LIGHTS                 = 10062,
PILOT_RADAR_ALTITUDE           = 10063,
PILOT_HSI_BEARING_POINTER      = 10064, -- WIP
LEFT_ENGINE_RPM                = 10065,
RIGHT_ENGINE_RPM               = 10066,
VSI_INDICATION                 = 10067,
AOA_INDEXER                    = 10068,

Thank you! Excellent works to the both of them!
(Bearmat, can you put leading 0's on the HSI?)
(bones1014, are you able to show if a heater is loaded and unfired?)

 

I don't think that you can do that. I'm going purely off the indicator lights which only shows active heater. It appears that the missiles always fire in a certain order so the pilot would just have to remember what he has left based on the lights.
 

Edited by bones1014
Posted

@Bearmat could we combine your new 10064 HSI bearing pointer with the 10045 pilot course window into one tile? Is there a way to do without running both calculations twice? Only way I can think of is to put your new one inside the previous. I tried to call the exports together but that doesn't work.

Posted
1 hour ago, bones1014 said:

@Bearmat could we combine your new 10064 HSI bearing pointer with the 10045 pilot course window into one tile? Is there a way to do without running both calculations twice? Only way I can think of is to put your new one inside the previous. I tried to call the exports together but that doesn't work.

Pilot course window is the course setting adjusted by the course knob on the HSI, correct?

Posted
24 minutes ago, Bearmat said:

Pilot course window is the course setting adjusted by the course knob on the HSI, correct?

Yes. So slightly different 

2 hours ago, bones1014 said:

I don't think that you can do that. I'm going purely off the indicator lights which only shows active heater. It appears that the missiles always fire in a certain order so the pilot would just have to remember what he has left based on the lights.
 

 

Got it. Thanks. (Where are these lights in the cockpit anyways!?) Awesome and creative visual implementation. 

  • Thanks 1
Posted (edited)
1 hour ago, Bailey said:

Yes. So slightly different 

Got it. Thanks. (Where are these lights in the cockpit anyways!?) Awesome and creative visual implementation. 

I think you can change the selected station by pressing the button but there isn't an indicator for empty vs mounted except for the sparrows. The sparrow lights go out as each weapon is launched.

image.png

Edited by bones1014
  • Thanks 1
Posted (edited)
function ExportScript.HSI(mainPanelDevice)
    -- Pilot HSI Course Roller
    local pilotCourseSet_ones = string.format("%d", mainPanelDevice:get_argument_value(674) * 10)
    local pilotCourseSet_tens = string.format("%d", mainPanelDevice:get_argument_value(675) * 10)
    local pilotCourseSet_hundreds = string.format("%d", mainPanelDevice:get_argument_value(676) * 10)

    local bearing_value = mainPanelDevice:get_argument_value(670) * 360 --bearmat
    local formatted_bearing = string.format("%.0f", bearing_value) --bearmat
    ExportScript.Tools.SendData(export_ids.PILOT_HSI_COURSE_WINDOW,
        string.format("HSI\n" .. pilotCourseSet_hundreds .. pilotCourseSet_tens .. pilotCourseSet_ones .. "\nCRS\n" .. formatted_bearing))
    --[[ExportScript.Tools.SendData(export_ids.PILOT_HSI_COURSE_WINDOW,
        string.format(pilotCourseSet_hundreds .. pilotCourseSet_tens .. pilotCourseSet_ones))]]

@Bailey @Bearmat the course needle defaults to your current heading when you're in NAV COMP mode and is user set in TAC and VOR/ILS mode. With the combined tile it would be a breeze to match your current course with what is either automatically or manually set with the course set knob. I'm going to combine them if you don't mind. 🙂null

image.png

Edited by bones1014
  • Like 1
  • Thanks 1
Posted (edited)

Just added a pilot's fuel readout. I updated my GitHub repository @Bailey

 

function ExportScript.Pilot_Fuel_Readout(mainPanelDevice)
    local tens = string.format("%d", mainPanelDevice:get_argument_value(719) * 10)
    local hundreds = string.format("%d", mainPanelDevice:get_argument_value(720) * 10)
    local thousands = string.format("%d", mainPanelDevice:get_argument_value(721) * 10)
    local tensofthousands = string.format("%d", mainPanelDevice:get_argument_value(722) * 10)
    ExportScript.Tools.SendData(export_ids.PILOT_FUEL_READOUT,
    string.format("FUEL\n" .. tensofthousands .. thousands .. hundreds .. tens .. "\nx10"))
end

 

image.png

Edited by bones1014
  • Like 1
Posted

You guys are doing great work!

  • Like 1
  • Thanks 1

I can think of nothing heavier than an airplane
I can think of no greater conglomerate of steel and metal
I can think of nothing less likely to fly

Posted (edited)

Hello,

Awesome work here, congratulations.

About the barometric altimeter, I added some code that works great for me. I did a pull request yesterday, just in case.

function ExportScript.ALT_indicator(mainPanelDevice)
	local ones = mainPanelDevice:get_argument_value(91) * 100
	local hundreds = round(mainPanelDevice:get_argument_value(92) * 10)
	local thousands = round(mainPanelDevice:get_argument_value(93) * 10)
	local tenthousands = round(mainPanelDevice:get_argument_value(94) * 10)
    local ALT = tenthousands * 10000 + thousands * 1000 + hundreds *100 + ones
	ExportScript.Tools.SendData(export_ids.BARO_ALT,string.format("%05.0f", ALT))	
end

I see that in the last merge the arguments for the altimeter were changed from "%.1f" to "%.3f", is there a specific reason ?

I checked both codes and they worked OK for me, but I'm curious since this implies more computing with 3 digit outputs.

Edited by Yogi_25
typo
Posted
Just now, Yogi_25 said:

Hello,

Awesome work here, congratulations.

About the barometric altimeter, I added some code that works great for me. I did a pull request yesterday, just in case.

function ExportScript.ALT_indicator(mainPanelDevice)
	local ones = mainPanelDevice:get_argument_value(91) * 100
	local hundreds = round(mainPanelDevice:get_argument_value(92) * 10)
	local thousands = round(mainPanelDevice:get_argument_value(93) * 10)
	local tenthousands = round(mainPanelDevice:get_argument_value(94) * 10)
    local ALT = tenthousands * 10000 + thousands * 1000 + hundreds *100 + ones
	ExportScript.Tools.SendData(export_ids.BARO_ALT,string.format("%05.0f", ALT))	
end

I see that in the last merge the arguments for the altimeter were changed from "%.1f" to "%.3f", is there a specific reason ?

I checked both codes and they worked OK for me, but I'm curious since this implies more computing with 3 digit outputs.

It was changed because between 7k and 8k feet the altimeter was showing 6k. It seems to be working in the newest version of the export lua. Download it and try to see if it's working for you.

  • Recently Browsing   0 members

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