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

FSXA XML Code Help needed

Messages
111
Country
germany
Hi there,

I am working on a Caution Panel for a helicopter project and am stuck on some of the code...

1. Generator Lights are coded like this:

<Element id="No.1 Generator OFF">
<FloatPosition>60.000,30.000</FloatPosition>
<Visibility>(A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 0 } els{ 1 }</Visibility>
<SizeScale>1.400</SizeScale>
<Image id="Caution_No1_Generator_ON.bmp" Name="Caution_No1_Generator_ON.bmp">
<Transparent>True</Transparent>
</Image>
</Element>


Basically they work fine, but, they maintain lit when the battery is switched off....

2. Hydraulic Pressure Lights are coded like this:

<Element id="Aux Servo Press">
<FloatPosition>170.000,245.000</FloatPosition>
<Visibility>(A:Engine HYDRAULIC PRESSURE,Pounds per square foot) 1008000 &lt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if { 1 } els { 0 }</Visibility>
<SizeScale>1.400</SizeScale>
<Image id="Caution_Aux_Servo_Press_ON.bmp" Name="Caution_Aux_Servo_Press_ON.bmp">
<Transparent>True</Transparent>
</Image>
</Element>

They aren't doing anything :(

3. Fuel Low Lights are coded like this:

<Element id="FWD Fuel Low">
<FloatPosition>62.000,138.000</FloatPosition>
<Visibility> (A:Fuel Tank Right Main Quantity,gallons) 40 &lt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if { 0 } els{ 1 }</Visibility>
<SizeScale>1.400</SizeScale>
<Image id="Caution_Fwd_Fuel_Low_ON.bmp" Name="Caution_Fwd_Fuel_Low_ON.bmp">
<Transparent>True</Transparent>
</Image>
</Element>

They also don't do nothing...


Any help would be highly appreciated. :)
 
The second two have a space between the 'if/else' and the '{'.

The first one you could possibly use;

A:ELECTRICAL MASTER BATTERY,Bool

instead of the partial panel variable.

I've never used partial panels like that, I usually put them in the the failures section ... I feel a little test gauge coming on ...
 
Last edited:
Ok, problems solved. Actually the usage of the "ELECTRICAL MASTER BATTERY" value made no difference, but while looking at that line of code again, I suddenly knew it...

Here's what I did:
<Visibility>(A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0.5 &lt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
 
OK, here I am again. The Caution Panel still working as it is expected to do, I drilled new holes into my panel to fill them with lights. Unfortunately, they do display right on lamptest, the don't display on the set condition. :( Anyone here to help me up that horse?

1. Battery_Hot_Light

This Light should be lit in case, that Battery is ON, respective Generator is ON and a certain amount of time has passed...

<SimGauge.Gauge id="Gauge" ArtDirectory="F:/Mk41">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>26,26</Size>
<Image id="RED_Off.bmp" Name="RED_Off.bmp">
<Transparent>True</Transparent>
</Image>
<Element id="Lamptest">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:Lamp_Test,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="RED_ON.bmp" Name="RED_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
<Element id="Battery_Hot">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(A:ELECTRICAL MASTER BATTERY,bool) 0.5 &gt; (A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0,5 &gt; and if{ 1 } els{ 0 }</Visibility>
<Image id="RED_ON.bmp" Name="RED_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
</SimGauge.Gauge>

2. Load_On_Hook_Light

his is to be lit, when there ist something attached to either sling or hoist.

<SimGauge.Gauge id="Gauge" ArtDirectory="F:/Mk41">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>26,26</Size>
<Image id="RED_Off.bmp" Name="RED_Off.bmp">
<Transparent>True</Transparent>
</Image>
<Element id="Lamptest">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:Lamp_Test,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="GREEN_ON.bmp" Name="GREEN_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
<Element id="Hoist">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:SLING OBJECT ATTACHED:0,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="GREEN_ON.bmp" Name="GREEN_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
<Element id="External_Load">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:SLING OBJECT ATTACHED:1,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="GREEN_ON.bmp" Name="GREEN_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
</SimGauge.Gauge>

3. Auto_Catch_Light

Here I want the light to work, when the "pickup mode" of sling/hoist is activated...

<SimGauge.Gauge id="Gauge" ArtDirectory="F:/Mk41">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>26,26</Size>
<Image id="RED_Off.bmp" Name="RED_Off.bmp">
<Transparent>True</Transparent>
</Image>
<Element id="Lamptest">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:Lamp_Test,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="AMBER_ON.bmp" Name="AMBER_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
<Element id="Hoist">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(A:SLING HOOK IN PICKUP MODE:0,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="AMBER_ON.bmp" Name="AMBER_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
<Element id="External_Load">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(A:SLING HOOK IN PICKUP MODE:1,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="AMBER_ON.bmp" Name="AMBER_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
</SimGauge.Gauge>

Thanks in advance for your help. :)
 
Ok, problems solved. Actually the usage of the "ELECTRICAL MASTER BATTERY" value made no difference, but while looking at that line of code again, I suddenly knew it...

Here's what I did:
<Visibility>(A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0.5 &lt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>

That really makes no sense at all. A 'bool' type variable can only ever be either 0 or 1...

Also, it has been mentioned many times that even the programmers have stated that the only guaranteed value is 0 (zero). Because of rounding errors, frequently instead of 1 we might actually get 0.999999998, which of course would cause a check for 1 to fail. :eek:

Best chance for success is to always check for zero or not-zero

(A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0 == (battery off)
(A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0 != (battery on)
 
Hey Bill,

thx for the reply. The funny thing is, my code, as false as it may be, works flawless... for whatever reason...
 
Hey Bill,

thx for the reply. The funny thing is, my code, as false as it may be, works flawless... for whatever reason...

Well of course it does, after all 0.5 is definitely less than 1.0...

It's just a very strange way of writing boolean logic!
 
Back
Top