• 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 XML Annunciator Events

Messages
206
Country
unitedkingdom
Hi folks,

This might be far too complicated, but I will explain what I want to do and perhaps someone can help me out...

I have an XML based panel in which the EICAS has an area for annunciator messages. Currently, the messages appear as individually positioned text strings, but, as I am modelling more systems (and from a peek at the real thing last week) I see that what I need to do is list the current messages because there are simply not enough spaces for them all to have 'their own place' on the screen...

Looking here, I see that I can store the relevant strings as L vars : http://www.fsdeveloper.com/forum/showthread.php?t=94088

So, for example, I could use this to have a register of available messages such as

L:Annunc1 => "RIGHT ENGINE FIRE"
L:Annunc2 => "LEFT ENGINE FIRE"
L:Annunc3 => "APU FIRE"
L:Annunc4 => "LEFT BRAKE OVERHEAT"
L:Annunc5 => "RIGHT BRAKE OVERHEAT"
L:Annunc6 => "SPOILER UP"
L:Annunc7 => "AUTOBRAKE OFF"
etc, etc... There would probably be about 40 of these

Then I would (I assume) be able to use a bit of code to look if the L Var was empty and if it was not, to display it... However, this is where I'm stuck: How do I "go through" all these and only display the ones that are not empty?? I.e. Star at Annunc1 and if it is 'live' then show that text, then look at Annunc2 and if it is empty skip it but if it is not then show that on the next line... This way I would simply show the first (lets say) 8 messages in one line - I would be clever in the order if them so that the 'really bad', therefore high priority, things like fire warnings were always on top etc... Any ideas? Is there some much easier / more logical way to do this?

In the ideal situation I would have one EICAS page where the annunciator list was everything shown and then on other pages it would only look at a sub-set i.e. Annunc20-25 and could select colour for the text based on which L var it used... Perhaps this is just too complicated?

I am working in XML, and I have a medium knowledge level there. I have no clue about coding in C, so it's an XML only project.

Cheers,
Geoff
 
L:Annunc1 => "RIGHT ENGINE FIRE"
L:Annunc2 => "LEFT ENGINE FIRE"
L:Annunc3 => "APU FIRE"
L:Annunc4 => "LEFT BRAKE OVERHEAT"
L:Annunc5 => "RIGHT BRAKE OVERHEAT"
L:Annunc6 => "SPOILER UP"
L:Annunc7 => "AUTOBRAKE OFF"
etc, etc... There would probably be about 40 of these

Then I would (I assume) be able to use a bit of code to look if the L Var was empty and if it was not, to display it...

Can't you create an L:Var in which the state (ie, if the condition exists) is stored? That is, if the right engine is on fire, then (L:Annun1, enum) or (L:Annun1, bool) = 1, otherwise 0. Same for all 40 states. Then, loop through the 40 L:Vars and display the relevant string when the state L:Var is 1.

Actually, for what you're doing, I don't see the need to store the messages in an L:Var in the first place.

Bob
 
Last edited:
Can't you create an L:Var in which the state (ie, if the condition exists) is stored? That is, if the right engine is on fire, then (L:Annun1, enum) or (L:Annun1, bool) = 1, otherwise 0. Same for all 40 states. Then, loop through the 40 L:Vars and display the relevant string when the state L:Var is 1.

Actually, for what you're doing, I don't see the need to store the messages in an L:Var in the first place.

Bob

Yes, it's the selective readout of them that I can't work out how to do... I wondered if this text in vars was then sin some way 'sortable' or would be looked at as an array?

The real question is how do I read through my messages and then show just messages 12, 16, 22, 23, 24 and 42 because they are 'live', showing them on six consecutive lines? Probably this is where my low knowledge of what can be done with text in XML comes in - mostly I have done 'systems' where stuff gets calculated rather than outputed! Is there simply a way to just declare the 'top' of a text area and then add several lines with their own <visible> code?

Geoff
 
Yes, it's the selective readout of them that I can't work out how to do... I wondered if this text in vars was then sin some way 'sortable' or would be looked at as an array?

The real question is how do I read through my messages and then show just messages 12, 16, 22, 23, 24 and 42 because they are 'live', showing them on six consecutive lines? Probably this is where my low knowledge of what can be done with text in XML comes in - mostly I have done 'systems' where stuff gets calculated rather than outputed! Is there simply a way to just declare the 'top' of a text area and then add several lines with their own <visible> code?

Geoff

Can I in fact write something like this?

If condition 1 true then display text 1 with formatting 1 and move to next line and counter + 1.
If condition 2 true then display text 2 with formatting 2 and move to next line and counter +1.
If condition 3 true then display text 3 with formatting 3 and move to next line and counter + 1.
etc etc...


How would I write that in XML (directions to a good tutorial would be good or an example)? Also, how do I make it stop if it gets to counter = 6 (or whatever limit)? Either would need a 'get out' clause from the code or some way to define the text area such that the overflow was not shown, then on the next column the text would not show until the counter > 6...

Geoff

Geoff
 
I think you are making it more complicated than it needs to be. I'd suggest this as an easier method:
Code:
    <!-- XXXXXXXXXXXXXXXXXXXXXXXXX EICAS MESSAGES XXXXXXXXXXXXXXXXXXXXXXXXXX -->

    <Macro Name="CautionCondition">
      @FuelQty_LeftTank_Caution
      @FuelQty_RightTank_Caution or
      @FuelImbalance_Caution or
      @FuelXFeed_Caution or
      @BrakeAcumPress_Caution or
      @GenFail_Eng1_Caution or
      @GenFail_Eng2_Caution or
      @PitotHeat or
      @GenFail_Eng1_Caution or
      @GenFail_Eng2_Caution or
      @Battery1LowVolt or
      @Battery2LowVolt or
    </Macro>

    <Macro Name="WarningCondition">
      @OilPressure_Eng1_Warning
      @OilPressure_Eng2_Warning or
      @DoorOpen or
      @Gear_Warning or
    </Macro>

    <Macro Name="OilPressure_Eng1_Warning">
      (A:Eng1 Oil Pressure, PSF) 12 &lt;
    </Macro>

    <Macro Name="OilPressure_Eng2_Warning">
      (A:Eng2 Oil Pressure, PSF) 12 &lt;
    </Macro>

    <Macro Name="GenFail_Eng1_Caution">
      (A:General Eng Generator Active:1,bool) 0 ==
    </Macro>

    <Macro Name="GenFail_Eng2_Caution">
      (A:General Eng Generator Active:2,bool) 0 ==
    </Macro>

    <Macro Name="Battery1LowVolt">
      (A:ELECTRICAL GENALT BUS VOLTAGE:1,volts) 10 &lt;
    </Macro>

    <Macro Name="Battery2LowVolt">
      (A:ELECTRICAL GENALT BUS VOLTAGE:2,volts) 10 &lt;
    </Macro>

    <Macro Name="DoorOpen">
      (A:Exit Open:0,bool) (A:Exit Open:1,bool) or (A:Sim On Ground,bool) and
    </Macro>

    <Macro Name="PitotHeat">
      (A:PITOT HEAT,bool) !
    </Macro>

    <Macro Name="Gear_Warning">
      (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
    </Macro>

    <Macro Name="Chime_Once">
      1 (&gt;L:XMLDing,enum)
    </Macro>

    <Element>
      <Select>
        <Value>
          @CautionCondition
          (L:ChimeCC,bool) 0 ==
          and
          if{
          1 (&gt;L:ChimeCC,bool)
          @Chime_Once
          }
          @CautionCondition ! if{ 0 (&gt;L:ChimeCC,bool)
        </Value>
      </Select>
    </Element>
    
    <Element>
      <Select>
        <Value>
          @WarningCondition
          (L:ChimeOnce,bool) 0 ==
          and
          if{
          1 (&gt;L:ChimeOnce,bool)
          @Chime_Once
          }
          @WarningCondition ! if{ 0 (&gt;L:ChimeOnce,bool)
        </Value>
      </Select>
    </Element>

    <Element Name="ALERT MESSAGE WINDOW RECTANGLE">
      <Visible>@WarningCondition @CautionCondition or</Visible>
      <Position X="736" Y="282"/>
      <Rectangle Width="127" Height="183" LineWidth="1" Color="White" FillColor="Black" Bright="Yes"/>
    </Element>
    <Element>
      <Position X="740" Y="284"/>
      <FormattedText X="182" Y="210" Font="Arial Bold" FontSize="16" Adjust="Left" Color="#DE243B" VerticalAdjust="Center" Bright="Yes">
        <Color Value="#FFFF00"/>
        <String>
          %(@DoorOpen) %{if}DOOR OPEN\n%{end}
          %(@OilPressure_Eng1_Warning)%{if}L OIL PRES\n%{end}
          %(@OilPressure_Eng2_Warning)%{if}R OIL PRES\n%{end}
          \{clr2}
          %(@GenFail_Eng1_Caution)%{if}L ALTN FAIL\n%{end}
          %(@GenFail_Eng2_Caution)%{if}R ALTN FAIL\n%{end}
          %(@Battery1LowVolt)%{if}L VOLTS LOW\n%{end}
          %(@Battery2LowVolt)%{if}R VOLTS LOW\n%{end}
          %(@PitotHeat)%{if}STALL HT OFF\n%{end}
          %(@PitotHeat)%{if}PITOT HT OFF\n%{end}
          %(@Gear_Warning)%{if}CHECK GEAR\n%{end}
        </String>
      </FormattedText>
    </Element>

The <FormattedText> string above will display only if a "warning" or "caution" condition exists, and will only display a list of active messages.
 
Tom, the advantage of using the techique of a single <FormattedText> string is that there will be no "blank lines." Every displayed line will automatically "move up" as error conditions are corrected.
 
I think you are making it more complicated than it needs to be. I'd suggest this as an easier method:
Code:
    <!-- XXXXXXXXXXXXXXXXXXXXXXXXX EICAS MESSAGES XXXXXXXXXXXXXXXXXXXXXXXXXX -->

    <Macro Name="CautionCondition">
      @FuelQty_LeftTank_Caution
      @FuelQty_RightTank_Caution or
      @FuelImbalance_Caution or
      @FuelXFeed_Caution or
      @BrakeAcumPress_Caution or
      @GenFail_Eng1_Caution or
      @GenFail_Eng2_Caution or
      @PitotHeat or
      @GenFail_Eng1_Caution or
      @GenFail_Eng2_Caution or
      @Battery1LowVolt or
      @Battery2LowVolt or
    </Macro>

    <Macro Name="WarningCondition">
      @OilPressure_Eng1_Warning
      @OilPressure_Eng2_Warning or
      @DoorOpen or
      @Gear_Warning or
    </Macro>

    <Macro Name="OilPressure_Eng1_Warning">
      (A:Eng1 Oil Pressure, PSF) 12 &lt;
    </Macro>

    <Macro Name="OilPressure_Eng2_Warning">
      (A:Eng2 Oil Pressure, PSF) 12 &lt;
    </Macro>

    <Macro Name="GenFail_Eng1_Caution">
      (A:General Eng Generator Active:1,bool) 0 ==
    </Macro>

    <Macro Name="GenFail_Eng2_Caution">
      (A:General Eng Generator Active:2,bool) 0 ==
    </Macro>

    <Macro Name="Battery1LowVolt">
      (A:ELECTRICAL GENALT BUS VOLTAGE:1,volts) 10 &lt;
    </Macro>

    <Macro Name="Battery2LowVolt">
      (A:ELECTRICAL GENALT BUS VOLTAGE:2,volts) 10 &lt;
    </Macro>

    <Macro Name="DoorOpen">
      (A:Exit Open:0,bool) (A:Exit Open:1,bool) or (A:Sim On Ground,bool) and
    </Macro>

    <Macro Name="PitotHeat">
      (A:PITOT HEAT,bool) !
    </Macro>

    <Macro Name="Gear_Warning">
      (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
    </Macro>

    <Macro Name="Chime_Once">
      1 (&gt;L:XMLDing,enum)
    </Macro>

    <Element>
      <Select>
        <Value>
          @CautionCondition
          (L:ChimeCC,bool) 0 ==
          and
          if{
          1 (&gt;L:ChimeCC,bool)
          @Chime_Once
          }
          @CautionCondition ! if{ 0 (&gt;L:ChimeCC,bool)
        </Value>
      </Select>
    </Element>
    
    <Element>
      <Select>
        <Value>
          @WarningCondition
          (L:ChimeOnce,bool) 0 ==
          and
          if{
          1 (&gt;L:ChimeOnce,bool)
          @Chime_Once
          }
          @WarningCondition ! if{ 0 (&gt;L:ChimeOnce,bool)
        </Value>
      </Select>
    </Element>

    <Element Name="ALERT MESSAGE WINDOW RECTANGLE">
      <Visible>@WarningCondition @CautionCondition or</Visible>
      <Position X="736" Y="282"/>
      <Rectangle Width="127" Height="183" LineWidth="1" Color="White" FillColor="Black" Bright="Yes"/>
    </Element>
    <Element>
      <Position X="740" Y="284"/>
      <FormattedText X="182" Y="210" Font="Arial Bold" FontSize="16" Adjust="Left" Color="#DE243B" VerticalAdjust="Center" Bright="Yes">
        <Color Value="#FFFF00"/>
        <String>
          %(@DoorOpen) %{if}DOOR OPEN\n%{end}
          %(@OilPressure_Eng1_Warning)%{if}L OIL PRES\n%{end}
          %(@OilPressure_Eng2_Warning)%{if}R OIL PRES\n%{end}
          \{clr2}
          %(@GenFail_Eng1_Caution)%{if}L ALTN FAIL\n%{end}
          %(@GenFail_Eng2_Caution)%{if}R ALTN FAIL\n%{end}
          %(@Battery1LowVolt)%{if}L VOLTS LOW\n%{end}
          %(@Battery2LowVolt)%{if}R VOLTS LOW\n%{end}
          %(@PitotHeat)%{if}STALL HT OFF\n%{end}
          %(@PitotHeat)%{if}PITOT HT OFF\n%{end}
          %(@Gear_Warning)%{if}CHECK GEAR\n%{end}
        </String>
      </FormattedText>
    </Element>

The <FormattedText> string above will display only if a "warning" or "caution" condition exists, and will only display a list of active messages.

Thanks very much Bill, this is legendary. I will make it a little more complicated than this probably (there are several pages that each have their own messages, as well as the main annunciators page) but I can see how this macro method works and I'm sure it can do everything I want, including setting off the master warning or caution lights too...
Pity I was going to do some work tonight instead of messing with FS stuff. h well!!

EDIT: Just one more question; how do I make some of them different colours - like warnings in red + bold, cautions in orange + bold and then information messages (I will add this) in yellow or blue??

Thanks, I'll post some stuff when I get it working (or when I F it up and can't see why!)

Geoff
 
Last edited:
EDIT: Just one more question; how do I make some of them different colours - like warnings in red + bold, cautions in orange + bold and then information messages (I will add this) in yellow or blue??

/QUOTE]

:o Doh! That's already in there, and getting it to be bold and the really nasty ones to blink should be easy enough too - very nice!

Further question though, is it possible to set a 'negative' position for the text to start? I have made a macro that counts how many events to show and when this value exceeds a limit, then I would want another column, but only starting from somewhere further down the list?

Geoff

Geoff
 
Ok, so now I have tried modifying this code a bit for my own use but something is wrong...

Macros are now set so that their condition sets an L:Var and then it is this that is read by the EICAS list. That is currently working very nicely, thanks again Bill! The reason for the L:Var is that I want to have the massage stay on the EICAS until the master caution / warning button is pressed to clear it, even if the 'event' is no longer happening...

What also needs to happen is a counting event, so that I know how many warnings and cautions are currently in the list. If this number increases (including from 0 to 1) I want to have a chime play and then my master caution (or warning) light to deploy. I thought that a macro would output a number if it's body was a simple sum of enum variables, but there is something wrong. The setup fails to deploy the warning lights etc because the counters always return zero (I have displayed this to check). Why is that? How do I code a 'sum' of variable values?

See code below:

Code:
     <!-- XXXXXXXXXXXXXXXXXXXXXXXXX ACTION CONDITION MACROS XXXXXXXXXXXXXXXXXXXXXXXXXX -->

<!-- test condition -->

<Macro Name="AnnuncTEST">
(L:ATEST, bool) 1 == if{ 1 (>L:ATESTED, enum) }	
(L:ATESTED, enum) 1 ==
</Macro>

<!-- warnings -->

<Macro Name="DoorOpenDanger">
(A:Exit Open:0,bool) (A:Exit Open:1,bool) or (A:GROUND VELOCITY, knot) 0 &gt; and if{ 1 (>L:DoorWarn, enum) }	
(L:DoorWarn, enum) 1 ==
</Macro>

<!-- cautions -->

<Macro Name="PitotHeat">
(A:PITOT HEAT,bool) 0 == (L:PitotCaut, enum) 0 == and if{ 1 (>L:PitotCaut, enum) }		
(L:PitotCaut, enum) 1 ==
</Macro>

<Macro Name="Gear_Warning">
(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{ 1 (>L:GearWarn, enum) }		
(L:GearWarn, enum) 1 ==
</Macro>

<!-- messages -->

<Macro Name="DoorOpen">
(A:Exit Open:0,bool) (A:Exit Open:1,bool) or
</Macro>

<!-- Count the warnings etc -->

<Macro Name="CountWarnings">
@AnnuncTEST
@DoorOpenDanger +
@Gear_Warning +
</Macro>

<Macro Name="CountCautions">
@AnnuncTEST
@PitotHeat +
</Macro>

<Macro Name="CountAllMessages">
@AnnuncTEST
@CountWarnings +
@CountCautions +
@DoorOpen +
</Macro>


    <!-- XXXXXXXXXXXXXXXXXXXXXXXXX DISPLAY ITEMS IN LIST! XXXXXXXXXXXXXXXXXXXXXXXXXX -->


<Element Name="MESSAGES LIST COL1">
<Position X="10" Y="10"/>
<FormattedText X="100" Y="200" Font="Arial Black" FontSize="14" Adjust="Left" Color="red" VerticalAdjust="Center" Bright="Yes">
<Color Value="orange"/>
<Color Value="yellow"/>
<Font Font="Arial"/>
<String>
	%(@AnnuncTEST) %{if}\{blnk}TEST WARNING \{nr}\n%{end}
	%(@DoorOpenDanger) %{if}\{blnk}EXT DOOR OPEN \{nr}\n%{end}
	%(@Gear_Warning) %{if}\{blnk}CHECK GEAR \{nr}\n%{end}
	\{clr2}
	%(@AnnuncTEST) %{if}TEST CAUTION \n%{end}
	%(@PitotHeat) %{if}PITOT HEAT \n%{end}
	\{clr3}
	%(@AnnuncTEST) %{if}\{fnt2}TEST MESSAGE \n%{end}
	%(@DoorOpen) %{if}\{fnt2}EXT DOOR OPEN \n%{end}
	%(@DoorOpen) %{if}\{fnt2}CARGO DOOR OPEN \n%{end}
</String>
</FormattedText>
</Element>


    <!-- XXXXXXXXXXXXXXXXXXXXXXXXX SET WARN / CAUT LIGHTS XXXXXXXXXXXXXXXXXXXXXXXXXX -->

<Element>
<Select>
<Value>
@CountWarnings (L:LastWarnCount, enum) > if{ @CountWarnings (>L:LastWarnCount, enum) 7 (>L:Autocabin_xml_sound_id,enum) (L:MasterWarn,enum) 0 == if{ 1 (>L:MasterWarn,enum) }} els{ @CountWarnings (>L:LastWarnCount, enum)
</Value>
</Select>
</Element>

<Element>
<Select>
<Value>
@CountCautions (L:LastCautCount, enum) > if{ @CountCautions (>L:LastCautCount, enum) 4 (>L:Autocabin_xml_sound_id,enum) (L:MasterCaut,enum) 0 == if{ 1 (>L:MasterCaut,enum) }} els{ @CountWarnings (>L:LastWarnCount, enum)
</Value>
</Value>
</Select>
</Element>

Obviously, the final gauge will have many many more possible events but this one is just for testing the concept... Also, for the master caution and warning systems there is another gauge elsewhere that includes code to set all the relevant event L:Vars to 0 if they are 1 when the master caution or warning var is 0, as well as a mouse area to set the master value to 0... (there is nothing problematic there)

PS. The third couning macro that gives the whole length of the list will be used later to 'decide' is a second column is needed and a bitmap mask (with a suitably sized area or RGB=0.0.0) will be placed to ensure that the correct text is displayed.

Thanks,

Geoff
 
Last edited:
What do you think the last line is supposed to accomplish?

Code:
<Macro Name="PitotHeat">
     (A:PITOT HEAT,bool) 0 == (L:PitotCaut, enum) 0 == and if{ 1 (>L:PitotCaut, enum) }		
     (L:PitotCaut, enum) 1 ==
</Macro>

You can't "sum" @Macros. You can however keep track of whether the @Macro's conditions are true or false, and keep count that way.

Remember that @Macros aren't magical, they are simply literal replacements for ASCII text!

Maybe something like this:
Code:
<Macro Name="PitotHeat">
     (A:PITOT HEAT,bool) 0 == (L:PitotCaut, enum) 0 == and 
          if{ 1 (>L:PitotCaut, enum) (L:ActiveCount,enum) ++ (>L:ActiveCount,enum) }		
         els{ (L:ActiveCount,enum) -- (>L:ActiveCount,enum) }     
</Macro>

The above will increment the (L:ActiveCount,enum) variable by 1 if the @Macro's conditions are TRUE, and decrement by 1 if FALSE. By including the same lines in each @Macro you should then have an accurate count of all active warnings at the end of each gauge cycle.
 
Last edited:
What do you think the last line is supposed to accomplish?

Code:
<Macro Name="PitotHeat">
     (A:PITOT HEAT,bool) 0 == (L:PitotCaut, enum) 0 == and if{ 1 (>L:PitotCaut, enum) }		
     (L:PitotCaut, enum) 1 ==
</Macro>

You can't "sum" @Macros. You can however keep track of whether the @Macro's conditions are true or false, and keep count that way.

Remember that @Macros aren't magical, they are simply literal replacements for ASCII text!

I thought that the macro was literally 'pasted in' to the code so that line would give a value for the macro to evaluate. I had assumed that the macro could contain a load of code that would execute and then anything remaining be seen as a 'question'... Like in a <visible></visible> tag where the <visible>(L:PitotCaut, enum) 1 ==</visible> would evaluate 1 or 0.

So you can't make the statement @macro1 @macro2 + aqnd hope to see 0, 1 or 2 depending on if they evaluate both as 0, both as 1 or one of each. Ok, understood...

I have put together the following and will go and test...

Code:
     <!-- XXXXXXXXXXXXXXXXXXXXXXXXX ACTION CONDITION MACROS XXXXXXXXXXXXXXXXXXXXXXXXXX -->

<!-- reset message counters -->

<Element>
<Select>
<Value>
(L:WarnCount,enum) 0 != if{ 0 (>L:WarnCount,enum) } 
(L:CautCount,enum) 0 != if{ 0 (>L:CautCount,enum) } 
(L:MessageCount,enum) 0 != if{ 0 (>L:MessageCount,enum) } 
</Value>
</Select>
</Element>


<!-- test condition -->

<Element>
<Select>
<Value>
(L:ATEST, bool) 1 == (L:ATESTED, enum) 0 == and 
if{ 
1 (>L:ATESTED, enum) 
}
</Value>
</Select>
</Element>
<Macro Name="AnnuncTEST">
(L:ATESTED, bool) 1 == 
if{ 
(L:WarnCount,enum) ++ (>L:WarnCount,enum) (L:CautCount,enum) ++ (>L:CautCount,enum) (L:MessageCount,enum) ++ (>L:MessageCount,enum) 
} 
</Macro>



<!-- warnings -->

<Element>
<Select>
<Value>
(A:Exit Open:0,bool) (A:Exit Open:1,bool) or (A:GROUND VELOCITY, knot) 0 &gt; and 
if{ 
1 (>L:DoorWarn, enum) 
}
</Value>
</Select>
</Element>
<Macro Name="DoorOpenDanger">
(L:DoorWarn, enum) 1 ==
if{ 
(L:WarnCount,enum) ++ (>L:WarnCount,enum) (L:MessageCount,enum) ++ (>L:MessageCount,enum) 
} 
</Macro>

<Element>
<Select>
<Value>
(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{ 
1 (>L:GearWarn, enum)
}
</Value>
</Select>
</Element>
<Macro Name="Gear_Warning">
(L:GearWarn, enum) 1 == 
if{ 
(L:WarnCount,enum) ++ (>L:WarnCount,enum) (L:MessageCount,enum) ++ (>L:MessageCount,enum) 
} 
</Macro>



<!-- cautions -->

<Element>
<Select>
<Value>
(A:PITOT HEAT,bool) 0 == (L:PitotCaut, enum) 0 == and 
if{ 
1 (>L:PitotCaut, enum) 
}
</Value>
</Select>
</Element>
<Macro Name="PitotHeat">
(L:PitotCaut, enum) 1 == 
if{ 
(L:CautCount,enum) ++ (>L:CautCount,enum) (L:MessageCount,enum) ++ (>L:MessageCount,enum) 
}
</Macro>



<!-- messages -->

<Macro Name="DoorOpen">
(A:Exit Open:0,bool) (A:Exit Open:1,bool) or 
if{ 
(L:MessageCount,enum) ++ (>L:MessageCount,enum) 
}
</Macro>


    <!-- XXXXXXXXXXXXXXXXXXXXXXXXX DISPLAY ITEMS IN LIST - COLUMN1 ! XXXXXXXXXXXXXXXXXXXXXXXXXX -->


<Element Name="MESSAGES LIST COL1">
<Position X="2" Y="336"/>
<FormattedText X="140" Y="200" Font="Arial Black" FontSize="14" Adjust="Left" Color="red" VerticalAdjust="Center" Bright="Yes">
<Color Value="orange"/>
<Color Value="yellow"/>
<Font Font="Arial"/>
<String>
	%(@AnnuncTEST) %{if}\{blnk}TEST WARNING \{nr}\n%{end}
	%(@DoorOpenDanger) %{if}\{blnk}EXT DOOR OPEN \{nr}\n%{end}
	%(@Gear_Warning) %{if}\{blnk}CHECK GEAR \{nr}\n%{end}
	\{clr2}
	%(@AnnuncTEST) %{if}TEST CAUTION \n%{end}
	%(@PitotHeat) %{if}PITOT HEAT \n%{end}
	\{clr3}
	%(@AnnuncTEST) %{if}\{fnt2}TEST MESSAGE \n%{end}
	%(@DoorOpen) %{if}\{fnt2}EXT DOOR OPEN \n%{end}
	%(@DoorOpen) %{if}\{fnt2}CARGO DOOR OPEN \n%{end}
</String>
</FormattedText>
</Element>


    <!-- XXXXXXXXXXXXXXXXXXXXXXXXX SET WARN / CAUT LIGHTS XXXXXXXXXXXXXXXXXXXXXXXXXX -->


<Element>
<Select>
<Value>
(L:WarnCount,enum) (L:LastWarnCount, enum) > if{ 7 (>L:Autocabin_xml_sound_id,enum) (L:MasterWarn,enum) 0 == if{ 1 (>L:MasterWarn,enum) }} (L:WarnCount,enum) (>L:LastWarnCount, enum)
</Value>
</Select>
</Element>

<Element>
<Select>
<Value>
(L:CautCount,enum) (L:LastCautCount, enum) > if{ 4 (>L:Autocabin_xml_sound_id,enum) (L:MasterCaut,enum) 0 == if{ 1 (>L:MasterCaut,enum) }} (L:CautCount,enum) (>L:LastCautCount, enum)
</Value>
</Value>
</Select>
</Element>

<!-- reset message counters -->

<Element>
<Select>
<Value>
(L:WarnCount,enum) 0 != if{ 0 (>L:WarnCount,enum) } 
(L:CautCount,enum) 0 != if{ 0 (>L:CautCount,enum) } 
(L:MessageCount,enum) 0 != if{ 0 (>L:MessageCount,enum) } 
</Value>
</Select>
</Element>


    <!-- XXXXXXXXXXXXXXXXXXXXXXXXX DISPLAY ITEMS IN LIST - COLUMN2 ! XXXXXXXXXXXXXXXXXXXXXXXXXX -->


<Element Name="MESSAGES LIST COL2">
<Visible>(L:MessageCount,enum) 6 &gt;</Visible>
<Position X="159" Y="186"/>
<FormattedText X="140" Y="200" Font="Arial Black" FontSize="14" Adjust="Left" Color="red" VerticalAdjust="Center" Bright="Yes">
<Color Value="orange"/>
<Color Value="yellow"/>
<Font Font="Arial"/>
<String>
	%(@AnnuncTEST) %{if}\{blnk}TEST WARNING \{nr}\n%{end}
	%(@DoorOpenDanger) %{if}\{blnk}EXT DOOR OPEN \{nr}\n%{end}
	%(@Gear_Warning) %{if}\{blnk}CHECK GEAR \{nr}\n%{end}
	\{clr2}
	%(@AnnuncTEST) %{if}TEST CAUTION \n%{end}
	%(@PitotHeat) %{if}PITOT HEAT \n%{end}
	\{clr3}
	%(@AnnuncTEST) %{if}\{fnt2}TEST MESSAGE \n%{end}
	%(@DoorOpen) %{if}\{fnt2}EXT DOOR OPEN \n%{end}
	%(@DoorOpen) %{if}\{fnt2}CARGO DOOR OPEN \n%{end}
</String>
</FormattedText>
</Element>

The reason for splitting the parts up is that I want the warning to trigger when the event happens, but the message should remain active until it has been dismissed. The "(A:PITOT HEAT,bool) 0 == (L:PitotCaut, enum) 0 == and " would only be true on the cycle that the pitot heat was turned off...

Also, I removed the decrement counters, because the last part of the gauge resets the counters to zero anyway, because by then the numbers are doubled up since (I guess) each time the macro is called the numbers will increment..? For this reason the code that 'uses' the counters is sandwiched in between the two pages of 'output'...

Now off to see if it works!

Geoff
 
I thought that the macro was literally 'pasted in' to the code so that line would give a value for the macro to evaluate. I had assumed that the macro could contain a load of code that would execute and then anything remaining be seen as a 'question'... Like in a <visible></visible> tag where the <visible>(L:PitotCaut, enum) 1 ==</visible> would evaluate 1 or 0.

A @Macro doesn't ever "do anything" at all. It is simply a handy way to substitute a "name" for a complex bit of XML script that you will need to use multiple times in multiple places.

It is nothing more complicated than this:

@x = "I am a geek"
@y = "waffle on"

So, if I write a sentence like this:

@x so I tend to sometimes @y, but that's only because @x!

If you literally replace the above with the contents of @x and @y, you will then have a complete sentence. This happens as soon as the XML script is parsed during aircraft loading, so the only thing the flight simulator ever "sees" is the complete sentence... :D
 
Last edited:
Hi Bill,

I assumed he wanted the result of the macro to be either 1 or 0. So if

(L:PitotCaut, enum) 1 ==

was true the value returned would be one (true), and zero if not.

That doesn't work?


PS. I do understand the difference between true and one. :)
 
Hi Bill,

I assumed he wanted the result of the macro to be either 1 or 0. So if

(L:PitotCaut, enum) 1 ==

was true the value returned would be one (true), and zero if not.

That doesn't work?

No, because as it stands there all alone and lonely, it is an incomplete expression. It actually does nothing whatever since there's no "evaluator expression." ;)

Now, if it were sandwiched in a <Visibility> expression, then it would be evaluated and return either 1 or 0.
 
Mostly got the annunciators working now - took a break for a few days to do other stuff and then, with a clear head, saw the errors straight away! However, I still have one issue:

How do I make some lines of the text (warnings, which also flash, and cautions) bold and not others? I tried having a second font with a <font font="Arial Black">, and then calling that with /{fnt2}, but it didn't work... Ideas?

Current code snippet and image of the output below...

Code:
<Element Name="MESSAGES LIST COL1">
<Position X="12" Y="368"/>
<FormattedText X="140" Y="100" Font="Arial" FontSize="15" Adjust="Left" Color="red" VerticalAdjust="Center" Bright="Yes" LineSpacing="16">
<Color Value="orange"/>
<Color Value="yellow"/>
<String>%((L:ATESTED, bool))%{if}\{blnk}TEST WARNING\{nr}\n%{end}
%((L:DoorWarn, enum) 1 ==)%{if}\{blnk}EXT DOOR OPEN\{nr}\n%{end}
%((L:GearWarn, enum) 1 ==)%{if}\{blnk}CHECK GEAR\{nr}\n%{end}
\{clr2}%((L:ATESTED, bool))%{if}TEST CAUTION\n%{end}
%((L:PitotCaut, enum))%{if}AIR DATA HEAT OFF\n%{end}
\{clr3}%((L:ATESTED, bool))%{if}TEST MESSAGE\n%{end}
%((A:Exit Open:0,bool) (A:Exit Open:1,bool) or)%{if}EXT DOOR OPEN\n%{end}
%((A:Exit Open:0,bool) (A:Exit Open:1,bool) or)%{if}CARGO DOOR OPEN\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 1\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 2\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 3\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 4\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 5\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 6\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 7\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 8\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 9\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 10\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 11\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 12\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 13\n%{end}
%((L:ATESTED, bool))%{if}MESSAGE DUMMY LINE 14\n%{end}
</String>
</FormattedText>
</Element>

Auunciators.jpg


PS. It's a B712 EICAS.

PPS. Bold text does work with the "\{bo}" and "\{nr}" tags - should have searched more carefully before posting!

Cheers,
Geoff
 
Last edited:
Looking good! <FormattedText> is so much fun! I'm glad you reread the section of the SDK about using the escape codes!
 
Formatted Text "Unformatted"...

I'm having an issue here with this formatted text stuff...

I'm on FSXA, and I'm using the Ace XML tool tying to get some simple annunciator display.

I have this code:

Code:
            <Macro Name="Autobrake_Armed_Min">
                <MacroValue>(A:AUTO BRAKE SWITCH CB, number) 2 ==</MacroValue>
            </Macro>
            <Macro Name="Autobrake_Armed_Med">
                <MacroValue>(A:AUTO BRAKE SWITCH CB, number) 4 ==</MacroValue>
            </Macro>
            <Macro Name="Autobrake_Armed_Max">
                <MacroValue>(A:AUTO BRAKE SWITCH CB, number) 0 ==</MacroValue>
            </Macro>
            <Macro Name="Spoilers_Armed">
                <MacroValue>(A:SPOILERS ARMED, bool)</MacroValue>
            </Macro>

            <Macro id="Macro" Name="CautionCondition">
                        <MacroValue>
				@Autobrake_Armed_Min
				@Autobrake_Armed_Med or
				@Autobrake_Armed_Max or
				@Spoilers_Armed or
			</MacroValue>
            </Macro>

            <Element id="Alert Messages">
                <FloatPosition>5.000,215.000</FloatPosition>
                <Visibility@CautionCondition</Visibility>
                <GaugeText id="GaugeText">
                    <Bold>True</Bold>
                    <Bright>True</Bright>
                    <FontColor>white</FontColor>
                    <FontHeight>10</FontHeight>
                    <GaugeString>
                    %(@Autobrake_Armed_Min) %{if}AUTOBRAKE MIN\n%{end}
                    %(@Autobrake_Armed_Med) %{if}AUTOBRAKE MED\n%{end}
                    %(@Autobrake_Armed_Max) %{if}AUTOBRAKE MAX\n%{end}
                    %(@Spoilers_Armed) %{if}SPOILERS ARMED\n%{end}
                    </GaugeString>
                    <Size>150,70</Size>
                    <Transparent>True</Transparent>
                    <VerticalAlign>CENTER</VerticalAlign>
                </GaugeText>
            </Element>
...and the problem here is that the text displays "unformatted"...
...in the beginning of each line I get one space character per a non displayed text line on the code...

For example, if I don't arm the autobrake MIN, and arm the spoilers, it displays like this:
Code:
AUTOBRAKE MIN
  SPOILERS ARMED
there are two spaces left to the SPOILERS ARMED...

If I don't arm the autobrake MAX, and arm the spoilers, it displays like this:
Code:
  AUTOBRAKE MAX
SPOILERS ARMED
there are two spaces left to the AUTOBRAKE MAX
...

If I arm the spoilers alone, it displays like this:
Code:
   SPOILERS ARMED
there are three spaces left to the SPOILERS ARMED...

Any ideas how to solve this? It becomes a complete mess with a large warning list...
 
Last edited:
My knowledge is only that which I have gleaned here over the last days, and the syntax you are using is slightly different, but I was able to eliminate these kind of issues by trial and error (I did see this kind of thing at first).

This is working perfectly:

Code:
<Element Name="MESSAGES LIST COL2">
<Position X="168" Y="268"/>
<FormattedText X="140" Y="166" Font="Arial" FontSize="15" Adjust="Left" Color="red" VerticalAdjust="Center" Bright="Yes" LineSpacing="16">
<Color Value="orange"/>
<Color Value="yellow"/>
<String>%((L:WARN1, enum) 1 ==)%{if}\{bo}\{blnk}CABIN ALTITUDE\{nr}\n%{end}
%((L:WARN2, enum) 1 ==)%{if}\{bo}\{blnk}STALL\{nr}\n%{end}
%((L:WARN3, enum) 1 ==)%{if}\{bo}\{blnk}OVERSPEED\{nr}\n%{end}
%((L:WARN4, enum) 1 ==)%{if}\{bo}\{blnk}ENG 1 FAIL\{nr}\n%{end}
%((L:WARN5, enum) 1 ==)%{if}\{bo}\{blnk}ENG 2 FAIL\{nr}\n%{end}
%((L:WARN6, enum) 1 ==)%{if}\{bo}\{blnk}ENGINE 1 FIRE\{nr}\n%{end}
%((L:WARN7, enum) 1 ==)%{if}\{bo}\{blnk}ENGINE 2 FIRE\{nr}\n%{end}
%((L:WARN8, enum) 1 ==)%{if}\{bo}\{blnk}ENGINE 1 FIRE\{nr}\n%{end}
%((L:WARN8, enum) 1 ==)%{if}\{bo}\{blnk}ENGINE 2 FIRE\{nr}\n%{end}
%((L:WARN8, enum) 1 ==)%{if}\{bo}\{blnk}APU FIRE\{nr}\n%{end}
%((L:WARN9, enum) 1 ==)%{if}\{bo}\{blnk}FIRE DET L FAIL\{nr}\n%{end}
%((L:WARN9, enum) 1 ==)%{if}\{bo}\{blnk}FIRE DET R FAIL\{nr}\n%{end}
%((L:WARN9, enum) 1 ==)%{if}\{bo}\{blnk}FIRE DET APU FAIL\{nr}\n%{end}
%((L:GPWS_PLUP,enum) 0 &gt;)%{if}\{bo}GPWS: PULL UP\{nr}\n%{end}
%((L:GPWS_SRAT,enum) 0 &gt;)%{if}\{bo}GPWS: SINKRATE\{nr}\n%{end}
%((L:GPWS_TETE,enum) 0 &gt;)%{if}\{bo}GPWS: TERRAIN\{nr}\n%{end}
%((L:GPWS_WSHR,enum) 0 &gt;)%{if}\{bo}GPWS: WINDSHEAR\{nr}\n%{end}
%((L:GPWS_TEST,enum) 0 &gt;)%{if}\{bo}GPWS: TEST OK\{nr}\n%{end}
\{clr2}%((L:GPWS_BANK,enum) 0 &gt;)%{if}\{bo}GPWS: BANK ANGLE\{nr}\n%{end}
%((L:GPWS_DSNK,enum) 0 &gt;)%{if}\{bo}GPWS: DONT SINK\{nr}\n%{end}
%((L:GPWS_GLID,enum) 0 &gt;)%{if}\{bo}GPWS: GLIDESLOPE\{nr}\n%{end}
%((L:GPWS_MINS,enum) 0 &gt;)%{if}\{bo}GPWS: MINIMUMS\{nr}\n%{end}
%((L:GPWS_FLPS,enum) 0 &gt;)%{if}\{bo}GPWS: TOO LOW - FLAPS\{nr}\n%{end}
%((L:GPWS_GEAR,enum) 0 &gt;)%{if}\{bo}GPWS: TOO LOW - GEAR\{nr}\n%{end}
%((L:GPWS_TERR,enum) 0 &gt;)%{if}\{bo}GPWS: TOO LOW - TERRAIN\{nr}\n%{end}
%((L:GPWS_TESTON,enum) 0 &gt;)%{if}\{bo}GPWS: TEST OK\{nr}\n%{end}
%((L:CAUT3, enum) 1 ==)%{if}\{bo}EMER BRAKING\{nr}\n%{end}
%((L:TRP_derate1,enum) 0 &gt;)%{if}\{bo}FADEC 1 DERATE\{nr}\n%{end}
%((L:TRP_derate2,enum) 0 &gt;)%{if}\{bo}FADEC 2 DERATE\{nr}\n%{end}
%((L:CAUT1, enum) 1 ==)%{if}\{bo}LOW SPEED PROT\{nr}\n%{end}
%((L:CAUT2, enum) 1 ==)%{if}\{bo}TO/GA MODE AUTO\{nr}\n%{end}
%((L:CAUT31, enum) 1 ==)%{if}\{bo}GPWS: SYS OFF\{nr}\n%{end}
\{clr3}%((A:Pitot heat, bool) 0 ==)%{if}AIR DATA HEAT OFF\n%{end}
%((A:Auto brake switch cb, enum) 1 == (A:Gear handle position,percent) 10 &gt; &amp;&amp; (A:GROUND VELOCITY, knots) 1 &gt; &amp; (A:Vertical speed,feet per minute) 500 &lt; &amp;)%{if}AUTOBRAKE OFF\n%{end}
%((A:Electrical master battery,bool) !)%{if}BATT SWITCH OFF\n%{end}
%((L:EMERPWR, enum) -1 ==)%{if}EMER PWR SW OFF\n%{end}
%((A:EXIT OPEN, enum) 1 ==)%{if}DOOR OPEN\n%{end}
%((A:FUEL TOTAL QUANTITY, gallons) (A:FUEL TOTAL CAPACITY, gallons) / 0.1 &lt;)%{if}FUEL LEVEL LO\n%{end}
%((A:STRUCTURAL DEICE SWITCH,bool) ! (A:GENERAL ENG1 ANTI ICE POSITION, bool) ! (A:GENERAL ENG2 ANTI ICE POSITION, bool) ! (L:windshieldIce, bool) ! or or or (L:IceCond,enum) 1 == &amp;&amp;)%{if}ICE DETECTED\n%{end}
%((A:FUEL TANK LEFT MAIN QUANTITY, lbs) (A:FUEL TANK RIGHT MAIN QUANTITY, lbs) - abs 1400 &gt;)%{if}LAT FUEL UNBAL\n%{end}
%((A:SPOILERS RIGHT POSITION,percent) 25 &gt; (A:SPOILERS LEFT POSITION,percent) 25 &gt; &amp;&amp; (A:Flaps handle index, number) 2 &gt; &amp; (A:SIM ON GROUND, bool) ! &amp;)%{if}SPEEDBRAKE/FLAP\n%{end}
</String>
</FormattedText>
</Element>

Geoff
 
I'm having an issue here with this formatted text stuff...
<snipped for brevity>
Any ideas how to solve this? It becomes a complete mess with a large warning list...

Yes, use <FormatedText> in a single <Element> rather than simple <Text> in multiple <Element> sections like you have...

Unfortunately, the ACES Tool and FSX XML Schema do not support <FormattedText>, so you'll have to script the gauge in an ASCII editor such as notepad.exe or xmlnotepad.exe http://www.microsoft.com/download/en/details.aspx?id=7973
 
Last edited:
Back
Top