This is an example how to assign keyboard shortcuts via FSUIPC using ONE lua file.
1. Create a text file in MODULES folder e.g. '737_action.lua'
2. Copy the functions you want into that file, (at the top we put variables), lets take the pumps as example:
PMDGBaseVar = 0x00011000 -- 69632
PMDG_ClkL = 0x20000000 -- 536870912
PMDG_ClkR = 0x80000000 -- -2147483648
PMDG_dec = 0x00002000 -- 8192
PMDG_inc = 0x00004000 -- 16384
PMDG_RelL = 0x00020000 -- 131072
PMDG_RelM = 0x00040000 -- 262144
PMDG_RelR = 0x00080000 -- 524288
function NGX_PUMP1_AFT_on ()
if ipc.readLvar('ngx_switch_37_a') ~= 100 then
ipc.control(PMDGBaseVar+37, PMDG_ClkL)
DspShow("PMP1", "A on")
end
end
function NGX_PUMP1_AFT_off ()
if ipc.readLvar('ngx_switch_37_a') ~= 0 then
ipc.control(PMDGBaseVar+37, PMDG_ClkR)
DspShow("PMP1", "Aoff")
end
end
function NGX_PUMP1_AFT_toggle ()
if ipc.readLvar('ngx_switch_37_a') == 100 then
NGX_PUMP1_AFT_off()
else
NGX_PUMP1_AFT_on()
end
end
3. Change the lines as below (we can remove the line with 'DspShow' if not using MCP):
PMDGBaseVar = 0x00011000 -- 69632
PMDG_ClkL = 0x20000000 -- 536870912
PMDG_ClkR = 0x80000000 -- -2147483648
PMDG_dec = 0x00002000 -- 8192
PMDG_inc = 0x00004000 -- 16384
PMDG_RelL = 0x00020000 -- 131072
PMDG_RelM = 0x00040000 -- 262144
PMDG_RelR = 0x00080000 -- 524288
-- NGX_PUMP1_AFT_on
if ipcPARAM == 0 then
if ipc.readLvar('ngx_switch_37_a') ~= 100 then
ipc.control(PMDGBaseVar+37, PMDG_ClkL)
end
end
-- NGX_PUMP1_AFT_off
if ipcPARAM == 1 then
if ipc.readLvar('ngx_switch_37_a') ~= 0 then
ipc.control(PMDGBaseVar+37, PMDG_ClkR)
end
end
--NGX_PUMP1_AFT_toggle
if ipcPARAM == 2 then
if ipc.readLvar('ngx_switch_37_a') == 100 then
NGX_PUMP1_AFT_off()
else
NGX_PUMP1_AFT_on()
end
end
Assign the shortcuts as below changing the parameter field accordingly: