I just figured how to use PMDG 737NGX specific events/variables and I wanted to share.
You can use for this purpose FSXEvents, but PMDG's events are not defined on the list, so... we need to script it using custom event numbers that are defined in PMDG's SDK.
To find the correct values open this file: <FSX main folder>\PMDG\PMDG 737 NGX\SDK\PMDG_NGX_SDK.h
You can find the values there, for ex. to switch on the A/T ARM you have this event:
#define EVT_MCP_AT_ARM_SWITCH (THIRD_PARTY_EVENT_ID_MIN + 380)
THIRD_PARTY_EVENT_ID_MIN is a constant and always equals to 69632, so if you do the math we get the value of 70012.
And here's how to use it in script:
HIDMacros.FSXEvent "#70012", 0
One more thing needs to be done to make it work. You need to enable PMDG data broadcasting. Add the following 2 lines to this file: <FSX main folder>\PMDG\PMDG 737 NGX\737NGX_Options.ini
There are also variables that will tell you what is the current state of the particular component, for ex. is the light on or off, what's the heading, etc.
To be able to read from PMDG variables you need to enable PMDG data broadcast as above and also you need to have the FSUIPC library installed (at least version 4.8 as far as I know).
All variables are defined in the PDF file that comes with the FSUIPC library in here:
<FSX main folder>\Modules\FSUIPC Documents\Offset Mapping for PMDG 737NGX.pdf
If you can't find this document your version is probably too old.
Putting together events and variables enables you to make more advanced actions for your keys.
Below is the example for the Landing lights which you want to toggle. As you know they are divided into 2 types of light: Retract and Fixed. To decide which position they should be changed to you first need to know their current position. That's what I do in this example. I first read the state of both parts of light and based on that information I turn them all ON or OFF.
Code: Select all
' Put this in the global script routines ' Constants - PMDG Events & Variables Const LTS_LandingLtRetractableSw = &H64F4 ' values from FSUIPC PDF Const LTS_LandingLtFixedSw = &H64F6 Const EVT_OH_LAND_LIGHTS_GUARD = "#69742" Const MOUSE_FLAG_LEFTSINGLE = &H20000000 ' values from PMDG SDK.h Const MOUSE_FLAG_RIGHTSINGLE = &H80000000
Code: Select all
' Put this in the action script of the key L1 = HIDMacros.GetFSUIPCInt(LTS_LandingLtRetractableSw, 2) L2 = HIDMacros.GetFSUIPCInt(LTS_LandingLtFixedSw, 2) if (Round(L1)+Round(L2) > 0) then HIDMacros.FSXEvent EVT_OH_LAND_LIGHTS_GUARD, MOUSE_FLAG_RIGHTSINGLE else HIDMacros.FSXEvent EVT_OH_LAND_LIGHTS_GUARD, MOUSE_FLAG_LEFTSINGLE end if
Hope this helps!