Code: Select all
img_add_fullscreen("KX165A.png")
redline = img_add("redline.png", 364, 10, 2, 300)
-- Add text --
txt_com1 = txt_add(" ", "size:25px; color:#DCF509; halign:left", 25, 40, 200, 200)
txt_com1stby = txt_add(" ", "size:25px; color:#DCF509; halign:left", 200, 40, 200, 200)
txt_nav1 = txt_add(" ", "size:25px; color:#DCF509; halign:left", 365, 40, 200, 200)
txt_nav1stby = txt_add(" ", "size:25px; color:#DCF509; halign:left", 520, 40, 200, 200)
-- Set default visibility --
img_visible(redline, false)
--subscribe callback --
function new_navcomm_FSX(avionics, nav1, nav1stby, com1, com1stby, battery, generator, FuseNavCom1)
--make a boolean power variable based on state of avionics, battery, generator and FuseNavCom1 == 1
local power = avionics >= 8 and (battery >= 8 or generator) and FuseNavCom1
img_visible(redline, power)
if power then
txt_set(txt_com1, string.format("%06.02f",com1/100, com1%100) )
txt_set(txt_com1stby, string.format("%06.02f",com1stby/100, com1stby%100))
txt_set(txt_nav1, string.format("%06.02f",nav1/100, nav1%100))
txt_set(txt_nav1stby, string.format("%06.02f",nav1stby/100, nav1stby%100) )
else
txt_set(txt_com1, " ")
txt_set(txt_com1stby, " ")
txt_set(txt_nav1, " ")
txt_set(txt_nav1stby, " ")
end
end
--subscribes --
fsx_variable_subscribe("ELECTRICAL AVIONICS BUS VOLTAGE", "Volts",
"NAV ACTIVE FREQUENCY:1", "Mhz",
"NAV STANDBY FREQUENCY:1", "Mhz",
"COM ACTIVE FREQUENCY:1", "Mhz",
"COM STANDBY FREQUENCY:1", "Mhz",
"ELECTRICAL BATTERY BUS VOLTAGE", "Volts",
"GENERAL ENG GENERATOR SWITCH:1", "Bool",
"L:FuseNavCom1", "enum", new_navcomm_FSX)