I'm trying to add a way to control the lights in the Aerosoft A320 for FSX-SE. If I do a single LUA control per light, with this code, it works:
Taxi=ipc.readLvar("L:AB_TAXI_LT")
if Taxi==nil or Taxi==0 then
ipc.writeLvar("L:AB_TAXI_LT", 1)
elseif Taxi==1 then
ipc.writeLvar("L:AB_TAXI_LT", 2)
else
ipc.writeLvar("L:AB_TAXI_LT", 0)
end
return
This code allows me to cycle the Taxi lights between 3 different conditions. If I assign a button in FSUIPC as LUA AS_A320 (that's the filename I used for it), it works as intended, but it will require a LUA file per each light.
However, for simplicity (and a bit of OCD), I'd like to have 4 functions (taxi, landing, strobe and beacon lights) in a single LUA, and call them using functions and flags, the code woild change to this:
function Lights_TAXI_toggle()
Taxi=ipc.readLvar("L:AB_TAXI_LT")
if Taxi==nil or Taxi==0 then
ipc.writeLvar("L:AB_TAXI_LT", 1)
elseif Taxi==1 then
ipc.writeLvar("L:AB_TAXI_LT", 2)
else
ipc.writeLvar("L:AB_TAXI_LT", 0)
end
end
event.flag(3, "Lights_TAXI_toggle")
After this, I assign a button in FSUIPC as Lua Set, and in the parameter box, i enter 3. However, I can't make this switch work. Changing to Lua Toggle or adding a Lua Clear does not change the situation at all. What may I be doing wrong?
Best regards,
Luis