• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

FS2004 Stacking 'Messages' (font strings)

#1
Hey all,

Lets say I want to do a message center. I want the message strings to stack in order. No order really except that they 'stack' from the top down.

Is there a simple way to do this?

Example...
MOMENT ONE: /////////////////////////
* FLAPS DOWN
* GEAR UP

MOMENT TWO: ///////////////////////// logic events
* FLAPS DOWN (disappears)
* GEAR UP (stays on, moves to line 1 because line 1 data terminated)

MOMENT THREE: ///////////////////////// new layout
* GEAR UP

MOMENT FOUR: ////////////////////////// new events
* GEAR UP
* SPOILER DOWN 30%
* STOL SYSTEM ENGAGED 40 DEG

MOMENT FIVE: ////////////////////////// new events
* GEAR UP (expires, gear is now down)
* SPOILER DOWN 70%
* STOL SYSTEM ENGAGED 50 DEG

MOMENT SIX: /////////////////////////// new order
* SPOILER DOWN 70%
* STOL SYSTEM ENGAGED 50 DEG


So the stacks would be constantly shifting, and they appear on the 'timer' window 'Messages'. The trick is, how do you get them to stack automatically?
 
#2
I'm not the best at coding, but perhaps you could have a series of variables representing the lines. So for line one var1, line two var2 etc.,
And then code each variable to change accordingly. Let's say you have six options then you could "or" each option and only one at a time would be valid and that one would be fed into the variable.
 
#3
Father Bill has an excellent example in this thread.. It uses <FormattedText>, a "must use" in this situation. His code is rather elaborate including sounds, an alert rectangle and multiple colors to show/sound during both a caution & a warning.

It can be simplified for testing & understanding just by using the very last <Element> in his example, replacing the macro calls with expressions.
Ex-
Code:
        <String>
          %((A:Exit Open:0,bool) (A:Exit Open:1,bool) or (A:Sim On Ground,bool) and) %{if}DOOR OPEN\n%{end}
          %((A:Eng1 Oil Pressure, PSF) 12 &lt;)%{if}L OIL PRES\n%{end}
          %((A:Eng2 Oil Pressure, PSF) 12 &lt;)%{if}R OIL PRES\n%{end}
          %((A:PITOT HEAT,bool) !)%{if}PITOT HT OFF\n%{end}
          %((A:Sim On Ground,bool) 0 == (A:Gear Center Position,percent) 90 &lt; (A:Flaps Handle percent,percent) 90 > (A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) 25 &lt; or (A:GENERAL ENG THROTTLE LEVER POSITION:2, percent) 25 &lt; or and and)%{if}CHECK GEAR\n%{end}
        </String>
The background behind it all - If the expression is true then show some text and, the main part ("the trick"), create a new line. If the expression is false don't do anything.
 
Last edited:
#8
Trying to get this working today, having some issues. It seems only the top string will show and others in the stack will not.

Am I missing a symbol for when one uses multiple strings in an Element?

Code:
          <Element>
              <Position X="396" Y="367"/>
    <Element>
                       <Visible>(L:3303MESSAGE CENTER Screen,enum) 1 == </Visible>
       <Image Name="MessageCenter.bmp"/>
    </Element>
        <Element Name="OVERSPEED ALERT MESSAGE">
              <Position X="300" Y="20"/>
        <Text Bright="Yes" X="350" Y="100" Length="6" Multiline="No" Fixed="Yes" Font="SpaceOutExtended" FontSize="30" Color="#43EAF0" Adjust="Center" VerticalAdjust="Center">
               <String>%((A:BRAKE PARKING INDICATOR,bool))%{if}PARK BRAKE ON%{end}
                             %((A:AIRSPEED INDICATED, knot) @VNE &gt; )%{if}OVERSPEED%{end}
                             %((A:Exit Open:0,bool) 1 == ) %{if}DOOR OPEN\n%{end}
               </String>
              </Text>
            </Element>
         </Element>
 
#9
Try it without this ,
Length="6" Multiline="No"

You are limiting it to readout 6 characters only .
You are after multiline indicated by ,
X="350" Y="100" and FontSize="30", 3 lines x 30 = 90 , which should fit in Y="100" .

So your String should be ,
Code:
               <String>%((A:BRAKE PARKING INDICATOR,bool))%{if}PARK BRAKE ON%{end}
                             \n%((A:AIRSPEED INDICATED, knot) @VNE &gt; )%{if}OVERSPEED%{end}
                             \n%((A:Exit Open:0,bool) 1 == ) %{if}DOOR OPEN\n%{end}
               </String>
Note the " \n " in the string .

Cheers
Karol

EDIT.
Note in Roman's example above he placed the \n prior to {end} .
 
Last edited:
#10
The following uses Formatted text instead of Text .
Give it a try ,
Code:
         <Element>
              <Position X="396" Y="367"/>
         <Element>
                       <Visible>(L:3303MESSAGE CENTER Screen,enum) 1 == </Visible>
              <Image Name="MessageCenter.bmp"/>
         </Element>
         <Element Name="OVERSPEED ALERT MESSAGE">
             <Position X="300" Y="20"/>
              <FormattedText X="350" Y="100" Font="SpaceOutExtended" FontSize="30" Color="#43EAF0" Adjust="Center" Bright="Yes">
               <String>%((A:BRAKE PARKING INDICATOR,bool))%{if}PARK BRAKE ON%{end}
                       \n%((A:AIRSPEED INDICATED, knot) @VNE &gt; )%{if}OVERSPEED%{end}
                       \n%((A:Exit Open:0,bool) 1 == ) %{if}DOOR OPEN%{end}
               </String>
              </FormattedText>
            </Element>
         </Element>
Cheers
Karol
 
#12
Hello Bill

Last time I used Formated text as you like, was by using Fr. Leaming teachings in a diferent way. Because I am a very poor programmer, I wasn't able to understand the best way to do it. However, my take on this subject was tailored to do my life easier reading my own gauges. Here is an example and I hope it helps a bit. As I said, all credit is for Fr. Leaming.

Code:
                <!-- C O L U M N   L E F T   EICAS page 1 Messages Autoscrolling -->
                  <!-- Color Codes:
                          #FF3A34 used as red;   #05DA23 used as green;   # FFFFFF used as white;   #00FFFF used as cyan;   FFD200 used as yellow  -->
                  <Element>
                    <Position X="43.000" Y="635.000"/>
                    <FormattedText X="200" Y="158" Font="Arial" FontSize="20" Adjust="Left" Color="#FFD200" Bright="Yes">
                          <Color Value="#FFFFFF"/>
                          <Color Value="#05DA23"/>
                          <String>
                                <!-- YELLOW TEXT -->
                                    <!-- Fuel 1 Low-->
                                    %((A:Circuit general panel on, bool) (A:FUEL TOTAL QUANTITY WEIGHT, pound) 85 &lt; &amp;&amp;)
                                    %{if}FUEL 1 LOW\n
                                    %{end}
                                    <!-- AP 1-->
                                    %((L:Eng2Running,bool) 0 == (A:SIM ON GROUND,bool) 1 == &amp;&amp;)
                                    %{if}AP 1\n
                                    %{end}
                                    <!-- FWD XFER PUMP-->
                                    %((A:FUEL CROSS FEED,bool) 0 ==)
                                    %{if}FWD XFER PUMP\n
                                    %{end}
                                    <!-- HYD 1 PRESS-->
                                    %((L:Hydr1On,bool) 0 ==)
                                    %{if}HYD 1 PRESS\n
                                    %{end}
                                    <!-- GENERATOR 1 OFFLINE-->
                                    %((A:GENERAL ENG2 GENERATOR ACTIVE,bool) 0 ==)
                                    %{if}GEN 1 OFFLINE\n
                                    %{end}
                                <!-- WHITE TEXT -->
                                \{clr2}
                                    <!-- ENG 1 START-->
                                    %((L:429_Starter_switch_control, number) 1 ==)
                                    %{if}ENG 1 START\n
                                    %{end}
                                    <!-- FUEL 1 CLOSED-->
                                    %((A:General Eng Fuel Valve:2,bool) 0 ==)
                                    %{if}FUEL 1 CLOSED\n
                                    %{end}
                                    <!-- L CABIN DOOR-->
                                    %((A:Exit Open:1,bool) (A:EXIT OPEN:2,bool) ||)
                                    %{if}L CABIN DOOR\n
                                    %{end}
                                    <!-- L PILOT DOOR-->
                                    %((A:Exit Open:0,bool) 1 ==)
                                    %{if}L PILOT DOOR\n
                                    %{end}
                                <!-- GREEN TEXT -->
                                \{clr3}
                                    <!-- L PITOT STATIC-->
                                    %((L:Bell_429_Pitot_Heat_Left,bool) 1 ==)
                                    %{if}L PITOT STATIC\n
                                    %{end}
                          </String>
                    </FormattedText>
                  </Element>

                  <!-- C O L U M N   C E N T E R   EICAS page 1 Messages Autoscrolling -->
                  <!-- Color Codes:
                          #FF3A34 used as red;   #05DA23 used as green;   # FFFFFF used as white;   #00FFFF used as cyan;   FFD200 used as yellow  -->
                  <Element>
                    <Position X="290.000" Y="635.000"/>
                    <FormattedText X="200" Y="158" Font="Arial" FontSize="20" Adjust="Left" Color="#FFD200" Bright="Yes">
                          <Color Value="#FFFFFF"/>
                          <Color Value="#05DA23"/>
                          <String>
                                <!-- YELLOW TEXT -->
                                    <!-- BATT PWR OFF-->
                                    %((A:Electrical Master Battery,bool) 0 ==)
                                    %{if}BATT PWR OFF\n
                                    %{end}
                                    <!-- BAL PUMP-->
                                    %((A:General Eng Fuel Pump Switch:2,bool) 0 == (A:General Eng Fuel Pump Switch:3,bool) 0 == &amp;&amp;)
                                    %{if}BAL PUMP\n
                                    %{end}
                                <!-- WHITE TEXT -->
                                \{clr2}
                                    <!-- N ESS OVRD ON-->
                                    %((L:Bell_429_NESS_BUS,bool) 0 ==)
                                    %{if}N ESS OVRD ON\n
                                    %{end}
                                <!-- GREEN TEXT -->
                                \{clr3}
                                    <!-- EXT PWR ON-->
                                    %((L:Bell_429_CTRDU_EMER_PWR,bool) 1 ==)
                                    %{if}EXT PWR ON\n
                                    %{end}
                                <!-- WHITE TEXT -->
                                \{clr2}
                                    <!-- INTCON OVRD ON-->
                                    %((L:Bell_429_BUS_INTCON,bool) 0 ==)
                                    %{if}INTCON OVRD ON\n
                                    %{end}
                                    <!-- BATT RELAY-->
                                    %((L:Inverter1,bool) 0 == (L:Inverter2,bool) 0 == &amp;&amp;)
                                    %{if}BATT RELAY\n
                                    %{end}
                          </String>
                    </FormattedText>
                  </Element>
In this way, I was able to take a closer look to each column and particularly, at every single text line. All is fully commented; for sure, you will be able to follow it very easy.

Sergio.
;)
 
Last edited:
#14
Hello Bill

Last time I used Formated text as you like, was by using Fr. Leaming teachings in a diferent way. Because I am a very poor programmer, I wasn't able to understand the best way to do it. However, my take on this subject was tailored to do my life easier reading my own gauges. Here is an example and I hope it helps a bit. As I said, all the credit is for Fr. Leaming.

Code:
                <!-- C O L U M N   L E F T   EICAS page 1 Messages Autoscrolling -->
                  <!-- Color Codes:
                          #FF3A34 used as red;   #05DA23 used as green;   # FFFFFF used as white;   #00FFFF used as cyan;   FFD200 used as yellow  -->
                  <Element>
                    <Position X="43.000" Y="635.000"/>
                    <FormattedText X="200" Y="158" Font="Arial" FontSize="20" Adjust="Left" Color="#FFD200" Bright="Yes">
                          <Color Value="#FFFFFF"/>
                          <Color Value="#05DA23"/>
                          <String>
                                <!-- YELLOW TEXT -->
                                    <!-- Fuel 1 Low-->
                                    %((A:Circuit general panel on, bool) (A:FUEL TOTAL QUANTITY WEIGHT, pound) 85 &lt; &amp;&amp;)
                                    %{if}FUEL 1 LOW\n
                                    %{end}
                                    <!-- AP 1-->
                                    %((L:Eng2Running,bool) 0 == (A:SIM ON GROUND,bool) 1 == &amp;&amp;)
                                    %{if}AP 1\n
                                    %{end}
                                    <!-- FWD XFER PUMP-->
                                    %((A:FUEL CROSS FEED,bool) 0 ==)
                                    %{if}FWD XFER PUMP\n
                                    %{end}
                                    <!-- HYD 1 PRESS-->
                                    %((L:Hydr1On,bool) 0 ==)
                                    %{if}HYD 1 PRESS\n
                                    %{end}
                                    <!-- GENERATOR 1 OFFLINE-->
                                    %((A:GENERAL ENG2 GENERATOR ACTIVE,bool) 0 ==)
                                    %{if}GEN 1 OFFLINE\n
                                    %{end}
                                <!-- WHITE TEXT -->
                                \{clr2}
                                    <!-- ENG 1 START-->
                                    %((L:429_Starter_switch_control, number) 1 ==)
                                    %{if}ENG 1 START\n
                                    %{end}
                                    <!-- FUEL 1 CLOSED-->
                                    %((A:General Eng Fuel Valve:2,bool) 0 ==)
                                    %{if}FUEL 1 CLOSED\n
                                    %{end}
                                    <!-- L CABIN DOOR-->
                                    %((A:Exit Open:1,bool) (A:EXIT OPEN:2,bool) ||)
                                    %{if}L CABIN DOOR\n
                                    %{end}
                                    <!-- L PILOT DOOR-->
                                    %((A:Exit Open:0,bool) 1 ==)
                                    %{if}L PILOT DOOR\n
                                    %{end}
                                <!-- GREEN TEXT -->
                                \{clr3}
                                    <!-- L PITOT STATIC-->
                                    %((L:Bell_429_Pitot_Heat_Left,bool) 1 ==)
                                    %{if}L PITOT STATIC\n
                                    %{end}
                          </String>
                    </FormattedText>
                  </Element>

                  <!-- C O L U M N   C E N T E R   EICAS page 1 Messages Autoscrolling -->
                  <!-- Color Codes:
                          #FF3A34 used as red;   #05DA23 used as green;   # FFFFFF used as white;   #00FFFF used as cyan;   FFD200 used as yellow  -->
                  <Element>
                    <Position X="290.000" Y="635.000"/>
                    <FormattedText X="200" Y="158" Font="Arial" FontSize="20" Adjust="Left" Color="#FFD200" Bright="Yes">
                          <Color Value="#FFFFFF"/>
                          <Color Value="#05DA23"/>
                          <String>
                                <!-- YELLOW TEXT -->
                                    <!-- BATT PWR OFF-->
                                    %((A:Electrical Master Battery,bool) 0 ==)
                                    %{if}BATT PWR OFF\n
                                    %{end}
                                    <!-- BAL PUMP-->
                                    %((A:General Eng Fuel Pump Switch:2,bool) 0 == (A:General Eng Fuel Pump Switch:3,bool) 0 == &amp;&amp;)
                                    %{if}BAL PUMP\n
                                    %{end}
                                <!-- WHITE TEXT -->
                                \{clr2}
                                    <!-- N ESS OVRD ON-->
                                    %((L:Bell_429_NESS_BUS,bool) 0 ==)
                                    %{if}N ESS OVRD ON\n
                                    %{end}
                                <!-- GREEN TEXT -->
                                \{clr3}
                                    <!-- EXT PWR ON-->
                                    %((L:Bell_429_CTRDU_EMER_PWR,bool) 1 ==)
                                    %{if}EXT PWR ON\n
                                    %{end}
                                <!-- WHITE TEXT -->
                                \{clr2}
                                    <!-- INTCON OVRD ON-->
                                    %((L:Bell_429_BUS_INTCON,bool) 0 ==)
                                    %{if}INTCON OVRD ON\n
                                    %{end}
                                    <!-- BATT RELAY-->
                                    %((L:Inverter1,bool) 0 == (L:Inverter2,bool) 0 == &amp;&amp;)
                                    %{if}BATT RELAY\n
                                    %{end}
                          </String>
                    </FormattedText>
                  </Element>
In this way, I was able to take a closer look to each column and particularly, at every single text line. All is fully commented; for sure, you will be able to follow it very easy.

Sergio.
;)

Sergio,

How does the computer know which color code to use? I do not see a flag that tells the string what color it is? Is this done elsewhere?



Bill
 
#15
I am seeing an issue. These arent stacking towards the top. Maybe that isnt possible. What i am getting is that they stack in their order and spaced in their 'row' order.

For instance, number three appears in row three instead of the top if its the only one 'active'. They do not cluster to the top, but in their rows.

Also I note that in some of these examples, the \n is located in the 'front' of the string and the \n is located in other samples at the back of the string. So the back version must be for standard text and the front version \n locations are for 'formatted text' layouts.
I have just checked this (while writing this) and reversed back to regular Text (not FormattedText) and put the \n's back to the rear of the strings and the system wouldnt work at all, as Bill Leaming states.

So I guess these will not 'cluster stack' towards the top. I would need a unique code that could order their stacking.

Very glad to get this working. That was some important details. Very thankful you guys filled me in on those. Many many thanks.


Bill
 
#16
Also I note that in some of these examples, the \n is located in the 'front' of the string and the \n is located in other samples at the back of the string. So the back version must be for standard text and the front version \n locations are for 'formatted text' layouts
Not true.. Strings can be in multiple lines in a <text> type element only if Multiline="Yes" is true and the amount of text doesn't fit in the width (<Text X="XXX") because it isn't wide enough, but the height of the <text> area is high enough to fit extra lines - think "word wrap". The programmer has no other control of the string other than the basic attributes given. (length, width, height, color, font, font size etc..)

IIRC - escape codes, ("backslash something") can only be used in <FormattedText> , hence the name "formatted". The programmer has control of how the string is laid out. This is done within the <string> itself & sometimes (more advanced) with additional attributes given. (multiple colors, multiple font sizes etc..)

It will work...
Karol's example above in #10 will work if the newline escape codes are within the %{if} some text goes here \n%{end} at the very end.
The background behind it all - If the expression is true then 1) show some text and, 2) the main part ("the trick"), create a new line. If the expression is false - don't do anything.
Code:
         <Element>
              <Position X="396" Y="367"/>
         <Element>
               <Visible>(L:3303MESSAGE CENTER Screen,enum) 1 == </Visible>
              <Image Name="MessageCenter.bmp"/>
         </Element>
         <Element Name="OVERSPEED ALERT MESSAGE">
             <Position X="300" Y="20"/>
              <FormattedText X="350" Y="100" Font="SpaceOutExtended" FontSize="30" Color="#43EAF0" Adjust="Center" Bright="Yes">
               <String>
                       %((A:BRAKE PARKING INDICATOR,bool))%{if}PARK BRAKE ON\n%{end}
                       %((A:AIRSPEED INDICATED, knot) @VNE &gt; )%{if}OVERSPEED\n%{end}
                       %((A:Exit Open:0,bool) 1 == ) %{if}DOOR OPEN\n%{end}
               </String>
              </FormattedText>
            </Element>
         </Element>
 
Last edited:

n4gix

Resource contributor
#17
How does the computer know which color code to use? I do not see a flag that tells the string what color it is? Is this done elsewhere?
Bill, you need to become familiar with "Escape Codes" in the SDK. These are things like the \n (newline) escape code, \{clr2} and \{clr3}

<FormattedText X="200" Y="158" Font="Arial" FontSize="20" Adjust="Left" Color="#FFD200" Bright="Yes">
<Color Value="#FFFFFF"/>
<Color Value="#05DA23"/>

Note that there are three colors specified in the above lines. The one in the main <FormattedText...> declaration is counted as \{clr1}. The two additional colors are \{clr2} and \{clr3}.

Now to change colors used, we simply add the Escape Code to the script to stipulate what color to use! That's what the following does:

<!-- WHITE TEXT -->
\{clr2}
 
#18
Bill, you need to become familiar with "Escape Codes" in the SDK. These are things like the \n (newline) escape code, \{clr2} and \{clr3}

<FormattedText X="200" Y="158" Font="Arial" FontSize="20" Adjust="Left" Color="#FFD200" Bright="Yes">
<Color Value="#FFFFFF"/>
<Color Value="#05DA23"/>

Note that there are three colors specified in the above lines. The one in the main <FormattedText...> declaration is counted as \{clr1}. The two additional colors are \{clr2} and \{clr3}.

Now to change colors used, we simply add the Escape Code to the script to stipulate what color to use! That's what the following does:

<!-- WHITE TEXT -->
\{clr2}

Ah so... Many thanks Bill. Brilliant stuff. I used to do entirely different code blocks for color versions as I couldnt figure out how you guys were getting this to work. I was overlooking that clr input.

Not true.. Strings can be in multiple lines in a <text> type element only if Multiline="Yes" is true and the amount of text doesn't fit in the width (<Text X="XXX") because it isn't wide enough, but the height of the <text> area is high enough to fit extra lines - think "word wrap". The programmer has no other control of the string other than the basic attributes given. (length, width, height, color, font, font size etc..)

Spokes2112 / Roman

A thousand thanks Roman. I totally forgot about Multiline.

Bill
 
#19
IT WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

It works...

A beautiful thing. My goodness. It stacked... My jaw rolled under the desk. I have to find it now before the dog does.

I already had 'Multiline' in the font section, and it was set at 'no'. lolol....

Many thanks guys.

It stacks... brilliant...

Now to go see the rest of Bill's code on that webpage you talked about, Roman. I want some sounds also, an AI voice that does callouts with the message popups.

Thanks guys.