Jump to content
The simFlight Network Forums

Search the Community

Showing results for tags 'events'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Product Support Forums
    • FSUIPC Support Pete Dowson Modules
    • MyTraffic Support Forum
    • FeelThere Support Forums
    • FS Commander Support Forum
    • Flying W Simulation
    • AConstable Traffic Sounds Support Forum
    • Fabio Merlo Products Support Forum
    • Elite-Air Studio Support Forum
    • Nikola Jovanovic Support Forum
    • Intrasystems Support Forum
    • Taburet & DanVFR Support Forum
    • Environ Scenery
  • simFlight DE
  • simRussia


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 2 results

  1. Hi, A question for Pete and John: Is it by intention, that the registration of an event immediately fires the related function, although the event didn't occur? I made a small sample module for easy testing. I just monitored the COM1 offset for changes and traced the firing of the related function. In my function I also tracked, if the function is called the first time or if it has already be run. Here is the simple module: -- Test event.offset function with COM1 offset ipc.log("---------------------------------") local vFirstRun = 0 ipc.log("vFirstRun = 0") function LogCOM1(offset, value) -- react on FSX Input ipc.log("Start LogCOM1") if vFirstRun == 1 then ipc.log( string.format( "1%02X.%02X", math.floor( ipc.readUW(0x034E)/256 ) , ipc.readUW(0x034E) % 256 ) ) else -- first run due to event registration done - now code can be activated vFirstRun = 1 ipc.log("vFirstRun = 1") end ipc.log("Leave LogCOM1") end -- track every change of the COM1 offset ipc.log("Define event") event.offset( 0x034E, "UW", "LogCOM1" ) ipc.log("Event defined") That's what i find in the log: ********* FSUIPC6, Version 6.1.4 (28th July 2021) by Pete & John Dowson ********* Prepar3D.exe version = Running inside Prepar3D v5 Module base=7FFE660E0000 Windows 10 Home 64 Bit reported as Build 19043, Release ID: 2009 (OS 10.0) Reading options from "C:\Users\Reinhard\Documents\Prepar3D v5 Add-ons\FSUIPC6\FSUIPC6.ini" Checking the Registrations now ... User Name="xxx" User Addr="xxx" FSUIPC6 Key is provided WideFS7 Key is provided 0 System time = 28/08/2021 18:34:39 0 FLT UNC path = "\\PC-P3D\P3D_Files\" 0 NOTE: configuring for no weather reads or writes! 0 Using DialogMode 16 FS UNC path = "\\PC-P3D\P3Dv5\" 79 Finished: 0 Profile files created 79 ---------------------- Joystick Device Scan ----------------------- 94 Product= JoyWarrior A8-8 94 Manufacturer= Code Mercenaries 94 Vendor=07C0, Product=1104 (Version 16.48) 110 GUIDs returned for product: VID_07C0&PID_1104: 110 GUID= {BABB2690-FB55-11E9-8001-444553540000} 110 Details: Btns=8, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U0,V0,X241,Y127,Z127 110 Product= TQ6 125 Manufacturer= GoFlight 125 Serial Number= 00080 7 125 Vendor=09F3, Product=0200 (Version 2.0) 125 GUIDs returned for product: VID_09F3&PID_0200: 125 GUID= {CE023EC0-9A8D-11E8-800E-444553540000} 125 Details: Btns=4, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R221,U216,V221,X220,Y221,Z214 125 Product= Saitek Pro Flight Yoke 125 Manufacturer= Saitek 125 Vendor=06A3, Product=0BAC (Version 3.2) 125 GUIDs returned for product: VID_06A3&PID_0BAC: 125 GUID= {CDFBFD30-9A8D-11E8-800C-444553540000} 125 Details: Btns=23, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U255,V255,X1023,Y1023,Z255 125 Product= Saitek Pro Flight Rudder Pedals 125 Manufacturer= Saitek 125 Vendor=06A3, Product=0763 (Version 1.0) 125 GUIDs returned for product: VID_06A3&PID_0763: 125 GUID= {CDFBFD30-9A8D-11E8-800B-444553540000} 125 Details: Btns=0, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R511,U0,V0,X127,Y127,Z0 125 ------------------------------------------------------------------- 125 Device acquired for use: 125 Joystick ID = 3 (Registry okay) 125 3=JoyWarrior A8-8 125 3.GUID={BABB2690-FB55-11E9-8001-444553540000} 125 Device acquired for use: 125 Joystick ID = 2 (Registry okay) 125 2=TQ6 125 2.GUID={CE023EC0-9A8D-11E8-800E-444553540000} 125 Device acquired for use: 125 Joystick ID = 0 (Registry okay) 125 0=Flight Yoke System 125 0.GUID={CDFBFD30-9A8D-11E8-800C-444553540000} 125 Device acquired for use: 125 Joystick ID = 1 (Registry okay) 125 1=Saitek Pro Flight Rudder Pedals (USB) 125 1.GUID={CDFBFD30-9A8D-11E8-800B-444553540000} 125 ------------------------------------------------------------------- 438 Controllers are set to ON, using RawInput within P3D 438 LogOptions=00000000 00000001 438 ------------------------------------------------------------------- 438 SimConnect_Open succeeded: waiting to check version okay 438 Opened separate AI Traffic client okay 8891 Running in "Lockheed Martin® Prepar3D® v5", Version: (SimConnect: 8891 Initialising SimConnect data requests now 8891 FSUIPC Menu entry added 8907 ... Using Prepar3D with Professional License 8922 \\PC-P3D\P3D_Files\P3D.fxml 8922 \\PC-P3D\P3D_SimObj\Airplanes\mjc8q400\MJC8Q4.air 9219 ### The user object is 'MJC8Q400_AUA_OE-LGM' 9219 ### Mode: FREEZE_ATT on FREEZE_ALT on FREEZE_LATLON on 14563 Monitor IPC:311E (U16) = 0 14579 ### Mode: PAUSE on 116422 Loading Complete ... 116438 ### Mode: PAUSE off 116922 User Aircraft ID 1 supplied, now being used 116922 Aircraft loaded: running normally now ... 116969 Monitor IPC:311E (U16) = 5664 116969 SimRead: 311E="NAV STANDBY FREQUENCY:1" INT32: 5664 (0x00001620) 117000 Exception 3 "UNRECOGNIZED_ID", Ref 2898, Index param 1 on write SetData for "RECIP ENG FUEL FLOW:1" 117000 Exception 3 "UNRECOGNIZED_ID", Ref 2899, Index param 1 on write SetData for "RECIP ENG FUEL FLOW:2" 117000 Exception 3 "UNRECOGNIZED_ID", Ref 2900, Index param 1 on write SetData for "RECIP ENG FUEL FLOW:3" 117532 System time = 28/08/2021 18:36:37, Simulator time = 10:00:02 (08:00Z) 117766 Aircraft="MJC8Q400_AUA_OE-LGM" 123547 -------------------- Starting everything now ---------------------- 123547 Starting WideServer now ... 123563 Using "C:\Program Files (x86)\GoFlight\GFDEV64.DLL", version 123563 GoFlight GFT8 detected: 1 device 123563 GoFlight GF166 detected: 5 devices 123563 GoFlight GFRP48 detected: 2 devices 123563 GoFlight GF46 detected: 1 device 123563 GoFlight GFTQ6 detected: 1 device 123563 GoFlight GFLGT2 detected: 1 device 123563 GoFlight GFMCPPRO detected: 1 device 123563 GoFlight GFEFIS detected: 2 devices 123563 GoFlight GFWP6 detected: 2 devices 123625 Run: ""C:\Users\Reinhard\AppData\Local\vPilot\vPilot.exe" "-host"" 123625 Affinity Mask set to 20 [x14], "vPilot.exe" 123625 ASN active function link set 123625 Ready for ActiveSky WX radar with additional data : : Here comes the debug log with logging on for offset 0x034E (=COM1) : 8030250 LUA.74: --------------------------------- 8030250 LUA.74: vFirstRun = 0 8030250 LUA.74: Define event 8030266 LUA.74: Event defined 8030266 LUA.74: Start LogCOM1 8030266 LUA.74: vFirstRun = 1 8030266 LUA.74: Leave LogCOM1 8035625 Monitor IPC:034E (U16) = 13376 8035625 SimRead: 034E="COM ACTIVE FREQUENCY:1" INT32: 13376 (0x00003440) 8035625 LUA.74: Start LogCOM1 8035625 LUA.74: 134.40 8035641 LUA.74: Leave LogCOM1 So as you can see, the function is fired immediately, when I register the offset, although frequencydid not change. I would have expected, that it fires, if the frequency changes for the first time. Later I switched frequencies and then it fires the second time and by that logs the frequency. As a consequence I would have now to add similar code to all my event functions, to avoid firing during the event registration process. Maybe you can check, if this behaviour is by intention. I had already in the past the feeling, that this happens, but did not consequently trace it down. As I currently have massive problems, where events are not registered although they are defined in the same way since many years, I try to nail my problem down. During these investigations (see thread: https://forum.simflight.com/topic/92801-p3d-52-lua-event-handling-not-reliable/ ) I came across this issue. If this is always working for all type of events in that way, I can add code to my modules, to avoid this firing. But before doing this, I want to be sure, if this behaviour is planned. Thanks in advance. Reinhard
  2. Background PMDG Aircraft for FSX and P3D do not typically use the normal controls provided by the flight sim. This means that many of the aircraft's switches cannot be assigned to buttons and keys using the list of controls in the FSUIPC dropdown boxes. Assigning a standard control in FSUIPC will likely do nothing in the PMDG aircraft when the button or key is pressed. Solution Instead of using the standard list of controls shown in the FSUIPC dropdown box, users must use a different set of controls provided by PMDG for the specific aircraft. These are known as custom controls (or custom events). The custom controls vary for each aircraft and are listed in the SDK that is installed alongside the aircraft. This guide will show you, step-by-step: How to find the SDK files How to calculate the custom control numbers How to work out the parameter value How to assign the control to buttons/keys in FSUIPC The specific examples shown will be taken from the PMDG 737NGX, but the same method works for any PMDG aircraft with an SDK and custom controls (e.g. 777, 747). 1. Locating the SDK From your main Flight Sim install folder, open the PMDG folder. Then select the folder belonging to the aircraft you want to use. e.g. PMDG 737 NGX Then select the SDK folder Locate the file with the .h extension. For the 737 it's called PMDG_NGX_SDK.h You can open this file with Notepad or your favourite text editor. As an example, the document you need for the 737 will be: [FlightSimInstallFolder]\PMDG\PMDG 737 NGX\SDK\PMDG_NGX_SDK.h 2. Calculating the control numbers 2.1. Find THIRD_PARTY_EVENT_ID_MIN The first thing to find is the definition of THIRD_PARTY_EVENT_ID_MIN. Search for the following text: #define THIRD_PARTY_EVENT_ID_MIN You will find a line like this (from the 737 file): #define THIRD_PARTY_EVENT_ID_MIN 0x00011000 // equals to 69632 Note the decimal value at the end. In the case above it's 69632. You will need this value to calculate the control number in the next step. 2.2. Find the control you want to use. Search for the control by name, or look through the listed controls to find the one you want. They are helpfully grouped together by panel. The controls are listed under a comment: // Control Events You can search for this to find where the list of control numbers starts. As an example we'll use the Autopilot CMD A swtich on the MCP. This is the relevant line in the 737 SDK: #define EVT_MCP_CMD_A_SWITCH (THIRD_PARTY_EVENT_ID_MIN + 402) To calculate the control number for this switch we just add 402 to the value of THIRD_PARTY_EVENT_ID_MIN we found earlier. 69632 + 402 = 70034 We have now calculated the control number. We will use this in step 4 to program the button/key. 3. Finding the parameter value PMDG controls need a parameter value which represents what type of mouse click to simulate for the particular switch. Mainly it will be the left mouse button, but other clicks types are available (e.g. Right button, left double click etc). To find the codes for each type of click, search for MOUSE_FLAG You'll find a block of #define statements for each type of mouse click. Here are a couple of examples from the 737 sdk: #define MOUSE_FLAG_RIGHTSINGLE 0x80000000 #define MOUSE_FLAG_LEFTSINGLE 0x20000000 Find the click that you want to simulate and get the code. For example, we'll have our key assignment simulate the left mouse button clicking on the CMD A autopilot button. So we'll need 0x20000000 as the parameter value for the control. Now we have the control number and parameter value. 4. Assigning the control to a button or key in FSUIPC Select the [buttons + swtiches] or [key presses] tab in FSUIPC and select the button or key to program. From the "control sent..." dropdown select <custom control> (it's near the top of the list) A popup window appears asking for the control number. Type in the control number you calculated in step 2. For our 'autopilot CMD A' example, we enter 70034 and click OK. The controls dropdown box will now show the control number in angled brackets. In the "parameter" box (below the controls dropdown), enter the mouse code from step 3. Do not include the first 0 from the number listed in the PMDG SDK. Start with the x. With our example, we would enter x20000000 for the left-button single-click. Note that this code is in hexadecimal. FSUIPC will convert it to the equivalent decimal value. This is nothing to worry about. It's the same number. Entering the value in Hex is more convenient. If you're programming a key press, remember to press the [confirm] button. Here is our example control assigned to a button in FSUIPC: Your button or key press should now operate the switch in your PMDG aircraft.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.