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

Gauge String - CASE example

Messages
497
Country
unitedstates
This is driving me crazy !!

<GaugeString>%(8)%{case}%{ :4 }RAIN%{ :8 }SNOW%{end}</GaugeString>

Should Display SNOW, but instead, displays NOTHING.

-----------
Once I do get the above to work, what I am really trying to do is display RAIN or SNOW or NOTHING, dependant upon

AMBIENT PRECIP STATE Precip state (bit field) Mask
2 = None
4 = Rain
8 = Snow


How do I Ievaluate the above to be 8, 4 or 2 ( and mabe 12 ? RAIN & SNOW)

Do I have to 'AND' the mask with 15, or can I use the mask directly ?

Final result should be a GaugeString, that displays "SNOW" or "RAIN" or ""

-----
Any help or example would be greatly appreciated. Thanks

Geoff
 
This is driving me crazy !!

<GaugeString>%(8)%{case}%{ :4 }RAIN%{ :8 }SNOW%{end}</GaugeString>

Should Display SNOW, but instead, displays NOTHING.
-----
Any help or example would be greatly appreciated. Thanks

Geoff

First, let's examine a prototype of the proper syntax. <String> XML syntax is entirely different from "normal gauge" XML syntax, as it uses a different schema.

This prototype is for a <FormattedText>...</FormattedText> element. Simply substitute <GaugeString>...</GaugeString> for a "regular" string element:

Code:
<String>
  %((variable,units))
  %{case}
  %{:n}ASCII Text
  %{:nn}ASCII Text
  %{end}
</String>
Note that every element begins with the % symbol, which means "evaluate what follows."

The first element contains the variable to be evaluated, contained within two sets of parenthesis!

The second element contains the flag case, contained within curly braces.

The subsequent element(s) contain the case number(s) contained between curly braces (no spaces!), followed by the ASCII Text* to be displayed.

The final element is an end flag to signal that the evaluation is completed.

While it isn't strictly necessary to format the script as I have, I've found that it makes the entire expression so much easier to see and debug!
=========================

Now for your specific script, here's something that should work out of the box:

Code:
<GaugeString>
  %((A:AMBIENT PRECIP STATE,enum))
  %{case}
  %{:2} 
  %{:4}Rain
  %{:8}Snow
  %{end}
</GaugeString>

*Nota bene: a variable could also be displayed instead of fixed ASCII text.
 
Last edited:
First, let's examine a prototype of the proper syntax. <String> XML syntax is entirely different from "normal gauge" XML syntax, as it uses a different schema.

This prototype is for a <FormattedText>...</FormattedText> element. Simply substitute <GaugeString>...</GaugeString> for a "regular" string element:

Code:
<String>
  %((variable,units))
  %{case}
  %{:n}ASCII Text
  %{:nn}ASCII Text
  %{end}
</String>
Note that every element begins with the % symbol, which means "evaluate what follows."

The first element contains the variable to be evaluated, contained within two sets of parenthesis!

The second element contains the flag case, contained within curly braces.

The subsequent element(s) contain the case number(s) contained between curly braces (no spaces!), followed by the ASCII Text* to be displayed.

The final element is an end flag to signal that the evaluation is completed.

While it isn't strictly necessary to format the script as I have, I've found that it makes the entire expression so much easier to see and debug!
=========================

Now for your specific script, here's something that should work out of the box:

Code:
<GaugeString>
  %((A:AMBIENT PRECIP STATE,enum))
  %{case}
  %{:2} 
  %{:4}Rain
  %{:8}Snow
  %{end}
</GaugeString>

*Nota bene: a variable could also be displayed instead of fixed ASCII text.

Hmmm

My Example looks IDENTICLE to yours

<GaugeString>%(8)%{case}%{ :4 }RAIN%{ :8 }SNOW%{end}</GaugeString>

ie

<GaugeString>
%(8)%{case}
%{ :4 }RAIN
%{ :8 }SNOW
%{end}
</GaugeString>


You had

<String>
%((variable,units))
%{case}
%{:n}ASCII Text
%{:nn}ASCII Text
%{end}
</String

Only Difference I can see is that I had a SPACE before each : and anothe one after each number. Are those spaces REALLY messing it up !!!!

Will try with no spaces and see.

And yes, your Formatting makes it a LPOT easier to read :) Thanks

Geoff
 
Only Difference I can see is that I had a SPACE before each : and anothe one after each number. Are those spaces REALLY messing it up !!!!

Will try with no spaces and see.

And yes, your Formatting makes it a LPOT easier to read :) Thanks

Geoff

Yes, it is in fact the SPACES that killed your script. That's all.

But, I wanted to take the opportunity to "'splain the whole 'ting..."

I subscribe to the philosophy that it's better to teach someone to fish, rather than simply hand 'em a fish! Although there are times when I'm sorely tempted to slap 'em with a cold cod a' la Month Python!!! :rotfl:

HINT: When pasting code or script in the forums, add a code tag (the # button on the editor's toolbar) to encapsulate it. This will preserve the indenting, and eliminate any possibility of the forum translating some XML into smilies! :)
 
Last edited:
Back
Top