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

Need help with "AND" operator

Messages
23
Country
italy
Hello, just going crazy to do this.
Need to make a gauge with 2 conditions and use AND, but I can't find the right way.
My need is engine off and battery off ,
They are working separately, but not together

Is this correct ??
<Value>
(A:Old eng1 starter,bool) (A:Electrical master battery,bool) and
</Value>

Thanks
 
Hello, just going crazy to do this.
Need to make a gauge with 2 conditions and use AND, but I can't find the right way.
My need is engine off and battery off ,
They are working separately, but not together

Is this correct ??
<Value>
(A:Old eng1 starter,bool) (A:Electrical master battery,bool) and
</Value>

Thanks


There's nothing wrong with the operator, but there's plenty wrong with your A:vars!

There is no such variable as "Old eng1 starter..."

Try this instead:

Code:
<Value>
     (A:GENERAL ENG STARTER:1,bool)
     (A:Electrical master battery,bool)
     and
</Value>
 
Hi
Bill got in a faster response whilst I was typing :)


Wozza

I should also qualify that a bit more, to avoid any confusion...

There was a token variable named "Old eng1 starter" back in FS2002, which was added to allow backwards compatibility with FS2000. Support for that token was removed in the FS2004 SDK.
 
operator

Hi, thanks, but that was from the default baron and alone it's working.
Anyway I'll try (again) with this, but best I can obtain it's working both but not together.
I made a gau with a bmp showing 0 and a bmp showing 1 (I used taxi light and battery) moving each switch will change bmp, no way to make one related to the other. I tried hundred times, I searched hundred of gauges, parameters and variables, but never happened to change condition when both are down only.
Maybe I have a bigger hidden trouble in the whole panel.
I have also the pitot heater always up or returning up after a click.
 
workaround

I think I need a work around, because works only when switch is positioned on start (0) not for 1,2,3,and 4.
I have to try another variable to determine if engine is off, maybe I can add a master ignition switch to be off inside the magneto gau(2 positions only) so I can use a 2 pos boolean with the other variable.
 
Hi, thanks, but that was from the default baron and alone it's working.
Anyway I'll try (again) with this, but best I can obtain it's working both but not together.
I made a gau

Okay, you are just confusing me (and likely everyone else) now...

First, you need to state which sim you're developing for: FS9 or FSX?

Second, the example from the Beech_Baron.cab file is an "enumerated" variable, not a "boolean."

A "boolean" variable has two states: 0 or 1 (that is off/on, or true/false).

An "enumerated" variable can have many states: -1, 0, 1, 2, 3, 4... and so on...

Code:
<Gauge Name="Left Ignition Switch" Version="1.0">
    <Element>
        <Select>
            <Value>(A:Old eng1 starter,enum)</Value>
            <Case Value="0">
                <Image Name="Ignition_Left_Off.bmp" ImageSizes="48,31,77,50"/>
            </Case>
            <Case Value="1">
                <Image Name="Ignition_Left_R.bmp" ImageSizes="48,31,77,50"/>
            </Case>
            <Case Value="2">
                <Image Name="Ignition_Left_L.bmp" ImageSizes="48,31,77,50"/>
            </Case>
            <Case Value="3">
                <Image Name="Ignition_Left_Both.bmp" ImageSizes="48,31,77,50"/>
            </Case>
            <Case Value="4">
                <Image Name="Ignition_Left_Start.bmp" ImageSizes="48,31,77,50"/>
            </Case>
        </Select>
    </Element>
    <Mouse>
        <Help ID="HELPID_GAUGE_MAGNETO_SWITCH"/>
        <Area Right="19">
            <Cursor Type="DownArrow"/>
            <Click Event="MAGNETO1_DECR"/>
        </Area>
        <Area Left="19">
            <Cursor Type="UpArrow"/>
            <Click Event="MAGNETO1_INCR"/>
        </Area>
    </Mouse>
</Gauge>

The (A:Old eng1 starter,enum) was added to the sim's core .dll in order to make this specific XML script compatible with FSX. The (A:Old eng1 starter,enum) variable has actually been removed from the FSX SDK entirely, and normally one would use (A:RECIP ENG LEFT MAGNETO:n) instead (where n is an index from 1 to 4)...

Since a magneto switch commonly is simply a mechanical, four position switch, limiting it to "move" only when the battery is turned on is highly unrealistic!

Please describe precisely what it is you want to happen and we'll do our best to help you find a way to accomplish your goal, providing it makes sense of course... ;)

Also, please understand that when you use a term such as "gau" you are generating confusion, since that specific term is associated with .gau files, which are compiled C++ code, not XML script "gauges."
 
Last edited:
Simple

I'm sorry about that,
just need to show a bmp when the engine is off AND battery is off (only)
xml
sigle prop fs9
I sent you a screen shot link


(I need examples to understand and SDK is not helping me on this side, so I have to do many tries!)
Thanks
 
Last edited:
Hi
There are a number of ways you can code the bmp to show
using visibility or as above in Bills example using case tags

I tend to use a number rather than bool so for your needs Id use something like

(A:ENG1 COMBUSTION,number) 0 == (A:Electrical master battery,number) 0 == and

or as I find plain text a pain to sometimes debug I use
(A:ENG1 COMBUSTION,number) 0 == (A:Electrical master battery,number) 0 == &amp;

so a completed code using case would look something like this

Code:
<Gauge Name="Switch" Version="1.0">
    <Element>
        <Select>
            <Value>(A:ENG1 COMBUSTION,number) 0 ==  (A:Electrical master battery,number) 0 ==  &amp;</Value>
            <Case Value="0">
                <Image Name="off.bmp" />
            </Case>
        </Select>
    </Element>
</Gauge>

or using the vis command

Code:
<Gauge Name="Switch" Version="1.0">
  <Element>
     <Visible>(A:ENG1 COMBUSTION,number) 0 ==  (A:Electrical master battery,number) 0 ==  &amp;</Visible>
     <Image Name="off.bmp" />
  </Element>
</Gauge>

Wozza
 
Last edited:
Now that you've made it clear that you're working on an annuciator panel, the goal becomes clear.

Wozza has already posted good script. Choose one... :wizard:
 
Last edited:
Thanks to all

Now code is working thanks to all.
Just another little thing:
any idea why my pitot heater is not working? I used same usual code like all pitot heaters, but it's always on.
when I click it goes down then immediately goes back to up.
Checked aircraft.cfg but nothing strange found.
<Element>
<Select>
<Value>(A:Pitot heat,bool)</Value>
<Case Value="0">
<Image Name="S_Off2.bmp" />
</Case>
<Case Value="1">
<Image Name="S_On2.bmp" />
</Case>
</Select>
</Element>
<Mouse>
<Help ID="HELPID_GAUGE_PITOT_HEAT_SWITCH"/>
<Cursor Type="Hand"/>
<Click Event="PITOT_HEAT_TOGGLE"/>
</Mouse>
 
Back
Top