L:Vars for inertial clutch switch (LUA script)

Post Reply
Posts: 7
Joined: 29 Nov 2013, 18:48

L:Vars for inertial clutch switch (LUA script)

Post by simurq » 30 Sep 2015, 22:37


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:

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)
	i = 3
	while i > 0 do
		ipc.control(66740,1)             -- manual pump switch x3 times
		i = i - 1
	if ipc.readUD(0x08F8) > 0 then             -- while fuel pressure is OK...
		ipc.writeLvar(clutch,-1)             -- put inertial clutch switch to ON (RMB click)
	if ipc.readUW(magneto) == 0 then	
		ipc.control(66400,3)             -- set magneto to 1+2
		ipc.display("Magneto: SET TO 1+2")

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!

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?



Post Reply