• 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.

how to detect an event in an XML gauge?

  • Thread starter Thread starter B21
  • Start date Start date

B21

Messages
149
Country
unitedkingdom
Is it possible to detect an event from within an XML gauge?

I've seen mention on the web of the use of a <Keys> section with an <On Event> subsection but as far as I can tell there's no mention of this in the FSX SDK and when I add a Keys section my gauge won't even load...

Here's what I tried:
Code:
<Keys>
  <On Event="SOUND_TOGGLE">1 (>L:MyVar, number)</On>
</Keys>

I need to *detect* the event - I have no problem with triggering an event from within the gauge...

thanks

B21
 
That code will work, but it MUST NOT be within either an <Element> or <Mouse> section.

It must be on the second level of heirarchy:

<Gauge>
...<Element>
...</Element>
...<Mouse>
...</Mouse>
...<Keys>
...</Keys>
</Gauge>

It may come first, last or in the middle... ;)
 
Thanks for this quick reply but there must be something else going on because so far I can't get even the simplest FSX gauge to load with a <Keys> section in it as discussed. It is *something* to do with mixing FS9 and FSX XML I think. E.g. adding *just* this 'Keys' section to this otherwise working test FSX XML gauge will stop it loading (the gauge just displays a background and a single gaugetext item):
Code:
<?xml version="1.0" encoding="UTF-8"?>

<SimBase.Document Type="AceXML" version="1,0" id="test_gauge">
    <Filename>test_gauge.xml</Filename>
    <SimGauge.Gauge id="test">
        <FloatPosition>0.000,0.000</FloatPosition>
        <Size>90,90</Size>
        <Image id="background.bmp" Name="background.bmp">
            <Transparent>True</Transparent>
        </Image>
        <Element id="text2">
            <FloatPosition>20.000,50.000</FloatPosition>
            <GaugeText id="test gaugetext">
                <Size>60,15</Size>
                <FontFace>Verdana</FontFace>
                <FontColor>#202020</FontColor>
                <FontHeight>12</FontHeight>
                <Length>6</Length>
                <GaugeString>%( (L:MyVar, number) )%!d!</GaugeString>
            </GaugeText>
        </Element>
        <Keys>
            <On Event="SOUND_TOGGLE">(L:MyVar, number) 1 + (&gt;L:MyVar, number)</On>
        </Keys>   
    </SimGauge.Gauge>
</SimBase.Document>

While converting the whole gauge to FS9 format (with Keys) loads ok:
Code:
<Gauge Name="test">
        <Image Name="background.bmp"/>
        <Element Name="test">
		<Position X="20" Y="50"/>
		<FormattedText X="50" Y="20" Font="Arial Black" FontSize="13">
			<String>%((L:MyVar, number))%!d!</String>
		</FormattedText>
	</Element>
        <Keys>
            <On Event="SOUND_TOGGLE">(L:MyVar, number) 1 + (&gt;L:MyVar, number)</On>
        </Keys>   
</Gauge>

Thanks again for the help - does this sound familiar or have I gone off-piste???

Basically it seems impossible to add the 'Keys' section to an otherwise working *FSX* XML gauge... does this sound right? Was the 'event monitoring' stuff completely dropped in the migration from FS9 to FSX?

Thanks
B21
 
You know what? I've never actually looked into this before since I still use the FS9 XML Schema for those few guages that I must script in XML...

But, it appears that ACES has depecrated the <Keys> method from the FSX XML Schema...

...at least, none of the example XML scripts (such as the G1000) have any reference to <Keys>, nor does the SDK discuss the topic at all... :eek:

You could of course simply script a small FS9 XML Schema gauge to handle the <Keys> for your FSX XML Schema main gauge.
 
You could of course simply script a small FS9 XML Schema gauge to handle the <Keys> for your FSX XML Schema main gauge.
You are, of course, a genius. Thanks for this great suggestion.

B21
 
Hi,

If you still want to keep FSX style, just try:

Code:
<KeyMap id="KeyMap">
  <Trigger id="Trigger"> 
    <KeyEvent>SOUND_TOGGLE</KeyEvent>
    <Script>(L:MyVar, number) 1 + (&gt;L:MyVar, number)</Script>
  </Trigger>
</KeyMap>

Tom
 
Thanks Tom - I vaguely detected the presence of 'Trigger' while poking around in the system (e.g. the aces tool offers it as an option) but I never worked out if it was kosher. Is there documentation anywhere (stupid question).

Thanks again... B21

edit... Holy Cow it works! I have no idea how you inferred all that Keymap/Trigger/KeyEvent/Script syntax!
 
Last edited:
edit... Holy Cow it works! I have no idea how you inferred all that Keymap/Trigger/KeyEvent/Script syntax!

Well, actually I am an FS XML guru :wizard: so I know everything...and when I don't, at least pretend that I know
:D:D:D:D

Seriously, the key is propgauge.xml, located in propdefs subfolder of main FSX folder. There you'll find XML definitions and properties associated to panel classes though an unique GUID id. If you delete or rename this file, FSX will throw an error and won't load.
Notice you can even change the names of the properties -ie use your native language if not english- and then using the same names in your XML gauge files they will work. You can't however change their ID, or add new properties.
Not much practical, but feasible :)

Tom
 
Back
Top