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

FSX colored trim position in percent text string

Messages
2
Country
netherlands
Hi,
I,am searching for a xml text string for showing up the percent numbers in 3 different colors
so if the trimmed position is negative the numbers most show up in red, when the trimmed level is between +1 and-1 the numbers most show up in green
and when trimmed above +1 the numbers most show up in yellow.
I,ve seen in the past a solution for this but i can,t find it anymore
does somebody know how to do this

regards,
Richard
 
This might work ,
Code:
<Element>
     <Position X="115" Y="6"/>
           <FormattedText X="75" Y="12" Font="Tahoma" FontSize="8" LineSpacing="11" Adjust="Left" Color="#A1A9A6" BackgroundColor="#123712" Bright="Yes">
              <Color Value="#ED7300"/>
              <Color Value="#FF3030"/>
                   <String>
                          %((L:Trim,number) 1 &lt;)%{if}%\{clr1}((L:Trim,number))%!02.1f%{end}%
                          %((L:Trim,number) 0 ==)%{if}%\{clr2}%((L:Trim,number))%!02.1f%{end}%
                          %((L:Trim,number) 1 &gt;)%{if}%\{clr3}%((L:Trim,number))%!02.1f!%{end}%            
                   </String>    
             </FormattedText>
   </Element>

Where " L:Trim,number " appears replace with your own variable .

The 1 &lt; and1 &gt; , the 1 might need to be replaced with 0.1 if you are reading to tenths.

Cheers
Karol

PS
the above was modified from the following toggle display which 'works' ,
Code:
<!-- MODE list - ADD - DTO - REPLACE - toggle displaying current active entry mode  -->
            <Element>
              <Position X="115" Y="6"/>
              <FormattedText X="75" Y="12" Font="Tahoma" FontSize="8" Tabs="13C,38C,67C" LineSpacing="11" Adjust="Left" Color="#A1A9A6" BackgroundColor="#123712" Bright="Yes">
              <Font FontSize="10"/>
              <Color Value="#ED7300"/>
              <Color Value="#FF3030"/>
              <Color Value="#FCD116"/>
                <String>
                %((L:TypEntry) 0 ==)%{if}%\{fnt1}%\{clr2}%ADD%{else}%\{fnt}%\{clr1}%ADD%{end}%
                \t%((L:TypEntry) 1 ==)%{if}%\{fnt1}%\{clr3}%DTO%{else}%\{fnt}%\{clr1}%DTO%{end}%
                \t%((L:TypEntry) 2 ==)%{if}%\{fnt1}%\{clr4}%REP%{else}%\{fnt}%\{clr1}%REP%{end}%               
                </String>       
              </FormattedText>
            </Element>
 
Last edited:
Hi,

I use this code ( in Fs2004 ) to display a value in one of three different colours - I don't really know how it works but I copied it from somewhere and it works...

Code:
    <Element>
      <Visible> (A:Sim on ground,bool) </Visible>
      <Position X="295" Y="16"/>
      <Text X="40" Y="7" Bright="Yes" Length="5" Font="Arial" Color="%('white' 'orange' 'red'  (L:VSAT,enum) sp1 l1 -2.2 &lt;= !  ? l1 -1.3 &lt;= ! ?)" Adjust="Left" VerticalAdjust="Center" Multiline="No">
        <String>%((L:VSAT,enum))%!2.2f!</String>
      </Text>
    </Element>

Maybe someone in the know can explain how the decision is taken for the colour...

Walter
 
Hi Karol and Walter,

many thanks for the quick response and solutions!
I,am going to experiment with both xml stings

Richard
 
Hi Walter

That looks really cool .
Have you tried it with 4 or 5 colours ?

It looks like fun to play with , to see how many conditions and colours can be used .

Cheers
Karol
 
No, Karol, that is my limit! :)

I haven't an idea how to manipulate the XML code "sp1 l1 -2.2 &lt;= ! ? l1 -1.3 &lt;= ! ?" to take account of other conditions - I think I was very lucky to get it to work for the three!

I use the condition of VSAT to congratulate myself or to scold myself on how hard I land in the 172 - I have some sounds also that play depending on the the value of VSAT.

Walter
 
Hi Walter

I had a look at the SDK for ! and ? , if I interpret it correctly it only covers 3 colours or conditions .
However you must keep in mind that the SDK's are a mystery to me , I tend to get more confusion than enlightenment from them ! !

I have 5 text colours in my Radio Altimeter , so a simpler and more concise method would have been nice .

Cheers
Karol
 
The following is the Element that provides 5 text colour readout for Radio altitude .
Code:
 <!-- TEXT COLOUR  Red = 100 and less , Orange = 101-200 , Yellow = 201-500 , Lt Green = 501-1000 , Fluro Green = 1000 and greater  -->       
   <Element>   
     <Position X="0" Y="2"/>
           <FormattedText X="49" Y="15" Font="Tahoma" FontSize="15" LineSpacing="15" Adjust="Right" VerticalAdjust="Center" Color="#00FF00" Bright="Yes">
              <Color Value="#6C8D7C"/>
              <Color Value="#CECE55"/>
              <Color Value="#CC9900"/>
              <Color Value="#FF3911"/>
                   <String>
                          %((A:RADIO HEIGHT, feet) 1001 &gt;)%{if}%\{clr1}%((A:RADIO HEIGHT, feet))%!6d%{end}%
                          %(501 1000 (A:RADIO HEIGHT, feet) rng)%{if}%\{clr2}%((A:RADIO HEIGHT, feet))%!6d%{end}%
                          %(201 500 (A:RADIO HEIGHT, feet) rng)%{if}%\{clr3}%((A:RADIO HEIGHT, feet))%!6d%{end}%
                          %(101 200 (A:RADIO HEIGHT, feet) rng)%{if}%\{clr4}%((A:RADIO HEIGHT, feet))%!6d%{end}%
                          %((A:RADIO HEIGHT, feet) 100 &lt;)%{if}%\{clr5}%((A:RADIO HEIGHT, feet))%!6d%{end}%
                   </String>   
             </FormattedText>
   </Element>

Cheers
Karol
 
(L:VSAT,enum) sp1 l1 -2.2 &lt;= ! ? l1 -1.3 &lt;= ! ?)
[/CODE]

Maybe someone in the know can explain how the decision is taken for the colour...
I really hate these cryptic "shorthand" forms of logic, but let's try to unpack it...

1. (L:VSAT,enum) is stored in register 1, popped from the stack and reloaded (lower case L1): sp1 l1... This allows us to simply type l1 instead of the full (L:var) over and over!

2. The first evaluation asks if l1 not equal to or less than -2.2? Result is 1 if true or 0 if false.

3. The second evaluation asks if previous result is not less than or equal to -1.3? Result is 1 if true or 0 if false

4. The end results of the above are evaluated with three possibilities
0 + 0 = 0
1 + 0 = 1
1 + 1 = 2

5. The three colors are a case evaluated list, and will choose the color based on the results in #4 above: red=0, orange=1, white=2
 
I haven't an idea how to manipulate the XML code "sp1 l1 -2.2 &lt;= ! ? l1 -1.3 &lt;= ! ?" to take account of other conditions - I think I was very lucky to get it to work for the three!

That piece of code, though not quite difficult, it's rather tricky because it uses two consecutive short if{} in the form "A B condition ?", which means "if condition is true then leave A on the stack and remove B, and otherwise if false".
In that example, if VSAT is greater than -2.2 then "orange" is kept, otherwise "red" is.
Now comes the next evaluation taking "white" an either "orange" or "red" depending on the previous result. If VSAT is greater than -1.3 then "white" returns, otherwise "orange/red"

Tom
 
Thank you, n4nix, and Tom, for that detailed explanation.

It reminds me of why, even though I have produced a lot of XML gauges for my own use, I usually end up with a massive headache shortly after every development and enhancement!

My usual 'style' ( if I have such a thing!) is the exact opposite of that piece of coding - long winded, baby-XML statements - because I cannot come up with snappy one-liners as in that piece of code!

Some of the examples in the Wiki use terse statements like the above - sometimes I put them in, if they fit the bill anyway well, without understanding the whys and wherefores.

It is all good, clean and harmless fun though! :-)

Walter
 
This thread and this prior one reminded me to put up a Stack wiki I have had for a while .. it's there now.

In display format, here is the stack view of the XML script from replies #3, #6, #9, #10 above:

upload_2016-4-24_13-37-57.png


To understand what the lesser known XML Operators actually do or to Q/C complicated script logic, it can be instructive to see the stack, step by step. I sometimes use the attached XML gauge. It's a 230 x 230 stand alone gauge that displays the top 20* stack values as well as contents of Storage Registers 0 thru 19. Operation is self explanatory. It requires Tom Aguilo's XMLVARS or XMLTOOLS be installed first.

The screen shot below is a view of the Stack after sequence item 7:

upload_2016-4-24_13-22-59.png


Bob

* according to this old blog, 30 is the max stack depth

[edit] revised Stack1.xml to remove line 39 (c l20 ... l39) and streamlined the display <Element> structure
 

Attachments

Last edited:
Hi guys

First post here, so please be gentle. I have been looking for a coloured trim gauge to go with my trim wheel for ages. I downloaded Stack1 and placed it into my gauges folder. I wanted it as a pop up, so created this:

[Window04]
size_mm=230,230
position=6
BACKGROUND_COLOR=0,0,0
VISIBLE=0
gauge00=Stack1, 0,0

I am obviously doing something wrong as nothing appeared. Am using P3D ver 3.2 on Windows 10. I would appreciate any help. I am not a programmer.

Many thanks.

John
 
The stack gauge is just a very simple, very elementary Q/C gauge. You are correct in making a separate [Window] for it in panel.cfg. With Visible=0 you can decide when to display it.

As far as use goes, you have to copy a particular line of XML script out of your working gauge and paste it in stack1.xml, below where it says <!-- TEST SCRIPT HERE, for example
Code:
<!-- TEST SCRIPT HERE
     Place @stack at any point in the script to display Stack 0 thru 19 and Storage Registers 0 thru 19 -->   
 
        'white' 'orange' 'red' (L:VSAT,enum) sp1 @stack l1 -2.2 &lt;= ! ? l1 -1.3 &lt;= ! ?

In this example, the XML script to be evaluated is

'white' 'orange' 'red' (L:VSAT,enum) sp1 @stack l1 -2.2 &lt;= ! ? l1 -1.3 &lt;= ! ?

or

'white' 'orange' 'red' (L:VSAT,enum) sp1 l1 -2.2 &lt;= ! @stack ? l1 -1.3 &lt;= ! ?


or

'white' 'orange' 'red' @stack (L:VSAT,enum) sp1 l1 -2.2 &lt;= ! ? l1 -1.3 &lt;= ! ?

and so forth. It's very manual in that regard ... nothing automatic or fancy.

Place the @stack macro after any part of your script where you want to see the stack result. Then, you must Save stack1.xml, and when you're back in the simulator, click the red R RELOAD button in the upper left corner of the readout to reload stack1.xml.

Also be sure that XMLVARS or XMLTOOLS is installed first. I make use of that module in order to more easily display either a string or a number - the stack can hold both, but without XMLVARS/XMLTOOLS, it's hard to store the string so that I can display it.

Make sense?

Bob

By the way, if nothing appears, did you also add [Window04] in your [Window Titles] section ? (you only have 4 windows in the panel set?)

BTW - all my work in in FSX, so my suggestions work for that sim. All my script is in the older (and universally preferred, sorry Bjoern) FS9 XML schema
 
Last edited:
Thanks Bob, I'll give it a go. I was hoping for just a simple gauge that I could place in my gauges folder and create a window for. All the above is totally new to me.

Thanks

John
 
I never put my custom gauges in the Microsoft Flight Simulator X\Gauges folder. To be honest, I've forgotten the rules about how to direct the path in your panel.cfg to the Gauges folder , but I hope someone will jump in here and explain it - I would like a refresher.

I always create gauges folders in my specific aircraft, for example, I create a TEST folder and put it here:

Microsoft Flight Simulator X\SimObjects\Airplanes\F1_Cessna_421\Panel\TEST

then I place Stack1.xml in that folder. The panel.cfg line becomes gauge00=TEST!Stack1, 0, 0

Bob
 
Bob, there's nothing to do... If the called gauge (whether ..\gaugefoldername, .cab, .gau or .dll) isn't in the ..\panel folder, the sim will automatically look in the ..\gauges folder...

...except for Prepar3D v3.x.x where L-M seems to have broken that system. :eek:
 
Hello. Where is the spreadsheet? The screenshot only shows only "sequence item 7." I am still not grasping the "?" concept as it relates to its stack position - ugh. EDIT: Okay, after 10 hours, I think I got. A little history. I use FS9 because I don't have a sufficient computer to run FSX (or P3D). Somewhere along the line, I came across 737800 gauges that I could update to airscheffel.com's great AS738. The XCRT1 worked but XCRT2 and EICAS did not. I found out FS9 cannot access xml's <Pie> like in FSX. AS738 has a great panel and I wanted to learn its eicas.xml so I could modify 737800's eicas.xml. The 737800's XCRT1 (really an ND) works well with UFMC - even to the point of showing the approach and missed approach on the ND without the FS9GPS. So...:

derived from AS738! eicas.xml (in part):

<Value> 3 2 1 0 (A:TURB ENG1 N1, percent) s0 42 &gt; ? l0 90 &gt; ? l0 104 &gt; ? </Value>
<Case Value="0"><Image Name="eicas_n1_25.bmp" Bright="Yes"/></Case>
<Case Value="1"><Image Name="eicas_n1_50.bmp" Bright="Yes"/></Case>
<Case Value="2"><Image Name="eicas_n1_100.bmp" Bright="Yes"/></Case>
<Case Value="3"><Image Name="eicas_n1_red.bmp" Bright="Yes"/></Case>

stack1.xml showed this:

3 2 1 0 (A:TURB ENG1 N1, percent) s0 42 &gt; ? l0 90 &gt; ? l0 104 &gt; @stack ?

N1=26% N1=43% N1=75% N1=92% N1=108%
____________________________________________________________________________________

stack0: 0 0 0 0 1
stack1: 0 1 1 2 2
stack2: 3 3 3 3 3

register0: N1

but where are 42, 90 104 and the ?'s in the stack?

Still can't follow the stack positions but per n4pix on fsdeveloper.com: As I understand it: each "?" is a comparison (result) that is stored and then all of the "?"'s are added to give the final case value that is used.

if: N1 = 26%: N1 > 42 is False=0 N1 > 90 is False=0 N1 > 104 is False=0, 0 + 0 + 0 = 0

if: N1 = 75%: N1 > 42 is True=1 N1 > 90 is False=0 N1 > 104 is False=0, 1 + 0 + 0 = 1

if: N1 = 92%: N1 > 42 is True=1 N1 > 90 is True=1 N1 > 104 is False=0, 1 + 1 + 0 = 2

if: N1 = 108%: N1 > 42 is True=1 N1 > 90 is True=1 N1 > 104 is True=1, 1 + 1 + 1 = 3

So now I can at least move forward.
 
Last edited by a moderator:
Back
Top