Hey everyone,
as the search function didn't yield sufficient answers to my problem, I try to ask this way.
Inspired by this thread:
http://forums.eagle.ru/showthread.php?p=1428587#post1428587
I started creating stateful button commands for BS2 to better suit the Warthog's throttle switches.
So far everything worked out flawlessly and I created stateful commands for the Dust/Ice protection system, the burst lenght and the laser Standby/Off switches.
However the Fuel Cut-Off levers are giving me a headache.
This is the code I tried to implement into the keyboard.lua.
{down = 3009, cockpit_device_id = 4, value_down = 0.0, name = "Cut-Off Valve Left Engine Close", category = "Ins Engines start-up control panel and levers"},
As with all the previous codes I implemented, the new command shows up in the designated options and I can assign a button to it.
Now comes the annoying part.
It works and lets me move the Cut-Off lever up, however on the next press, the lever goes down again, so the effect is exactly the same as if I'd assign a button to the normal "left engine cut-off valve" command, hence the purpose of a stateful command is not fulfilled.
I rewrote the code now several times, tried several .lua files to implement it into, all with the same result that the newly assigned command still actuates the lever both ways.
Altering the value_down = # also shows no effect, I even tried "0.5" to no avail.
In addition to that, here are the parts from the clickabledata.lua and the devices.lua, where I got the values from.
elements["EMERGENCY-BRAKE ENGINE-LEFT-PTR"] = { class = {class_type.TUMB, class_type.TUMB}, hint = LOCALIZE("Left engine cut-off valve"), device = devices.ENGINE_INTERFACE, action = {device_commands.Button_9,device_commands.Button_9}, arg = {554,554}, arg_value = {direction*1.0,-direction*1.0}, arg_lim = {{0.0, 1.0},{0.0, 1.0}}, updatable = true, use_OBB = true}
devices["ENGINE_INTERFACE"] = 4
Maybe one of you guys knows what I'm doing wrong.
I'd be thankful for everyone trying to help.
Thanks so far, greetings
MadCat