• 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 vs FS9?

tgibson

Resource contributor
Messages
11,875
Country
us-california
Hi,

I have a simple piece of gauge code that swaps text color based on certain conditions. This code works perfectly in FS9 (swaps between green and black text color), but in FSX it has a different behavior:

1. If the plane is loaded with black text displayed (@COL_VALUE), when the color swap happens the text just disappears. I can go back and forth - black, missing, black, missing.

2. If the plane is loaded with green text displayed (#267E77), then the same thing happens. This time it's green, missing, green, missing, etc.

I checked the values in the visible statements and they are alternating between 0 and 1 (and 1 and 0) as expected.

The code:

Code:
	<Element>
      <Visible> (A:GENERAL ENG1 COMBUSTION, bool) ! (A:GENERAL ENG2 COMBUSTION, bool) ! (A:GENERAL ENG3 COMBUSTION, bool) ! (A:GENERAL ENG4 COMBUSTION, bool) ! &amp;&amp; &amp;&amp; &amp;&amp; (A:SIM ON GROUND, bool) &amp;&amp; (A:BRAKE PARKING POSITION, bool) &amp;&amp; </Visible>
		<Position X="80" Y="360"/>
		<Text X="125" Y="@YSIZE" Bright="Yes" Length="85" Font="@FONT_TRG" Color="#267E77" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
			<String>%(@Total_Fuel)%!5d! lbs</String>
		</Text>
	</Element>
	<Element>
      <Visible> (A:GENERAL ENG1 COMBUSTION, bool) (A:GENERAL ENG2 COMBUSTION, bool) (A:GENERAL ENG3 COMBUSTION, bool) (A:GENERAL ENG4 COMBUSTION, bool) || || || (A:SIM ON GROUND, bool) ! || (A:BRAKE PARKING POSITION, bool) ! || </Visible>
		<Position X="80" Y="360"/>
		<Text X="125" Y="@YSIZE" Bright="Yes" Length="85" Font="@FONT_TRG" Color="@COL_VALUE" Adjust="Right" VerticalAdjust="Center" Multiline="No" Fixed="No">
			<String>%(@Total_Fuel)%!5d! lbs</String>
		</Text>
	</Element>

Is there any way to avoid this behavior in FSX, short of Formatted Text?

Thanks,
 
Just been playing with it - no problems here ... but ... what are your macros for the Y size and font? I've put a fixed value in, it may be that the macro is returning something you weren't expecting.
 
I am actually getting the same thing on one of my projects. I am using a L:var bool and the 'if' color doesn't work but the 'els' color does. If I figure it out, I will let you know but you are not the only one with this problem for what that is worth :o
 
Hi,

I use the same macros for color and size on other lines that don't swap and they display fine. But perhaps macros are not working properly in this special case for some reason - I'll try to change them to number values and see if that fixes it.

Thanks,
 
Well if it helps in the trouble shooting- I am getting my problem with a script that doesn't use macros anywhere in the element. I also tried a few different ways of 'wording' the condition including reversing it as in instead of 'if' I made 0 == as well as != just to see if it was something funny with that but that didn't do it.
 
Hi,

Changing the macros to numbers didn't fix it, you were right...
 
If you are using Hex colors, I wonder if some arent supported for some odd reason in FSX?

I have a similar problem with my newest infoscreen gauge. Some digital font just doesnt show up. But, I am using Hex colors. I am not using Macros though in the strings. I didnt know you could do that... Always learning something new...
 
I'm using black and green. Both show up fine when not swapping colors.
 
And...... if that doesnt work, cant you just go back to a set of visibilities that would manage each Element the old fashion way?

I wonder if its the Macro.
 
I said above that I *did* change the macros to numbers and it made no difference.

The reason I didn't want to switch to Formatted Text is that I have this code in about 10 different gauges (and about 5 times per gauge) so that would be a lot of recoding (OK, I'm lazy...). :)

And how do you manage this "the old fashioned way"?
 
I think in formatted text you would have something like

Code:
%(condition)%{if}\{clr1}your text

with the colors having been defined with <colorvalue> entries.

This is kind of off the top of my head so I am sure that if I am wrong anywhere, Bill can correct it.
 
That's pretty close. Here is a working example showing how I swap colors on a COM frequency display between Lime (default) and White.

The alternate color is defined in the <Color Value> tag. When I need to have the text display in white, I use the escape code sequence %\{clr2}. Note that the first alternate color is clr2, unlike the first alternate font which is fnt1. It's this sort of inconsistency that drives me nuts!...

Code:
      <Element>
        <Position X="684" Y="42"/>
        <Visible>(A:AVIONICS MASTER SWITCH,bool)</Visible>
        <FormattedText X="60" Y="35" Font="Glass Gauge" FontSize="20" LineSpacing="0" Adjust="CENTER" Color="Lime" Bright="Yes">
          <Color Value="White"/>
          <String>
              %((A:COM1 TRANSMIT,bool) 1 ==)
              %{if}%((A:COM1 ACTIVE FREQUENCY,Mhz))%!2.2f!
              %{else}%\{clr2}%((A:COM1 ACTIVE FREQUENCY,Mhz))%!2.2f!%
          </String>
        </FormattedText>
      </Element>
 
Last edited:
Back
Top