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

Beginner Question

Messages
3
Country
unitedkingdom
I have just started creating XML gauges for FSXA after much reading and experimenting.
My simple first gauge works fine:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Just for experienting -->
<SimBase.Document Type="AceXML" version="1,2" id="XXXGau">
    <Descr>AceXML Document</Descr>
  <Filename>xxxGau.xml</Filename>
  <SimGauge.Gauge id="Gauge" ArtDirectory=".">
      <FloatPosition>0.000,0.000</FloatPosition>
    <Size>500,500</Size>
    <Image id="xxx.bmp" Name="xxx.bmp">
        <Transparent>True</Transparent>
      <Bright>False</Bright>
    </Image>    
    <Element id="Egt">
            <FloatPosition>34.000,50.000</FloatPosition>
            <GaugeText id="GaugeText">
                <BackgroundColor>White</BackgroundColor>
                <Bright>False</Bright>
                <FontColor>DarkBlue</FontColor>
                <FontFace>Segoe Print</FontFace>
                <FontHeight>26</FontHeight>
                <GaugeString>%( (A:GENERAL ENG EXHAUST GAS TEMPERATURE:1, rankine) 491.67 - 1.8 /)%EGT:%!3d!</GaugeString>
                <HorizontalAlign>CENTER</HorizontalAlign>
                <Size>108,34</Size>
                <Transparent>True</Transparent>
            </GaugeText>
    </Element>
  </SimGauge.Gauge>   
</SimBase.Document>

I then noticed that the XMLTools EventHandler.xml has an entirely different structure:
Code:
<Gauge Name="XMLEventHandler" Version="1.0">
<Comment>        By Tom Aguilo May 2014 </Comment>
<Size X="245" Y="270" />
some code
</Gauge>

My questions are: which style of XML should I be using?
And is there a guide to what the elements are called?

Thank you.
 
Both gauges work just fine in FSX with the second gauge code being in FS9 format. What goes in between the elements section is the gauge code iteslf

Code:
<Gauge Name="ADF" Version="1.0">
   <Image Name="radio_display_bckgrnd.bmp"/>
   <Element>
  <Position X="80" Y="20"/>
  <FormattedText
       X="115"
       Y="55"
       Font="Arial Rounded MT Bold"
       FontSize="55"
       LineSpacing="0"
       Adjust="Right"
       Color="White"
       Bright="Yes">
    <String>%((A:ADF ACTIVE FREQUENCY:1, kHz))%!4.0f!</String>
  </FormattedText>
</Element>
</Gauge>
 
The "id=.." tags in <Element>, <Image>, etc...headers are for user readability only. The XML parser doesn't care what an element is called.

There are two distinct styles for XML formatting: FS9's and FSX'.
FS9's, used in Tom's example, is preferred by the majority of developers because it requires less tags to set up which makes the gauge much more readable.
I think FSX' formatting has the advantage that it can be compiled into SimProbBinary (.spb) format, which apparently improves parsing time within the sim and makes decompilation by third parties more difficult (useful for implementing a low-fi copy protection measure).

Both formatting styles work equally well in FSX, but make sure that you stick to one of them and one of them only per XML file.


P.S:
Is your gauge working?
Because the order in the <GaugeString> element looks a bit weird.

FSX also supports a wide array of units. In most cases, you don't have to run an extra conversion.
See here: https://msdn.microsoft.com/en-us/library/cc526981.aspx#Temperature

I do my strings like this:
Code:
<GaugeString>EGT: %((A:GENERAL ENG EXHAUST GAS TEMPERATURE:1, celsius))%!3d! °C</GaugeString>


P.P.S:
If you haven't yet, bookmark the SDK documentation in your web browser. Much handier than the one from the SDK.
https://msdn.microsoft.com/en-us/library/cc526948.aspx
 
Thanks you both for your replies and for the links. Very interesting.
Heretic: Yes, my <GaugeString> works but I prefer yours!
 
Back
Top