I had been struggling to get my hardware ignition switches to work properly in MSFS. It seemed that the old FSX based events and variables didn't work to accurately have the hardware switch match the sim's switch state.
Well, thanks to the hubhop database, I found a solution that works:
Code: Select all
eng_user_prop = user_prop_add_integer("Engine", 1, 8, 1, "Set the engine number for this magneto switch")
hw_switch_add("Magneto switch", 4, function(position, direction)
if position == 0 then
-- fs2020_event("MAGNETO".. user_prop_get(eng_user_prop) .. "_OFF")
fs2020_variable_write("RECIP ENG LEFT MAGNETO:".. user_prop_get(eng_user_prop),"Bool",false)
fs2020_variable_write("RECIP ENG RIGHT MAGNETO:".. user_prop_get(eng_user_prop),"Bool",false)
elseif position == 1 then
-- fs2020_event("MAGNETO".. user_prop_get(eng_user_prop) .. "_LEFT")
fs2020_variable_write("RECIP ENG LEFT MAGNETO:".. user_prop_get(eng_user_prop),"Bool",false)
fs2020_variable_write("RECIP ENG RIGHT MAGNETO:".. user_prop_get(eng_user_prop),"Bool",true)
elseif position == 2 then
-- fs2020_event("MAGNETO".. user_prop_get(eng_user_prop) .. "_RIGHT")
fs2020_variable_write("RECIP ENG LEFT MAGNETO:".. user_prop_get(eng_user_prop),"Bool",true)
fs2020_variable_write("RECIP ENG RIGHT MAGNETO:".. user_prop_get(eng_user_prop),"Bool",false)
elseif position == 3 then
-- fs2020_event("MAGNETO".. user_prop_get(eng_user_prop) .. "_BOTH")
fs2020_variable_write("RECIP ENG LEFT MAGNETO:".. user_prop_get(eng_user_prop),"Bool",true)
fs2020_variable_write("RECIP ENG RIGHT MAGNETO:".. user_prop_get(eng_user_prop),"Bool",true)
end
end)