Thank You, John! I thought maybe you did another way)
AT Disengage (67279) and TOGA (65861) I did! Thank you! Code:
joy = 3
btn = 2
interval = 100 -- 1/2 second press, gap, press limits
ignorepress = false
-- Function to time the button being pressed or left released
-- Allow only up to "interval" till decide no change
local function timebutton(test)
while true do
time2 = ipc.elapsedtime()
if (time2 - time1) > interval then
ignorepress = false
return false
end
if ipc.testbutton(joy, btn) == test then
time1 = time2
return true
end
ipc.sleep(20)
end
end
function buttonpress(j, b, du)
if ignorepress then
ignorepress = false
return
end
-- Note time button was pressed
time1 = ipc.elapsedtime()
time2 = 0
if timebutton(false) then
-- First press / release counts: see if there's another
if timebutton(true) then
-- got another press in time, look for release
if timebutton(false) then
-- this was a double press, send VIEW RIGHT
ipc.control()
ignorepress = true -- ignore the next press we receive, i.e. the 2nd in a double-press
end
else
-- This was a single press, send VIEW LEFT
ipc.control(67279)
ignorepress = false
end
else
-- This was a longer press, send VIEW FORWARD
ipc.control(65861)
end
end
-- Enable event on button being pressed (only)
event.button(joy, btn, 1, "buttonpress")
How do I manage the cut off valves? They work as presets. I don't know what code to enter.
Unfortunately, the github page https://github.com/joeherwig/msfs-fsuipc-lua-scripts is not working.