I'm close to finish my first ever LUA script which is dedicated to beautiful but grumpy "Annushka".
It was made possible thanks to LINDA and already covers almost ALL buttons, knobs, and switches found in the cockpit. But it can do more, particularly put the aircraft in a complete Cold & Dark situation and initiate auto-start procedure (for lazy guys like me!).
There is only one problem though and I would like to hear your advice. The final stage of auto-start procedure requires inertial clutch switch put to charging (LMB click), then wait until the charger noise stabilizes and ampermeter shows not less than 8 amps, and switch it to the right (RMB click) with magneto set to 1+2 mode immediately after engine is started. The following piece of code tries to accomplish this task:
But in fact changing L:Var "AN2_inertial_clutch" to -1 (note the minus sign!) yields nothing... When I do this with mouse, the engine starts but programmatically it's not possible... yet!
Code: Select all
local i = 0 local clutch = "L:AN2_inertial_clutch" local soundSet = "L:play_sound" if ipc.readLvar(clutch) == 0 then ipc.writeLvar(clutch,1) -- inertial clutch switch CHARGE (LMB click) ipc.writeLvar(soundSet,10) i = 3 while i > 0 do ipc.control(66740,1) -- manual pump switch x3 times ipc.writeLvar(soundSet,52) ipc.sleep(1500) i = i - 1 end if ipc.readUD(0x08F8) > 0 then -- while fuel pressure is OK... ipc.control(66300) ipc.writeLvar(clutch,-1) -- put inertial clutch switch to ON (RMB click) ipc.sleep(500) end if ipc.readUW(magneto) == 0 then ipc.control(66400,3) -- set magneto to 1+2 ipc.writeLvar(soundSet,13) ipc.display("Magneto: SET TO 1+2") ipc.sleep(1000) end end
I have tried to trace the L:Vars associated with the clutch switch but I cannot see them in LINDA Tracer. So, I thought maybe you can advice what other variables get initiated during the startup so that the script can do everything without any user (mouse) interaction?