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

NEWB baffled by this simple XML problem

Messages
238
Country
unitedstates
Okay, I signed up to fix a gauge. I'm new to gauge development so my learning curve is pretty high right now, to say the least. I tried this little experiment to see if I could make some basics work. The first four Elements all have a Visibility condition. Only the first one works. The other 3 never become visible. The last element (has no Visibility condition) is just to display what the DTRANSMODE variable is set to (it's always 0,1,2, or 3) and when I click a button it increments and, when it goes above 3 I reset it back to 0. Each time it is 0 I see the "PRESSURE ALT" and then it goes to 1,2,3... and nothing is displayed. There must be something really basic that I'm missing.

Really appreciate any help.

Gregg

EDIT: Here's what I see:
DTRANSMODE=0
WxDHHMF.png

DRANSMODE=1
xiDKUWU.png


I even set it to 1 using LINDA just to make sure it's exactly 1. In the second screen you can see the value of DTRANSMODE is 1 and yet FLIGHT TIME is not displayed.

EDIT2: Well, I find this bizarre. If I do this to the string to be displayed then it works (albeit with an extra unwanted number at the end)...

Change
%FLIGHT TIME%
to
FLIGHT TIME %((L: DTRANSMODE,number))%!d!

Code:
<Element>
  <Visible>(L:DTRANSMODE,number) 0 == </Visible>
  <Position X="555" Y="40"/>
  <Text X="190" Y="220" Length="13" Font="Glass Gauge" FontSize="28" Bold="True" Adjust="Center" Color="#e8e65f" Bright="Yes" Fixed="Yes">
    <String>%PRESSURE ALT%</String>
  </Text>
</Element>

<Element>
  <Visible>(L:DTRANSMODE,number) 1 == </Visible>
  <Position X="555" Y="40"/>
  <Text X="190" Y="220" Length="13" Font="Glass Gauge" FontSize="28" Bold="True" Adjust="Center" Color="#e8e65f" Bright="Yes" Fixed="Yes">
    <String>%FLIGHT TIME%</String>
  </Text>
</Element>

<Element>
  <Visible>(L:DTRANSMODE,number) 2 == </Visible>
  <Position X="555" Y="40"/>
  <Text X="190" Y="220" Length="13" Font="Glass Gauge" FontSize="28" Bold="True" Adjust="Center" Color="#e8e65f" Bright="Yes" Fixed="Yes">
    <String>%COUNT UP%</String>
  </Text>
</Element>

<Element>
  <Visible>(L:DTRANSMODE,number) 3 == </Visible>
  <Position X="555" Y="40"/>
  <Text X="190" Y="220" Length="13" Font="Glass Gauge" FontSize="28" Bold="True" Adjust="Center" Color="#e8e65f" Bright="Yes" Fixed="Yes">
    <String>%COUNT DOWN%</String>
  </Text>
</Element>

<Element>
  <Position X="555" Y="60"/>
  <Text X="190" Y="220" Length="13" Font="Glass Gauge" FontSize="28" Bold="True" Adjust="Center" Color="#e8e65f" Bright="Yes" Fixed="Yes">
    <String>%((L:DTRANSMODE,number))%!d!</String>
  </Text>
</Element>
 
Last edited:
I assume this is FSX? If so, under certain conditions multiple Visibility lines will not display. Works fine in FS9 though. I assume it is a bug.

To avoid this, you can either use Formatted Text, or nest all of your display Elements within a single Element that contains a single Visibility line.

Here is an example from a gauge of mine. It is only displayed when L:AC_Type, number equals 0. Then it displays one of two pages of text, depending on the value of variable G:Var8. For your example, it displays the text Full Throttle if the variable L:WATER_1, bool) equals 1. There are other lines that depend on more than one variable. I also include other lines that show how I can change the color of text {clr2} and change it back {clr1}.

Code:
<Element> <!-- Type 1 -->
<Position X="@XPOS1" Y="80"/>
<Visible> (L:AC_Type, number) 0 == </Visible>
<FormattedText X="228" Y="500" Font="@FONT_TRG" Adjust="left" FontSize="14"
Tabs="0" LineSpacing="18" Color="#222222" Bright="Yes">
<Font FontSize="20"/>
<Font FontSize="15"/>
<Font FontSize="10"/>
<Color Value="#FF0000"/>
<Color Value="red"/>
<Color Value="#ff00ff"/>
<String>
%((G:Var8) 0 == )%{if}<!-- Page 1 -->
Takeoff: Flaps 1, 1.7&#176; Trim UP,\n
%((L:WATER_1,bool) 1 == ) %{if}Full Throttle\n%{end}
%((A:Sim on Ground, bool) (L:WATER_1,bool) 0 == &amp;&amp; )%{if}\{clr2}No ADI  53" MAP\{clr1}\n%{end}
%((A:Sim on Ground, bool) ! (L:WATER_1,bool) 0 == &amp;&amp; )%{if}No ADI  53" MAP\n%{end}
%((L:supercharger control 1,bool) 1 == (A:Indicated Altitude, feet) 7200 &gt; || )%{if}HI Sprchrgr: 2600 RPM, CF MID %{else}Props full fine, CF MID %{end}\n
%((A:Total Weight, pounds) @MTOW &gt; )%{if}\{clr2}%{end}Rotate at %((G:Var1))%!3d! KIAS, &#171;= 500 fpm\{clr1}\n
%{end}
%((G:Var8) 1 == )%{if}<!-- Page 2 -->
Descent: 2300 RPM, CF Clsd\n
Reduce MAP by 3" per minute\n
%((A:Airspeed Indicated, knots) (A:Airspeed barber pole,knots) &gt; )%{if}\{clr2}%{end}Do not exceed %((A:Airspeed barber pole,knots))%!3d! KIAS\{clr1}\n
&#187;23" MAP, &#171;25" MAP 2100 RPM, &#187;21" MAP \n
Arrival: 2100 RPM, 170 KIAS, CF Clsd\n
Holding: 2100 RPM, &#171;173 KIAS\n
Approach: &#171;155 KIAS: Flaps 1\n
%{end}
</String>
</FormattedText>
</Element>

I have shortened each of the two pages for brevity. &#171; is less than, &#187; is greater than, &#176; is the degree symbol. \n means go to the next line. Macros are used to control the font and position. You don't need anything this fancy; something like the code below should take care of all but the last Element (that can remain separate to have its own Position statement). Not tested.

Code:
<Element> <!--DTransmode -->
<Position X="555" Y="40"/>
<FormattedText X="190" Y="220" Length="13" Font="Glass Gauge" FontSize="28" Bold="True" Adjust="Center" Color="#e8e65f" Bright="Yes" Fixed="Yes">
<String>
%((L:DTRANSMODE,number) 0 == ) %{if}%PRESSURE ALT%\n%{end}
%((L:DTRANSMODE,number) 1 == ) %{if}%FLIGHT TIME%\n%{end}
%((L:DTRANSMODE,number) 2 == ) %{if}%COUNT UP%\n%{end}
%((L:DTRANSMODE,number) 3 == ) %{if}%COUNT DOWN%\n%{end}
</String>
</FormattedText>
</Element>

Hope this helps,
 
Thanks for the reply. I'll do some studying there. Yes, it's FSX. The bug (if that's what it is) in this isolated condition seems to be...

if you compare a variable to a constant (any nonzero constant 1, 2, etc.) or there's nothing evaluated in the display string then nothing is displayed. (For example, if I compare the variable to the variable in the Visibility tag, it also displays the string.)

Seems that it has a threshold of work that it wants to do inside an element before it will do what is wanted. I wonder how many more of those little things await me as I delve further.

I need to ask something more basic. When I went through the doc pages for XML gauges it didn't say anything about Text fields even though I see folks using them...only GaugeText. Also didn't see anything about FormattedText. Seems they work but there's some things I'm, obviously, missing?

EDIT: Your code worked pretty flawlessly.
 
Last edited:
Hi,

I had many simular display problems when I started to use my FS9 gauges using a Visibility tag, in FSX.
What solved it for me: use the Text or displayed bitmap in an additional nested Element.

So like:
Code:
<Element>
  <Visible>(L:DTRANSMODE,number) 3 == </Visible>
  <Position X="555" Y="40"/>
 
  <Element>
       <Text X="190" Y="220" Length="13" Font="Glass Gauge" FontSize="28" Bold="True" Adjust="Center" Color="#e8e65f" Bright="Yes" Fixed="Yes">
          <String>%COUNT DOWN%</String>
       </Text>
   </Element>
</Element>
Don´t ask me why, but when doing this I never had the problem again after using the addition Element.

Rob
 
Um, the % symbols aren't used in <String> statements for "straight ASCII text." They are only used when something following one has to be "evaluated" (which is what the % means).

Here is my Pressure Altitude Page from my version of the GTX330. Notice especially the <String>PRESSURE ALT</String> entry, as well as the use of "nested" <Element>s:
Code:
      <!--  PRESSURE ALT PAGE -->
      <Element>
         <Visible>(L:Func,enum) 0 ==</Visible>
         <Element>
            <Position X="320" Y="32"/>
            <Text X="60" Y="60" Bright="Yes" Length="4" FontSize="26" Font="DS-Digital Bold" Color="#EC802F" Adjust="Right" Fixed="Yes" VerticalAdjust="Center" Multiline="No">
               <String>%((L:prsralt,bool))%{if}%((A:Pressure Altitude, feet) 100 / 1 +)%!03d!%{end}</String>
            </Text>
         </Element>
         <Element>
            <Position X="210" Y="24"/>
            <Text X="250" Y="120" Length="12" FontSize="15" Font="DS-Digital Bold" Adjust="Center" VerticalAdjust="Center" Color="#EC802F" Bright="Yes">
               <String>PRESSURE ALT</String>
            </Text>
         </Element>
         <Element>
            <Position X="180" Y="55"/>
            <Text X="250" Y="80" Length="2" FontSize="15" Font="DS-Digital Bold" Adjust="Center" VerticalAdjust="Center" Color="#EC802F" Bright="Yes">
               <String>FL</String>
            </Text>
         </Element>
         <Element>
            <Select>
               <Value>(L:PrAlt,bool) 1 == if{ 0 (&gt;L:PrAlt,bool) }</Value>
            </Select>
         </Element>
         <Element>
            <Position X="380" Y="55"/>
            <Visible>(A:Vertical Speed,feet per minute) 100 &gt;</Visible>
            <Polygon FillColor="#EC802F" Bright="Yes">
               <Point X="3" Y="0"/>
               <Point X="6" Y="3"/>
               <Point X="4" Y="3"/>
               <Point X="4" Y="15"/>
               <Point X="2" Y="15"/>
               <Point X="2" Y="3"/>
               <Point X="0" Y="3"/>
               <Point X="3" Y="0"/>
            </Polygon>
         </Element>
         <Element>
            <Position X="380" Y="55"/>
            <Visible>(A:Vertical Speed,feet per minute) -100 &lt;</Visible>
            <Polygon FillColor="#EC802F" Bright="Yes">
               <Point X="2" Y="0"/>
               <Point X="4" Y="0"/>
               <Point X="4" Y="12"/>
               <Point X="6" Y="12"/>
               <Point X="3" Y="15"/>
               <Point X="0" Y="12"/>
               <Point X="2" Y="12"/>
               <Point X="2" Y="0"/>
            </Polygon>
         </Element>
      </Element>
 
Um, the % symbols aren't used in <String> statements for "straight ASCII text." They are only used when something following one has to be "evaluated" (which is what the % means).

Here is my Pressure Altitude Page from my version of the GTX330. Notice especially the <String>PRESSURE ALT</String> entry, as well as the use of "nested" <Element>s:
Code:
      <!--  PRESSURE ALT PAGE -->
      <Element>
         <Visible>(L:Func,enum) 0 ==</Visible>
         <Element>
            <Position X="320" Y="32"/>
            <Text X="60" Y="60" Bright="Yes" Length="4" FontSize="26" Font="DS-Digital Bold" Color="#EC802F" Adjust="Right" Fixed="Yes" VerticalAdjust="Center" Multiline="No">
               <String>%((L:prsralt,bool))%{if}%((A:Pressure Altitude, feet) 100 / 1 +)%!03d!%{end}</String>
            </Text>
         </Element>
         <Element>
            <Position X="210" Y="24"/>
            <Text X="250" Y="120" Length="12" FontSize="15" Font="DS-Digital Bold" Adjust="Center" VerticalAdjust="Center" Color="#EC802F" Bright="Yes">
               <String>PRESSURE ALT</String>
            </Text>
         </Element>
         <Element>
            <Position X="180" Y="55"/>
            <Text X="250" Y="80" Length="2" FontSize="15" Font="DS-Digital Bold" Adjust="Center" VerticalAdjust="Center" Color="#EC802F" Bright="Yes">
               <String>FL</String>
            </Text>
         </Element>
         <Element>
            <Select>
               <Value>(L:PrAlt,bool) 1 == if{ 0 (&gt;L:PrAlt,bool) }</Value>
            </Select>
         </Element>
         <Element>
            <Position X="380" Y="55"/>
            <Visible>(A:Vertical Speed,feet per minute) 100 &gt;</Visible>
            <Polygon FillColor="#EC802F" Bright="Yes">
               <Point X="3" Y="0"/>
               <Point X="6" Y="3"/>
               <Point X="4" Y="3"/>
               <Point X="4" Y="15"/>
               <Point X="2" Y="15"/>
               <Point X="2" Y="3"/>
               <Point X="0" Y="3"/>
               <Point X="3" Y="0"/>
            </Polygon>
         </Element>
         <Element>
            <Position X="380" Y="55"/>
            <Visible>(A:Vertical Speed,feet per minute) -100 &lt;</Visible>
            <Polygon FillColor="#EC802F" Bright="Yes">
               <Point X="2" Y="0"/>
               <Point X="4" Y="0"/>
               <Point X="4" Y="12"/>
               <Point X="6" Y="12"/>
               <Point X="3" Y="15"/>
               <Point X="0" Y="12"/>
               <Point X="2" Y="12"/>
               <Point X="2" Y="0"/>
            </Polygon>
         </Element>
      </Element>

Thanks Bill. Yeah, I was trying, pretty much, everything to figure it out. Stupid stuff.

So, essentially, you've already done what I'm trying to fix (the one I'm working on is a pure XML GTX327 with a small hack in it, but it's broken-ware). It'd be a nice little unit if it's actually functional. Is your version public or do I need to continue down this stuttering road?

Thanks,
Gregg
 
Thanks Bill. Yeah, I was trying, pretty much, everything to figure it out. Stupid stuff.

So, essentially, you've already done what I'm trying to fix (the one I'm working on is a pure XML GTX327 with a small hack in it, but it's broken-ware). It'd be a nice little unit if it's actually functional. Is your version public or do I need to continue down this stuttering road?

Thanks,
Gregg
Well, this is a GTX330, but perhaps it will do for your purposes. I also included an illustrated version of the manual that I wrote for Eaglesoft many years ago. Since I've used this same gauge in at least one freeware project, I don't mind sharing it at all. :wave:

NOTA BENE: The audio cues are not part of this gauge, so you won't hear any of them. Also, the sb3gaugebridge.dll (not included) is required for VATSIM or IVAO compatibility.
 

Attachments

Last edited:
Well, this is a GTX330, but perhaps it will do for your purposes. I also included an illustrated version of the manual that I wrote for Eaglesoft many years ago. Since I've used this same gauge in at least one freeware project, I don't mind sharing it at all. :wave:

Thanks! First blush, it's a d*mn sight better than what I was starting with. Most of the stuff already works in this plane. It'll be a nice exercise to figure out the rest, Also, it'll be nice to study this code.

Gregg
 
Here is the original post from Tom that describes the extra Element technique:

http://www.fsdeveloper.com/forum/threads/string-element-and-visible-tag-issues-in-fsx.208210/

I learned some of how Formatted Text works by reading this blog:

http://blogs.technet.com/b/engauged/

It also has several posts on text in gauges.

Here is an example:

http://blogs.technet.com/b/engauged/archive/2006/12/08/text-in-xml-gauges-part-iii.aspx

Another source of information on Formatted Text is the gauge by Jan (#6) in these tutorials:

http://www.fs2x.com/Tutorials.htm

And right here in the Wiki:

http://www.fsdeveloper.com/wiki/index.php?title=XML:_Escape_Sequences

Hope this helps,
 
Back
Top