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

FS2004 XML OR Operation APU GPU BAT Switch

Messages
19
Hi there,


I am working on a Dornier 328 Panel with advanced OHP-Functions.
I already noticed, that I would never come to an end, when doing all functions close to original.

I decided to make most of the gauge-switches as easy as possible. Therefore I thought about some OR-related functions. For example the power supply:

Here a simplified overview:
IF <L:BAT1> is on OR <L:BAT2> is on OR <L:GPU> & <L:GPU-AVAIL> are both on OR <L:APU> & <L:APU-AVAIL> are both on, THEN <A:MASTER BAT> is on. ELSE <A:MASTER BAT> is off.

I tried to use the following term, but it doesn't work:

<Element>
<Select>
<Value>(L:BAT1,bool) (L:BAT2,bool) || (L:APU,bool) || (L:GPU,bool) || if{ 1 (>A:ELECTRICAL MASTER BATTERY,bool) }

</Value>
</Select>
</Element>

I am not sure what goes wrong. Maybe I should try a complete different solution? How can I get this working? Help, help, mayday...


Alex
 
A couple of points. Script like this should really be in an <Update> section.

You are trying to "set" a read-only variable. That will never work! :o
You need to look for the corresponding EventID (aka: key_event), which uses a K: prefix... :D

Also, since the key_event is only a toggle, you need to check to make sure that the battery really IS off before trying to turn it on... :cool:

Code:
<Update>
     (L:BAT1,bool)
     (L:BAT2,bool) 
     or 
     (L:APU,bool) 
     or 
     (L:GPU,bool) 
     or 
     (A:ELECTRICAL MASTER BATTERY,bool) !
        if{ 1 (>K:TOGGLE_MASTER_BATTERY) }
</Update>
 
Hi Bill,

Code:
     (A:ELECTRICAL MASTER BATTERY,bool) !
        if{ 1 (>K:TOGGLE_MASTER_BATTERY) }

this looks odd but is short. Is it really working or did you miss an "=" and an "and"? I am asking because I am always using something like this:

Code:
  (L:BATTERY,bool) (A:ELECTRICAL MASTER BATTERY,bool) !=
  if{
    (&gt;K:TOGGLE_MASTER_BATTERY)
  }
 
Hi there,

OK. I see I was wrong. <A:..> variables are only read variables. :cool:

To act a switch or a procedure I always have to use <K:..> events.
If there are only toggle events its becoming more complicated...:mad:

How does a "OR" truely work? I often see within tutorials simply the word "or". On the most gauges there is a double bar, something like " l l " would it be enough to write "or" ? How can I key this double bar in? :confused:



---Alex---
 
If you aren't using the SDK, you're going to have problems...

|| and or mean the same thing...

You can also use and instead of && or &amp;&amp;...
 
Hi Bill,

Code:
     (A:ELECTRICAL MASTER BATTERY,bool) !
        if{ 1 (>K:TOGGLE_MASTER_BATTERY) }

this looks odd but is short. Is it really working or did you miss an "=" and an "and"? I am asking because I am always using something like this:

Nope...

(A:ELECTRICAL MASTER BATTERY,bool) !

is functionally the equivalent of...

(A:ELECTRICAL MASTER BATTERY,bool) 0 ==

Remember that 'boolean' types evaluate to "0" or (most of the time) "1" but only guaranteed to be "not 0"
 
Hi n4gix,

I do not use SDK.
I think you're right. I will have problems. But whats live without a challenge :D.
I just found the |||||||||||||| Key on my keyboard. One of those never used special signs... :rolleyes:

Were can I implement a <update> function?

within an element enclosure?
between element and mouse?


by the way, thank you very much for posting answers...:)
 
You can put an <Update> section anywhere between <Gauge> and </Gauge> although typically they are placed near the top of the script.

These are the "major sections" that're common to most gauge scripts.

Code:
<Gauge>
   <Update>
   </Update>

   <Element>
   </Element>

   <Macro>
   </Macro>

   <Mouse>
        <Area>
        </Area>
   </Mouse>

   <Keys>
   </Keys>
</Gauge>
 
Hi Alec,

if you are programming for FS9 you should have a look at these tutorial pages here.

Bill,

I didn't know that. I always use
Code:
(L:TEST,bool) 0 ==
and
Code:
(L:TEST,bool) 0 !=

your variant saves 3 keystrokes. Excellent! :cool:

Vitus
 
I try this,

(A:SomeVar,bool) to check for "true," but if I get weird results, I use

(A:SomeVar,bool) 0 !=

if I want to be positive "true" condition (just in case "true" isn't actually 1)... :D
 
I finally did it.:)

The two battery switches are now disconnected from GPU / APU.
To toggle MasterBat via BAT1 / BAT2 I was able to create this gauge:


<Gauge Name="BAT1" Version="1.0">
<Image Name="AX-BTN-05a-OFF.bmp" ImageSizes="50,50"/>


<Element>
<Position X="0" Y="0"/>
<Visible>(L:LGTTestOHP,bool) (A:Electrical master battery,bool) &amp;</Visible>
<Image Name="AX-BTN-05d.bmp" ImageSizes="50,50" Bright="Yes"/>
</Element>

<Element>
<Position X="0" Y="0"/>
<Visible>(L:LGTTestOHP,bool) (A:Electrical master battery,bool) &amp;</Visible>
<Image Name="AX-BTN-05b.bmp" ImageSizes="50,50" Bright="Yes"/>
</Element>

<Element>
<Position X="0" Y="0"/>
<Visible>(L:BAT1,bool) ! (A:Electrical master battery,bool) &amp;</Visible>
<Image Name="AX-BTN-05d.bmp" ImageSizes="50,50" Bright="Yes"/>
</Element>

<Mouse>

<Area Left="0" Right="50" Top="0" Bottom="50">
<Visible>(L:BAT2,bool)</Visible>
<Cursor Type="Hand"/>
<Click>(L:BAT1,bool) ! (&gt;L:BAT1,bool)</Click>
</Area>

<Area Left="0" Right="50" Top="0" Bottom="50">
<Visible>(L:BAT2,bool) !</Visible>
<Cursor Type="Hand"/>
<Click>(L:BAT1,bool) ! (&gt;L:BAT1,bool) 1 (&gt;K:TOGGLE_MASTER_BATTERY)</Click>
</Area>


</Mouse>

</Gauge>



Thats it. It works.:D
 
Back
Top