• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX XML Coding Question

Fly:

The scope of that particular wiki is keyboard traps, <On Key="xx">, and the table at the bottom lists decimal and hex values for the keyboard.

Joystick button and other event traps behave similarly, but need to be written as <On Event="xx">. Pete Dowson provided a list of event codes (Control codes) in the FSUIPC documentation. However, even the FSUIPC list doesn't cover joystick related event codes, but you can use one of the event logger apps to tell which event is fired by which button.

Also take a look at the Events and Traps wiki.

Bob

Manfred - thanks once again for your help on the Events and Traps wiki. I remember that you caught an xml logic error I made in the first draft.
 
Hello. Thank you rpmc for that information. For FS2004, I used Doug Dowson's event logger, and the "Key_Events_Sent.log showed, in part:
By the way, unless I'm missing something, I could not see any button id's until I assigned a button to an FS event. When I assigned button 1 to adf, then I could see the id.

Time=321.927933; id=227; event_in=KEY_AXIS_AILERONS_SET; evdata=-844
Time=321.928003; id=30; event_in=KEY_ADF; evdata=0
Time=321.928016; id=978; event_in=KEY_ATC_MENU_CLOSE; evdata=0
So I tried this:

<Keys>
<On Event="0x30"> (>K:pAUSE_TOGGLE)
</On>
</Keys>

As a test, I added the above to an XML gauge but it did not work. So I tried using FSX using XMLTools and it showed the event was 10019. So I tried this in an FSX XML gauge but no go, and 10019 did not work in the FS2004 XML gauge either. So... 1) Why do the event id's for the same button not match? 2) Why did the XML code using the On Event to "pause" not work?

The values returned by the event logger are decimal, not hex. Also, If you want to use the values returned in a trap, you'll need to add 65536 to them, so you probably want:
Code:
<Keys>
<On Event="65566"> (>K:PAUSE_TOGGLE)
</On>
</Keys>
or
<Keys>
<On Event="0x1001E"> (>K:PAUSE_TOGGLE)
</On>
</Keys>
 
Hello. Thank you for your response. I did try : <On Key="0x30"> and <On Key="0x10019"> (from FSX XMLtools) and it did not work. Which makes sense since On Key is looking for a keyboard input whether it be a decimal or hexadecimal value. It was worth a try :). For DDawson, what is: 65566(d) (= 1001E(h)) ? I do not see that value show up in either of my gauges (event logger or XMLtools). I did try <On Key = "30"> as well, a no go... And why was there a difference of id's between the logger (=30) and XMLTools (=10019) for the same button? Btw DDawson, the only way "your values worked is if I, for example, assigned button 1 to the ADF, which is FS control offset 65566. But this defeats the whole idea of using an XML gauge to directly access a game controller's buttons to control an FS variable/event. When I remove the FS button assignment, then the pausing no longer functions. The logic you provided (and as it worked) was to have the Event "ADF" cause the pause. I do not find that useful. But I do thank you for event logger.
 
Last edited:
Hello. I am pressing Button 1 on a joystick device. When I use event logger, it shows the id as 30; when I use XMLTools, the id is 10019. I tried using <On Key=, <On Event=, variations (hexadecimal and decimal) of 30 and 10019 and could not get the button to pause FS. I must mention that event logger and XMLTools do not show the button event, unless that button is assigned an FS control. FSUIPC shows the button event without any assigning. Of course, the button is later assigned. As I mentioned before, I do not think XML can detect a joystick button directly - unfortunately. Good thing for FSUIPC. :)
 
Back
Top