FSX Help Needed With Fuel Panel

#1
I am currently in the process of coding a fuel panel that includes a "fuel Used" counter which also has a reset button.

Fuel Panel.jpeg


The problem I have encountered is when I load the aircraft, the fuel used indicator displays "minus total fuel quantity" & with engines running begins to count down fuel used, when I hit the reset button it does zero & starts counting fuel used as it should.

Code:
        <Element id="Fuel Used Display">
            <FloatPosition>436.000,103.000</FloatPosition>
            <GaugeText id="GaugeText">
                <Bright>True</Bright>
                <FontColor>white</FontColor>
                <FontFace>ariel</FontFace>
                <FontHeight>50</FontHeight>
                <GaugeString>%((L:Clear, enum) (A:FUEL TOTAL QUANTITY, gallon) - 6.7 *)%!04d!</GaugeString>
                <HorizontalAlign>CENTER</HorizontalAlign>
                <Size>100,60</Size>
                <Transparent>True</Transparent>
            </GaugeText>

            </MouseArea>
            <MouseArea id="MouseArea">
                <FloatPosition>379.000,155.000</FloatPosition>
                <Size>60,60</Size>
                <CursorType>Hand</CursorType>
                <MouseClick id="MouseClick">
                    <Script> (A:FUEL TOTAL QUANTITY, gallon) (&gt;L:clear,enum)</Script>
                </MouseClick>
            </MouseArea>
        </MouseArea>
I would appreciate any help given.
 

n4gix

Resource contributor
#2
When you first load the aircraft, your (L:clear,enum) is initialized to ZERO, hence the negative fuel used reading... try adding this to your script:
Code:
<Update>
   (L:FuelInit,bool) 0 ==
       if{
           (A:FUEL TOTAL QUANTITY, gallon) (>L:clear,enum)
           1 (>L:FuelInit,bool)
         }
</Update>
This is simply a quick initialization routine. Since all L:variables are initialized to a ZERO value, the "if{" condition will set your (L:clear,enum) to equal the total fuel qty, then set the (L:FuelInit,bool) flag to equal 1 ending the "if{" routine.
 
Last edited:
#3
Thank's Bill, that did the job, however I did find a typo in the code, (A:FUEL TOTAL QUANTITY, gallon) >L:clear,enum)
missing a ( before ">L:clear,enum)"
Again I thank you.
 
Last edited:
#4
The following is what I use to get 'Fuel used' , it lists for each of 2 engines and has a total .
Note the Variables used .
Code:
       <Element>
          <Position X="75" Y="354"/>
            <FormattedText X="310" Y="50" Font="Tahoma" FontSize="16" LineSpacing="18" Adjust="Left" Color="#93FF72" Bright="Yes" Tabs="0,1L,90L,205L">
              <String>\t%Fuel Burn%\t%ENG #1 %((A:GENERAL ENG FUEL USED SINCE START:01, pounds))%!5d!%\t%ENG #2 %((A:GENERAL ENG FUEL USED SINCE START:02, pounds))%!5d!%
                      \n\t% -lbs-%\t    %TOTAL%  %((A:GENERAL ENG FUEL USED SINCE START:01, pounds) (A:GENERAL ENG FUEL USED SINCE START:02, pounds) +)%!5d!%  %lbs%
              </String>                   
          </FormattedText> 
       </Element>
Cheers
Karol
 

n4gix

Resource contributor
#5
Thank's Bill, that did the job, however I did find a typo in the code, (A:FUEL TOTAL QUANTITY, gallon) >L:clear,enum)
missing a ( before ">L:clear,enum)"
Again I thank you.
Oops! That's what happens when I type of the cuff without using my Visual Studio where such an omission would have been flagged. In any event I'm happy you found/fixed my typo.

I've also edited my post to add the missing opening "("... :coffee:
 
Top