PMDG 737NGX Events and Variables 2

How can be this controlled in that simulator? Can HIDmacros be used with this application?
Post Reply
G.Ahrens
Posts: 7
Joined: 20 May 2013, 03:37

PMDG 737NGX Events and Variables 2

Post by G.Ahrens » 27 May 2013, 21:00

I have been working with HID macros, PMDG SDK and FSUIPC SDK all weekend.
I have enabled data broadcast in a PMDG ini file as instructed.
I have been able to make two position switches, momentary press switches, and rotary switches work with MOUSE_FLAG_RIGHTSINGLE and LEFTSINGLE.

I have an issue with three position switches being operated from one key.
Specifically the ADF 1 and 2 switch on both the Captains and First Officers side.
I have been trying them out different ways and am unable to get it to function properly.
I would like to press one key to go from OFF -> VOR -> ADF -> OFF in an attempt to cycle through them singly with each keypress.

I, the list that follows will be four of the multitudes of different ways I have tried to implement this on the 4 different VOR/OFF/ADF switches. (I understand on the PMDG 737NGX that ADF2 is not available.)
I am somewhat confused with writing values to an offset command as it seems the three programs (PMDG, HID Macros, and FSUIPC) seem to use the variable in a different order, then again, perhaps not and I am an idiot.
I am not a programmer or coder by any means, but think I have been doing good so far. I have the Captain's and F/O's EFIS panel and the MCP panel fully mapped except for the 4 VOR/ADF 3 position toggle switches.

'Global Routines -
Const MOUSE_FLAG_LEFTSINGLE = &H20000000
Const MOUSE_FLAG_RIGHTSINGLE = &H80000000
Const EFIS_VORADFSel1 = &H6518
Const EFIS_VORADFSel2 = &H651A
Const EVT_EFIS_CPT_VOR_ADF_SELECTOR_L = "#69990"
Const EVT_EFIS_CPT_VOR_ADF_SELECTOR_R = "#70000"
Const EFIS_VORADFSel1_FO = &H6519
Const EFIS_VORADFSel2_FO = &H651B
Const EVT_EFIS_FO_VOR_ADF_SELECTOR_L = "#70046"
Const EVT_EFIS_FO_VOR_ADF_SELECTOR_R = "#70056"

'Key Scripts-
'VOR/ADF1 on the captains side -

L1 = HIDMacros.GetFSUIPCInt(EFIS_VORADFSel1, 2)
if (Round(L1)=1) then
HIDMacros.FSXEvent EVT_EFIS_CPT_VOR_ADF_SELECTOR_L, MOUSE_FLAG_RIGHTSINGLE
elseif (Round(L1)=0) then
HIDMacros.FSXEvent EVT_EFIS_CPT_VOR_ADF_SELECTOR_L, MOUSE_FLAG_LEFTSINGLE
HIDMacros.Sleep 200
HIDMacros.FSXEvent EVT_EFIS_CPT_VOR_ADF_SELECTOR_L, MOUSE_FLAG_LEFTSINGLE
else
HIDMacros.FSXEvent EVT_EFIS_CPT_VOR_ADF_SELECTOR_L, MOUSE_FLAG_RIGHTSINGLE
end if

'VOR/ADF2 on the captains side -

L1 = HIDMacros.GetFSUIPCInt(EFIS_VORADFSel2, 2)
if (Round(L1)=1) then
HIDMacros.FSXEvent "#6990", 0
elseif (Round(L1)=0) then
HIDMacros.FSXEvent "#6990", 2
else
HIDMacros.FSXEvent "#6990", 1
end if

'VOR/ADF1 on the F/O's side -

L1 = HIDMacros.GetFSUIPCInt(EFIS_VORADFSel1_FO, 2)
if (Round(L1)=1) then
HIDMacros.SetFSUIPCInt EFIS_VORADFSel1_FO, 2, "0"
elseif (Round(L1)=0) then
HIDMacros.SetFSUIPCInt EFIS_VORADFSel1_FO, 2, "2"
else
HIDMacros.SetFSUIPCInt EFIS_VORADFSel1_FO, 2, "1"
end if

'VOR/ADF2 on the F/O's side -

L1 = HIDMacros.GetFSXInt(&H651B, 2)
if (Round(L1)=1) then
HIDMacros.SetFSXInt &H651B, 2, 0
elseif (Round(L1)=0) then
HIDMacros.SetFSXInt &H651B, 2, 2
else
HIDMacros.SetFSXInt &H651B, 2, 1
end if

Thank you in advance for any help.

G.Ahrens
Posts: 7
Joined: 20 May 2013, 03:37

Re: PMDG 737NGX Events and Variables 2

Post by G.Ahrens » 29 May 2013, 03:53

Took awhile but got it.
Code snippet from the Action script for the key, Globals remain the same as above.
Seems I had to get raw value, and using the 2 for EFIS_VORADFSel1 does not work (The PMDG SDK and the Header file both say [2] byte.
Works exactly the way I want it.

R1 = HIDMacros.GetFSUIPCRaw(EFIS_VORADFSel1, 1)
If (Round(R1) = 1) then
HIDMacros.FSXEvent EVT_EFIS_CPT_VOR_ADF_SELECTOR_L, MOUSE_FLAG_RIGHTSINGLE
elseif (Round(R1) = 0) then
HIDMacros.FSXEvent EVT_EFIS_CPT_VOR_ADF_SELECTOR_L, MOUSE_FLAG_LEFTSINGLE

HIDMacros.FSXEvent EVT_EFIS_CPT_VOR_ADF_SELECTOR_L, MOUSE_FLAG_LEFTSINGLE
else
HIDMacros.FSXEvent EVT_EFIS_CPT_VOR_ADF_SELECTOR_L, MOUSE_FLAG_RIGHTSINGLE
end if

ryhoo2
Posts: 21
Joined: 24 Feb 2013, 17:57
Location: Poland

Re: PMDG 737NGX Events and Variables 2

Post by ryhoo2 » 29 May 2013, 10:02

Glad you got it. I will post my full keyboard config soon, maybe you'll find some more hints.

Post Reply