• 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 Very Basic Fuel Gauge

Messages
132
Country
england
I'm probably trying something that's not possible but I need a fuel gauge that is a piece of clear plastic pipe that shows the fuel tank level. (max 7 gallons)

I have a background of just the pipe (20x370pixels) and an element of a black bitmap with alpha that should move down as the tank empties so it should show a darker area for the fuel level.

Have I got something wrong here? I get nothing at all at the moment.
(bmp's are the correct format)

Code:
<Gauge Name="la4fuel_gauge" Version="1.0">
<Image Name="la4fuelfull.bmp" /> 
<!--  ======================= Fuel tube ======================= 
--> 
<Element>
<Position X="0" Y="12" /> 
<Image Name="la4fuellevel.bmp" Alpha="Yes">
<Nonlinearity>
<Item Value="0" X="0" Y="350" /> 
<Item Value="7" X="0" Y="0" /> 
</Nonlinearity>
</Image>
<Shift>
<Value>(A:Fuel Tank Center Quantity,gallons)</Value>
</Shift>
</Element>
<Mouse>
<Help ID="HELPID_GAUGE_FUEL" /> 
</Mouse>
</Gauge>
 
Hey Paul,

I could be wrong, but I 'think' you need the amount of fuel that the gauge will measure.

Thus, if its gallons, you would have;

<Value>(A:Fuel Tank Center Quantity,gallons) 7 </Value>

If it were percent, you would have;

<Value>(A:Fuel Tank Center Quantity,gallons) 100 </Value>
 
Psst, Bill. *cough-cough* Not even close to being right... :o
======================================
Paul, have you looked at the XML script for the FSX Piper J3 Cub? It will give you the format for a "proper" <Shift> structure.
The main problem is that your <Nonlinearity> table must come within the <Shift> area, and after the <Value> tag.

Code:
<Gauge Name="la4fuel_gauge" Version="1.0">
  <Image Name="la4fuelfull.bmp" />
  <!--  ================== Fuel tube ================== -->
  <Element>
    <Position X="0" Y="12" />
    <Image Name="la4fuellevel.bmp" Alpha="Yes"/>
    <Shift>
      <Value>(A:Fuel Tank Center Quantity,gallons)</Value>
      <Nonlinearity>
        <Item Value="0" X="0" Y="350" />
        <Item Value="7" X="0" Y="0" />
      </Nonlinearity>
    </Shift>
  </Element>
  <Mouse>
    <Help ID="HELPID_GAUGE_FUEL" />
  </Mouse>
</Gauge>
 
Last edited:
Thanks chaps - still not working though.

It's not appearing at all on the panel, I suspect I may have a bmp format problem somewhere.

I'll go back to basics with the cub and work from there when I get time.

Here's the panel so far, the fuel gauge is currently just on the background.
 

Attachments

  • pnl1.jpg
    pnl1.jpg
    88.2 KB · Views: 660
Paul,

Sometimes when I cannot get a gauge to work, I will redo the structures of the gauge (outer bits, having made sure the primary code strings are proper) and that will sometimes solve it.

Also, make sure the gauge is in your panel config file. I made this mistake last week, lol...
 
Fixed and working - just need to invert the alpha and add a mask now but it should work perfectly after that.

One of those obvious problems - the background file name was wrong lafuelfull.bmp instead of la4fuelfull.bmp

Almost finished the model now :)
 
MaskImage problem

... Not quite working

It works if I do not have a mask image but the shadow moves below the pipe. As soon as I add a mask the whole thing vanishes.

Code:
<Gauge Name="la4fuel" Version="1.0">
  <Image Name="la4fuelfull.bmp" />
  <!--  ================== Fuel tube ================== -->
  <Element>
    <Position X="0" Y="12" />
    <MaskImage Name="la4fuelmask.bmp">
        <Axis X="0" Y="0"/>
    </MaskImage>
    <Image Name="la4fuellevel.bmp" Alpha="Y"/>
    <Shift>
      <Value>(A:Fuel Tank Center Quantity,gallons)</Value>
      <Nonlinearity>
        <Item Value="0" X="0" Y="350" />
        <Item Value="7" X="0" Y="0" />
      </Nonlinearity>
    </Shift>
  </Element>
  <Mouse>
    <Help ID="HELPID_GAUGE_FUEL" />
    <Tooltip ID="TOOLTIPTEXT_CENTER_FUEL_PERCENT"/>
  </Mouse>
</Gauge>

The file name is correct this time.
It has to be something to do with the creation of the mask bitmap.
I have an 8-bit bmp, plain 20x370 with all pixels RGB (1,1,1)
Created using the gauge with alpha from imagetool - is that correct?
 
I've never used an alpha with a mask before; mine work without it. Your mask should only cover the area you want to "show through"; the rest of the gauge should be uncovered.
 
Back
Top