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

Strings and % symbols

Messages
10,163
Country
us-arizona
Hey guys,

Quick question. I notice that % is used often in Strings where font will be displayed. Is there a common simplistic rule on how they are used? Are they to be inserted 'everywhere' in gaps or do they have a special basic purpose in their meaning?

Example;
<String>%((A:EXIT OPEN,percent) near 0 ==)%{if}EXIT CLOSED%{else}EXIT OPEN%{end}%</String>

Note how many times the % is used, and how they act as spacers. Are they basically used as spacers because in a String, you do not wish to use Spaces because that would also show up in the font string itself?



Bill O
 
The % symbol when used in a <String> expressions means "evaluate the expression after this symbol."

That's all it means.

The one "special case" is whenever you want to display % IN the string printed to screen, in which case you would use %% (only the second % will be displayed).
 
Last edited:
Not really, Bill. It's not like calculating a complex formula after all...

It's a special symbol that the XML parsing engine can interpret so that it knows how to "translate" the XML script into working C code.

In one sense it could be described as a "break" symbol that effectively serves the same purpose as a blank space in "regular" XML script.
 
In one sense it could be described as a "break" symbol that effectively serves the same purpose as a blank space in "regular" XML script.

Not really... A blank space in normal XML code does nothing, a % character in a Text script is more like a special escape character to tell the gauge that the thing following it is not text but some sort of control script that needs to be interpreted...
 
Thanks guys.

Then I believe I would interpret this to be to add a % symbol on all end caps, front and rear, and surrounding code and text entries (font), as the % symbols identify the code going on when 'encapsulating' by these parcels of font and code.
 
Not really... A blank space in normal XML code does nothing, a % character in a Text script is more like a special escape character to tell the gauge that the thing following it is not text but some sort of control script that needs to be interpreted...

Did you read my post #2 at all, where I provide the precise, technical* answer?

This was an attempt to translate that into simpler to understand, less technical jargon...

The % symbol when used in a <String> expressions means "evaluate the expression after this symbol."

That's all it means.

Aside from which that is simply an incorrect statement you just made, as a "blank space" most certainly is used to delimit constituent parts of a <Code> or <Value> XML expression:

Code:
<Code>(L:T38_FastErect_reset) (P:local time, seconds) &gt; if{ 50 } els{ 0 }</Code>

Code:
<Value>(A:PITOT HEAT,bool) (A:AVIONICS MASTER SWITCH,bool) and if{ 1 } els{ 0 }</Value>
The XML parsing engine uses "blank spaces" when evaluating either of the above statement into it's constituent elements. Remove the "blank spaces" and the parser will throw a hissy fit and won't display the gauge at all... :tongue-ti

The <Script> evaluation is performed by a separate routine in the XML parsing engine which uses % instead of a blank space.

Don't ask me why ACES wrote two entirely separate schemes for parsing XML, because I simply don't know! :)

What I do know is that it's caused no end of grief for everyone though. How idiotic is it that there are two entirely different formats for if and else, just as one example!

if{ xxx } els{ xxx }

versus

%{if}xxx%{else}xxx%{end}

Hell, they couldn't even be consistent with how "else" is spelled! :banghead::banghead::banghead::tapedshut

*NOTE: This is a direct quote given to me by Susan Ashlock, who the Senior Gauge Programmer and last person one to "own" the XML parsing engine.
 
Last edited:
Did you read my post #2 at all, where I provide the precise, technical* answer?


The XML parsing engine uses "blank spaces" when evaluating either of the above statement into it's constituent elements. Remove the "blank spaces" and the parser will throw a hissy fit and won't display the gauge at all... :tongue-ti

I did read it, and I take your point that spaces are critical, especially when not used correctly, but they don't mean anything by themselves. They just space things out correctly so the parser can read the other things.
On the other hand, a % sign in GaugeText is a definite indication that whatever comes next needs to be parsed in a certain way, which is why I would make the distinction between a % and a space. I didn't mean to imply you were wrong, I just thought giving the precisely correct answer and then comparing it to a space was a bit of a mixed metaphor, to me.

Anyway, we're only arguing over semantics on something we can't change...:) The exact whys and wherefores of the two different XML systems are lost to the mists of time, methinks.
 
Eh, it's a bit more than simply semantics. Note that a blank space within a set of parenthesis or curly braces truly means a "blank space." :duck:

Not too long ago I asked Susan about something related to XML in an email exchange...

...I can't repeat her reply in polite company!

Let's just say it would have made a crusty old Marine blush! :rotfl:
 
THAT IS EXACTLY WHY I HAVE blankaphobia

Roy

Ah, I see! Well, it all comes down to understanding when a blank space is "just a blank space" and when it's a "flag" to the parsing engine...

...just remember to always practice safe hex!
 
Ah, I see! Well, it all comes down to understanding when a blank space is "just a blank space" and when it's a "flag" to the parsing engine...

...just remember to always practice safe hex!

lolol....


"Sir, put down the hex and take three steps back... or would that be blank spaces.. arrgh"
 
An easy way to remember where to put them in is to leave one out and then look at the tool tip.

Assuming that the L: variable is equal to 50:

Code:
        <Tooltip>ADI TANK: %((L:WATER_LEVEL1, enum))%!d! GAL</Tooltip>

gives a tooltip of "ADI TANK: 50 GAL"

While this:

Code:
        <Tooltip>ADI TANK: ((L:WATER_LEVEL1, enum))%!d! GAL</Tooltip>

Gives a tooltip something like "ADI TANK: ((L:WATER_LEVEL1, enum)) GAL"

When you see that you say to yourself "Where did I forget the %?" :)

Hope this helps,
 
Back
Top