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

FS2004 String or Spaghetti

Messages
1,468
Country
italy
I'm having a little problem with displaying text and value. What I want is the text on one line
and the value below. What I get is very small text characters and very large value digits.
Also is this the best way to display text and value as a string.
Code:
<Gauge Name="QFE" Version="1.0">
<Element>
   <Text X="150" Y="10" Length="7" Font="Arial Black" Color="#B1BEB6" Adjust="Center" VerticalAdjust="Center" Multiline="Yes">
   <String>%Airfield QFE%
   %((L:QFE,number))%!s!%</String>
   </Text>
</Element>
</Gauge>
 
I think your problem may be that an L: variable does not contain a true string, so the conversion is not working properly. I would change the !s! to a number format.
 
Thanks Tom. Two more problems though. I can't get the L var to display on another line. And also If another var is set to zero I don't want anything displayed.
 
You will need to reformat that to a <FormattedText> expression and use the newline command: /n to force a carriage return. Frankly, I never use anything but <FormattedText> at all since it is so much more flexible than normal <Text> style:
Code:
                     <Element>
                        <Position X="12" Y="47"/>
                       <FormattedText X="236" Y="59" Font="Arial Black" FontSize="13" LineSpacing="17" Adjust="Left" Color="0x00FF00" Bright="Yes">
                         <String>
                           @DisplayAirportName
                           %((@c:WaypointAirportCity))%!s!\n
                           %((@c:WaypointAirportRegion))%!s!\n
                         </String>
                       </FormattedText>
                     </Element>
 
Yes Bill, I was contemplating that formatted text would be the answer:mad:
To give you an idea of what I'm aiming for. I've done a calculation
to examine a selected airport destination's elevation, then apply a factor i.e. 29.54545 /
the result (L:QFE_form,number) is then deducted from L:standby_kohlsman, millibars and then input into (>L:QFE,number)
That all works fine. But the problem is how to display text on one line and the qfe below. Plus if the (L:QFE_form,number) equals zero
I don't want to see any text at all!
Code:
<Value>(L:Nav_Elevation,feet) 29.54545 / (>L:QFE_form,number) (L:standby_kohlsman, millibars) (L:QFE_form,number) - (>L:QFE,number)</Value>
 
Assuming a <FormattedText> format, the <String> expression for conditional displays has this format:
Code:
<String>
  %((A:NAV1 Radial, degrees))
  %{if}
  %((A:NAV1 Radial, degrees))%!03d!
  %{else}---- %{end}\{dplo=M}
</String>
Try something like this:
Code:
<String>
  %((L:QFE_form,number) 0 !=)
  %{if}
  %Airfield QFE%\n
  %((L:QFE,number))%!d!
  %{else}
  %{end}
</String>
 
Last edited:
Assuming a <FormattedText> format, the <String> expression for conditional displays has this format:
Code:
<String>
  %((A:NAV1 Radial, degrees))
  %{if}
  %((A:NAV1 Radial, degrees))%!03d!
  %{else}---- %{end}\{dplo=M}
</String>
Try something like this:
Code:
<String>
  %((L:QFE_form,number) 0 !=)
  %{if}
  %Airfield QFE%\n
  %((L:QFE,number))%!d!
  %{else}
  %{end}
</String>


Thanks again Bill, I was s l o w l y working towards that! One other question though. I've tried various colour codes and they don't seem to work. For example I wanted a reddish brown and instead got a blue.
 
Your code works a dream. Many thanks. Just some advice on the colouring if you would.
These are the parameters for <FormattedText>, usually one compressed line, but expanded here for clarity.
Code:
<FormattedText
  X="33"
  Y="18"
  Length="5"
  Fixed="Yes"
  Font="Arial Bold"
  FontSize="14"
  Charset="Default"
  Attributes="Normal"
  Adjust="Center"
  VerticalAdjust="Center"
  Multiline="No"
  Color="#FFFFFF"
  BackgroundColor="#000000"
  HilightColor="white"
  Bright="Yes"
>
The Color=" " entry is what you want. There is a document in the SDK that has a chart of all of the XML "named" colors available. Of course you can also custom define your desired RGB color in hex format if you wish!

The closest to a "reddish-brown" might be "firebrick" (hex: "#B22222") Somewhat lighter is "indianred" (hex: "#CD5C5C").
 
Thanks for your help Bill. Here's the result though it's still work in progress as I'll change "Destination" for the ICAO code. It's on the chinagraph pad on the right. Usually reserved for the stewardess's telephone number!!
wipx.jpg
 
Another final question. How do I convert the letter code into a character using formatted text?
I tried using chr but it didn't seem to work.
Code:
%((L:Nav_LetterApt1,number)) chr \n
 
%((L:Nav_LetterApt1,number) chr)\n assuming (L:Nav_LetterApt1,number) is the ascii code for an individual character and the string format used is !s!
 
Back
Top