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

Multiple "OR's"

Messages
27
Country
unitedkingdom
Hallo

I am new to XML programming and would like some help with a gauge I have created. It is a simple blinking lamp which should blink when any door is open.
I have a different element for each door. However, I would like to use only one element with all the conditions checked using "OR" statements.
E.g. Door 1 open OR Door 2 open OR Door 3 open etc.
My code is shown below. Any help appreciated.

Code:
<Gauge Name="Red Signal Lamp" Version="0.1">
<Image Name="Signal.bmp" Luminous="No" ImageSizes="159,230"/>
<!-- DISPLAY =============================================== -->
<Element>
		<Image Name="Red_Lamp_Off.bmp" Luminous="Yes" ImageSizes="93,93"/>
		<Position X="33" Y="32"/>
</Element>

<Element>
		<Position X="33" Y="32"/>
		<Visible>(A:CANOPY OPEN,bool) (P:Absolute time,seconds) 1 % 0.7 > ! and</Visible>
		<Image Name="Red_Lamp_On.bmp" Luminous="Yes" ImageSizes="93,93"/>
		
</Element>

<Element>
		<Position X="33" Y="32"/>
		<Visible>(A:EXIT OPEN:1,bool) (P:Absolute time,seconds) 1 % 0.7 > ! and</Visible>
		<Image Name="Red_Lamp_On.bmp" Luminous="Yes" ImageSizes="93,93"/>
		
</Element>

<Element>
		<Position X="33" Y="32"/>
		<Visible>(A:EXIT OPEN:2,bool) (P:Absolute time,seconds) 1 % 0.7 > ! and</Visible>
		<Image Name="Red_Lamp_On.bmp" Luminous="Yes" ImageSizes="93,93"/>
		
</Element>

<Element>
		<Position X="33" Y="32"/>
		<Visible>(A:EXIT OPEN:3,bool) (P:Absolute time,seconds) 1 % 0.7 > ! and</Visible>
		<Image Name="Red_Lamp_On.bmp" Luminous="Yes" ImageSizes="93,93"/>
		
</Element>

<Element>
		<Position X="33" Y="32"/>
		<Visible>(A:FOLDING WING RIGHT PERCENT, percent) 100 == (P:Absolute time,seconds) 1 % 0.7 > ! and</Visible>
		<Image Name="Red_Lamp_On.bmp" Luminous="Yes" ImageSizes="93,93"/>
		
</Element>

</Gauge>
 
Hello Eisbahn,


First, your doors should be 'percent' and not 'bool', and say 1 &gt; for percentage. Bool will only 'react', so if something occurs, like reloading the aircraft, the doors position would be lost, and so closing a door could cause the alarm to go off.

Also, I am not sure, but usually when people write timer events, they place the P: section in the front. I have no idea if that matters, but I have noted it. I am learning the timer 'thing' myself presently.


Bill
 
Hello Bill,

Thanks for your reply.
I think you may have misunderstood my request.
Actually the code functions absolutely perfectly.
I just think there must be a simpler solution as to using a separate element for each door.

Regards
 
The solution is simple. Just stack the (conditions) and add an "or" for each pair.

Although the "doors" are technically "percent" and not "bool" types, the reason it works is that (condition,bool) simply means "not zero" when evaluated.

By the way, (A:CANOPY OPEN,percent) is the same as (A:EXIT OPEN:0,percent).

Code:
<Gauge Name="Red Signal Lamp" Version="0.1">
  <Image Name="Signal.bmp" Luminous="No" ImageSizes="159,230"/>
  <!-- DISPLAY =============================================== -->
  <Element>
    <Image Name="Red_Lamp_Off.bmp" Luminous="Yes" ImageSizes="93,93"/>
    <Position X="33" Y="32"/>
  </Element>

  <Element>
    <Position X="33" Y="32"/>
    <Visible>
      (A:CANOPY OPEN,bool)
      (A:EXIT OPEN:1,bool)
      or
      (A:EXIT OPEN:2,bool)
      or
      (A:EXIT OPEN:3,bool)
      or
      (A:FOLDING WING RIGHT PERCENT, percent) 100 ==
      or
      (P:Absolute time,seconds) 1 % 0.7 > ! 
      and
    </Visible>
    <Image Name="Red_Lamp_On.bmp" Luminous="Yes" ImageSizes="93,93"/>
  </Element>
</Gauge>
 
Hey guys,


I am trying to make a condition based on fuel level where this would come on. Unfortunately, its not working.

Any clue as to what I am doing wrong? I have the correct fuel string for percent, and even created a 'if' logic to help the blinker to only come on when at that fuel level or less.

I have tried 8 &lt; and range, 1 8, and that didnt work.

Code:
Version One
                 <Visible>
                       1 8 (A:FUEL TOTAL QUANTITY,percent) rng (P:Absolute time,seconds) 3 % 0.7 > ! 
                 </Visible>

Version Two
                 <Visible>
                       (A:FUEL TOTAL QUANTITY,percent) 8 &lt; (P:Absolute time,seconds) 3 % 0.7 > ! 
                 </Visible>

Version Three
                 <Visible>
                    (A:Avionics Master Switch,bool) 1 ==
                     if{
                       (A:FUEL TOTAL QUANTITY,percent) 8 &lt; (P:Absolute time,seconds) 3 % 0.7 > ! 
                       }
                 </Visible>

Version Four
                 <Visible>
                    (A:Avionics Master Switch,bool) 1 ==
                     if{
                       1 8 (A:FUEL TOTAL QUANTITY,percent) rng (P:Absolute time,seconds) 3 % 0.7 > ! 
                       }
                 </Visible>

Any idea's? Am I missing something?
 
Last edited:
I can't follow your logic, but it seems you are testing two different things (fuel and time), but I see no "and" or "or" to join them?
 
Tom,

All it is trying to do is have a caution light appear that is blinking if the fuel is below 8%.

hmmm... Let me try that.

(I actually need it turned off when its at 0%, thats why I went from 1 to 8% fuel readings).

Bill
 
Code:
                 <Visible>
                       1 8 (A:FUEL TOTAL QUANTITY,percent) rng 
                       (P:Absolute time,seconds) 3 % 0.7 > ! 
                       and
                 </Visible>
 
Back
Top