Code: Select all
-- Add images in Z-order --
img_add_fullscreen("KN 62A.png")
-- Add text in Z-order --
txt_nm = txt_add("NM", "size:20px; font:GOST Common.ttf; color: #fb2c00; halign: left;", 135, 42, 50, 50)
txt_kt = txt_add("KT", "size:20px; font:GOST Common.ttf; color: #fb2c00; halign: left;", 322, 42, 50, 50)
txt_min = txt_add("MIN", "size:20px; font:GOST Common.ttf; color: #fb2c00; halign: left;", 470, 42, 50, 50)
-- Add a group --
group_textRMT = group_add(txt_nm, txt_kt, txt_min)
--subscribe callback --
function new_data_fsx(avionics, battery, generator, kn62OnOff)
--make a boolean power variable based on state of avionics, battery, generator and kn62OnOff == 1
local power = avionics >= 8 and (battery >= 8 or generator) and kn62OnOff == 1
if power then
visible(group_textRMT, true)
else
visible(group_textRMT, false)
end
end
fsx_variable_subscribe("L:kn62OnOff", "enum",
"ELECTRICAL AVIONICS BUS VOLTAGE", "Volts",
"ELECTRICAL BATTERY BUS VOLTAGE", "Volts",
"GENERAL ENG GENERATOR SWITCH:1", "Bool", new_data_fsx)