Adding a condition statement
Re: Adding a condition statement
redline turns off and on with the switch but the digits stay on (L:FuseNavCom1)
Avionics and battery switches working correctly.
Avionics and battery switches working correctly.
Re: Adding a condition statement
Did you get the latest code that fixed the small typo. BTW the redline turns on/off with the same variable as the digits so if one works they should both work. If you are still having problems we'll need to put that print back in so we can see what the inputs are doing in the console ouput.
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: Adding a condition statement
Git it. added ==1
--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 == 1
img_visible(redline, power)
Thanks to all. Air Manager`s support team is FANTASTIC.
--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 == 1
img_visible(redline, power)
Thanks to all. Air Manager`s support team is FANTASTIC.
Re: Adding a condition statement
Here is the final working code next. Works Great
Re: Adding a condition statement
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 == 1
img_visible(redline, power)
if power then
txt_set(txt_com1, string.format("%06.02f",com1, com1%1) )
txt_set(txt_com1stby, string.format("%06.02f",com1stby, com1stby%1))
txt_set(txt_nav1, string.format("%06.02f",nav1, nav1%1))
txt_set(txt_nav1stby, string.format("%06.02f",nav1stby, nav1stby%1) )
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)
Re: Adding a condition statement
vangyver,
Great news. We got there in the end. So glad its working as you wanted. Now back to my own projects.
Great news. We got there in the end. So glad its working as you wanted. Now back to my own projects.
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Adding a condition statement
@Sling
Sorry quick OT question.
How did you like the dataref reset when testing?
Keith
Sorry quick OT question.
How did you like the dataref reset when testing?
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: Adding a condition statement
dataref reset ? I am very new at this.
Re: Adding a condition statement
I can tell you this: I am lovin Air manager 4.02 with all the options of viewing the code / modifying the code / and seeing the results.
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Adding a condition statement
Hi,
Corjan added a very nice feature to reset the dataref value to the sim value.
If you right click the send. I popup appears <reset to sim value> that if clicked will reset the dataref. Very handy when testing when multiple datarefs values need to be changed back and fourth.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card