Hi Father Dane,
The following LUA code will do what you require.
Just copy and paste it into Notepad and save the file with a .lua extension. eg: 'PMDG_737_NGX_IRS.lua'
The file needs to be placed in you Modules folder for FSUIPC to see it.
You will then be able to assign this lUA script to a switch, or as many switches as you like, in the usual way.
It will be listed as 'Lua PMDG 737 NGX IRS'
You need to set the Parameter option to select what you wish it to do.
Parameter of 10 will set the Left IRS to OFF
Parameter of 12 will set the Left IRS to NAV
The script doesn't care where the IRS switch is currently at, it just moves it from there to the required position.
Other Parameters are listed at the top of the lua script. Any invalid Parameter will just be ignored.
I have only tested this in FSX as I do not have the NGX for P3d, though I see no reason why it would not work in P3D.
Hope this helps.
Chris.
-- Parameters to send via FSUIPC
-- 10 - Left IRS OFF
-- 11 - Left IRS ALIGN
-- 12 - Left IRS NAV
-- 13 - Left IRS ATT
-- 20 - Right IRS OFF
-- 21 - Right IRS ALIGN
-- 22 - Right IRS NAV
-- 23 - Right IRS ATT
PMDGBaseVar = 0x00011000 -- 69632
PMDG_ClkL = 0x20000000 -- 536870912
PMDG_ClkR = 0x80000000 -- -2147483648
function Left_IRS(New_Pos)
local Current_Pos = ipc.readLvar ('ngx_switch_255_a') /10
while New_Pos > Current_Pos do
ipc.control(PMDGBaseVar + 255, PMDG_ClkR)
Current_Pos = Current_Pos + 1
end
while New_Pos < Current_Pos do
ipc.control(PMDGBaseVar + 255, PMDG_ClkL)
Current_Pos = Current_Pos - 1
end
end
function Right_IRS(New_Pos)
local Current_Pos = ipc.readLvar ('ngx_switch_256_a') /10
while New_Pos > Current_Pos do
ipc.control(PMDGBaseVar + 256, PMDG_ClkR)
Current_Pos = Current_Pos + 1
end
while New_Pos < Current_Pos do
ipc.control(PMDGBaseVar + 256, PMDG_ClkL)
Current_Pos = Current_Pos - 1
end
end
MyPosition = ipcPARAM - 10
IRS = 1
if MyPosition > 9 then
MyPosition = MyPosition - 10
IRS = 2
end
if MyPosition >= 0 and MyPosition < 4 then
if IRS == 1 then
Left_IRS (MyPosition)
elseif IRS == 2 then
Right_IRS (MyPosition)
end
end