Hi, i'm trying to create a lua script to control the switches of the a2a cessna 172, and so far all works except the window defrost control.
Monitoring the lua vars i've found that 3 vars are associated with that funcion (they change when i turn on/off the defrost via the mini-control panel of the aircraft) and they are:
I've wrote the code for toggling it on/off, but as i press the key associated with the lua script parameter it switches on/off for but immediately return to the previous state...
Here's my script:
-- Windshield Defroster Toggle
if ipcPARAM == 4 then
LVar1Set = "L:WindowDefrosterControl1"
val1 = 0
if ipc.readLvar(LVar1Set) == 0 then
val1 = 25
LVar1Set = "L:WindowDefrosterControl2"
val2 = 0
if ipc.readLvar(LVar2Set) == 0 then
val2 = 25
LVar3Set = "L:WindowDefrosterControlKnob"
val3 = 0
if ipc.readLvar(LVar3Set) == 0 then
val3 = 100
Something wrong with it? Monitoring lua I've found that it works in a very strange way, sometimes the knob value doesn't change at all, sometimes it sets at 50 instead of 100... the control1 and 2 seem to switch to 1 for a while but turning back to 0 immediately...
any clues? thank you!