XML Gauge Text, Part III: Mind your %’s and (‘s

It looks like a common mistake made by people creating XML gauges is to use too many percent signs (%).  For example, I saw this in a 3rd-party gauge recently:


The underlined percent signs are unnecessary, and the parser will try to translate the "On" and "Off" as an expression that can be calculated.  Recall that "%( )" is used to calculate expressions; for example:

%((A:Eng1 Oil Pressure, PSF) 20 <)

would equate to TRUE or FALSE and could be used with the %{if} conditional above to conditionally display text.

Thus, the 3rd-party gauge should have used:


This above information is also covered in the SDK, an excerpt of which is pasted below:

Conditional Gauge Strings

The format of conditions (if, then, else, and case statements) in gauge strings is different from that in other scripts. In gauge strings use the %{if}, %{else}, and %{end} constructs to choose which text to display.  Note that these keywords are case-sensitive and must be typed in lowercase. Also, there must not be a space between the ‘%’ and the ‘{‘. An if statement can be used without a corresponding else, in which case nothing is displayed if the result of the condition is false. The syntax for usage is one of the following:


Comments (5)

  1. Anonymous says:

    Great post, explained really well and I could really understand. Thank you.

  2. Tom Aguilo says:

    Hi Susan, thank you for the clarification.

    I believe the misunderstanding exists because of the mode a var value is commonly displayed:

    %((MyVar) > 0)%!d!

    It could be "separated" in

    %((MyVar) > 0) and %!d!

    So it’s important to highlight also that

    !operator! formatting must be preceeded by a % like

    %!s! or %!02d! or %!3.1f!

    I think this is not properly explained in SDK



  3. Geoff_D says:

    I have a Macro  to set a color  dependant on the RADIO HEIGHT  of a Selected Aircraft

    <Macro id="LowAltitudeBackgroundColor" Name="LowAltitudeBackgroundColor">

               <MacroValue>%((C:ITrafficInfo:S:RADIO HEIGHT, feet) 100 &lt;)%{if}0x801010%{else}0x101080%{end}</MacroValue>






    displays either of the correct values,  according to  the "Radio Height"



    placed just before the GaugeString  line doe NOT result in the correct colour background.

    It is  "Rust Brown",  no matter what  the RADIO HEIGHT is  setting the Macro result to.

    "Driving me crazy"  — can you tell me what I am doing wrong please   🙂


  4. Peter Dooley says:


    I need to set up a <Visible> statement that evaluates (A:GPS APPROACH APPROACH ID, string) against a set of pre-defined strings such as ‘VOR 21’ ‘LOC 31’ etc. Please could you help me with the syntax required for the string ‘VOR 21’



Skip to main content