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

Switch on/Light off

Messages
1,468
Country
italy
The two gauges below are a switch and a light. When the gauge window is opened the switch is off (correct) and the light is on (incorrect). I have to cycle the switch on and off for the light and switch to then work in the correct sequence together. When I open the gauge window I want the switch to be off and also the light. So that when I put the switch to on the light follows suit!
vololiberista

Code:
<Gauge Name="Oxygen 100%" Version="1.0">
<Element>
      <Select>
         <Value>(G:Var1,bool)</Value>
         <Case Value="0">
            <Image Name="OX_100_OFF.bmp"/>
         </Case>
         <Case Value="1">
            <Image Name="OX_100_ON.bmp"/>
         </Case>
      </Select>
   </Element>
   <Mouse>
         <Tooltip>Oxygen Supply 100pc</Tooltip>
         <Cursor Type="Hand"/>
	<Click>
(G:Var1) 0 ==
if{
1 (>G:Var1,bool)
0  (>L:OXYGEN 100,number)
}
els{
0 (>G:Var1,bool)
1 (>L:Sound_button,enum)
1 1 (>L:OXYGEN 100,number)
}
1 (>L:Sound_button,enum)
</Click>
   </Mouse>
</Gauge>
Code:
<Gauge Name="Oxygen Flow light" Version="1.0">
   <Element>
<Failures>
            <SYSTEM_ELECTRICAL_PANELS Action="0"/>
         </Failures>
<Select>
<Value>(L:OXYGEN 100,number)</Value>
<Case Value="0">
            <Image Name="OX_LIGHT_ON.bmp" Bright="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="OX_LIGHT_OFF.bmp"/>
         </Case>
      </Select>
   </Element> 
</Gauge>
 
Hi,

i believe that this happens because when a gauge is loaded, an L:Var initiates at a value of 0 unless you specify a different initialization value.

And your L:OXYGEN 100,number with a value of 0 sets the ox light to On in your second code snippet.

That explains why you have to cycle the switch for the light to remain Off.

One way around this which you can try, is to flip the light control values for On and Off, so 1 is On and 0 is Off.

The other way around this would be to initialize L:OXYGEN 100,number with a value of 1. For example like this.

Code:
(G:Var2) 0 ==  if{ 1 (>L:OXYGEN 100,number) 1 (>G:Var2) }

The G:Var2 in combination with the if statement prevents continuous setting L:OXYGEN 100,number to 1.

Hope this helps.

grt
Willem

edit: as Ted correctly mentions below, G:var's don't have units. The code snippet is changed accordingly.
 
Last edited:
Don't forget that variables of a G kind do not have any units defined.

Also you seem to have a surplus 1 after the (>L:Sound_button,enum) statement.

Ted.
 
Why futz around with those silly, and very superflous "G:Vars" anyway?

They don't really add any real functionality, and in fact obfuscate what you're trying to do... :D
 
Back
Top