• 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 Visibility issue!!!

Messages
1,749
Country
unitedstates
I can't turn off the light from the battery or the avionics........
Normally i can. i tried adding the avionics to the visible code and added another AND...... That usually works. But it's not. I figure it's because i am using BCO16 as the units.....

Please help me rewrite using only visibility or value. Or a mix....


This works perfect below with no battery or avionics control...

Code:
<Element>
    	<Visible>(L:POWER2, enum) (A:TRANSPONDER CODE:1, BCO16)  4608 == if{ 1 } els{ 0 } and</Visible>
     <Position X="0" Y="0"/>
        <Value>
              (A:Electrical master battery, Bool) !
	if { (A:ELECTRICAL AVIONICS BUS VOLTAGE, Bool) 23 &gt; }
        </Value>
        <Failures>
           <SYSTEM_ELECTRICAL_PANELS Action="0"/>
        </Failures>
           <Image Name="XPNDR_Test_light_On.bmp"/>
</Element>

DG:confused:
 
Last edited:
Code:
<Gauge Name="XPNDR TEST MODE LIGHT" Version="1.0">

<Element>
  <Select>
    <Value>(A:Electrical master battery, Bool) 1 == (A:ELECTRICAL AVIONICS BUS VOLTAGE, Bool) 23 &gt; (A:TRANSPONDER CODE:1, BCO16) 4608 != &amp;&amp; &amp;&amp; if{ 1 } els{ 0 }</Value>
    <Case Value="0">
      <Image Name="XPNDR_Test_light_Off.bmp" ImageSizes="50,50"/>
    </Case>
    <Case Value="1">
      <Image Name="XPNDR_Test_light_On.bmp" ImageSizes="50,50"/>
    </Case>
  </Select>
</Element>

<Mouse>
  <Tooltip ID="TOOLTIPTEXT_XPNDR_SET_CODE_1200"/>
</Mouse>

</Gauge>
 
Thank you very much!

I see! keep the if statement last and use ;&amp;
instead of andand....

Um, no. XML script is backwards!

Instead of
Code:
if (condition) then { action }
XML reverses the order like this
Code:
( condition ) if{ action }
 
Good Morning Bill,


i stated to keep the if { } last.
That's what you just posted....( condition ) if{ action }

Condition first and if statement last!!!

By the way that code Chris posted ran the freq backwards.....
So i changed ...........4068 != to 4068 ==

Works great!

Take a look at this crazy xml i just wrote. i simplified and had to write this over 25 times....
2 light modes on 1 light working from a 4 way switch....

This kills the all lights with avionics and battery. Plus it must kills the lights by the power switch. Also it must work in test switch position or work with ADF
SIGNAL:1 in the on position only...On top of that, I had to rewrite so many times do to if the signal was still working and you turn off the avionics, it would blink!!

I hope your impressed. I am so happy it works!

Code:
<Gauge Name="ADF ID LIGHT" Version="1.0">
   <Image Name="XPNDR_IDENT_light_Off.bmp"/>




<Element>	
    	<Visible>(A:Electrical master battery, Bool) 1 == (A:ELECTRICAL AVIONICS BUS VOLTAGE, Bool) 23 &gt; (L:LIGHT2,enum) 1 == &amp;&amp; &amp;&amp;</Visible>
     <Position X="0" Y="0"/>
        <Value>
	  (L:HideADF, enum) !
        </Value>
        <Failures>
           <SYSTEM_ELECTRICAL_PANELS Action="0"/>
        </Failures>
           <Image Name="XPNDR_IDENT_light_On.bmp"/>
</Element>





<Element>	
      <Visible>(A:Electrical master battery, Bool) 1 == (A:ELECTRICAL AVIONICS BUS VOLTAGE, Bool) 23 &gt; (A:ADF SIGNAL:1, Number) &amp;&amp; &amp;&amp;</Visible>
     <Position X="0" Y="0"/>
        <Value>
	  (L:HideADF, enum) !
        </Value>
        <Failures>
           <SYSTEM_ELECTRICAL_PANELS Action="0"/>
        </Failures>
           <Image Name="XPNDR_IDENT_light_On.bmp"/>
</Element>



</Gauge>

DG:eek:;)
 
Last edited:
Good Morning Bill,


i stated to keep the if { } last.
That's what you just posted....( condition ) if{ action }

Condition first and if statement last!!!

Not to be pedantic, but...

...the if{ } refers to the preceding condition; what goes inbetween the curly braces { } is the action to take.

if ( this ) { do that } pseudo-code

becomes

( this ) if{ do that } XML script

The reason why I'm pounding on this is because in your original example you did have the if{ } in the correct (last) position...

...you simply had a condition between the curly braces instead of an action! :D
 
Your just drilling me to get it right...Thanks Bill!

It's great how you show examples of right and wrong.....

My xml is not perfect.....

notice the .......(L:LIGHT2,enum) 1 ==

It's not using it alt all. My switch works in all 4 positions. Although it might actually work that way in the real world....


DG
 
Last edited:
This helped me as well. I have always wondered how the basic structure of 'if' arguments worked. Its easy enough to go through existing codes in the XML animation list and copy/paste the components into new variations, but I had always wondered how the 'if' statements actually worked.

Code:
if ( this ) { do that } pseudo-code

becomes

( this ) if{ do that } XML script


nice...!
 
Back
Top