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

FSX Fuel Selector Gauge

Messages
1,035
Country
us-northcarolina
I have spent 2 days trying to get this to rotate properly and frankly I am worse off now than when I started. Can someone please correct this XML code so that it will be positioned properly and rotate properly. In FSPanel Studio I have the gauge handle exactly where it belongs in the center of the background bmp but when I open it up in FSX it gets more off center every time. It DOES rotate properly BUT the handle is all "discomboobilated" sorry for being so technical with the error. LOL! Here is the code that I have modified:

Code:
<Gauge Name="fuel_gauge_selector" Version="1.0">
  <Image Name="fuel_gauge_selector_background.bmp"/>
 
  <Element>
    <Position X="60" Y="20"/>
    <Image Name="fuel_gauge_selector_knob.bmp" PointsTo="North" UseTransparency="Yes">
      <Axis X="30" Y="10"/>
    </Image>
    <Rotate>
      <Value>(L:Fuel Gauge Switch, enum)</Value>
      <Nonlinearity>
        <Item Value="0" X="22" Y="42"/>
        <Item Value="1" X="48" Y="20"/>
        <Item Value="2" X="76" Y="42"/>
        <Item Value="3" X="42" Y="22"/>
      </Nonlinearity>
      <Delay DegreesPerSecond="360"/>
    </Rotate>
  </Element>

  <Mouse>
  <Help ID="HELPID_SPITFIRE_FUEL_SELECTOR"/>
    <Tooltip ID="TOOLTIPTEXT_FUEL_GAUGE_SELECTOR"/>
    <Area Left="0" Right="0" Width="100" Height="100">
      <Area Right="50">
        <Cursor Type="DownArrow"/>
        <Click>(L:Fuel Gauge Switch, enum) -- d 0 &lt; if{ 0 } (&gt;L:Fuel Gauge Switch, enum)</Click>
      </Area>
      <Area Left="51">
        <Cursor Type="UpArrow"/>
        <Click>(L:Fuel Gauge Switch, enum) ++ d 2 &gt; if{ 2 } (&gt;L:Fuel Gauge Switch, enum)</Click>
      </Area>
    </Area>
  </Mouse>

Here is a link to the folder with the bmps and the xml code:         https://www.mediafire.com/file/jkvn6caxowrqgzv/fuel_gauge_selector.zip/file



</Gauge>
 
to avoid those type of issues I usually draw all the positions I want (in your case 4) to 4 different BMP's and then blit them to screen, that way I dont need to mess around with nonliniearity tables. When Im back home I will take a look at your code.
 
to avoid those type of issues I usually draw all the positions I want (in your case 4) to 4 different BMP's and then blit them to screen, that way I dont need to mess around with nonliniearity tables. When Im back home I will take a look at your code.
I tried that earlier because another gauge had done that. I can do that by using photoshop with the handle in four different positions. If you can make the code work that way that would be fine. Thank you.
 
I tried your gauge and found that your coordinates your a bit out. I changed them to the following and it worked reasonable well.

Code:
  <Element>
    <Position X="49" Y="49"/>
    <Image Name="fuel_gauge_selector_knob.bmp" PointsTo="North" UseTransparency="Yes">
      <Axis X="20" Y="40"/>
    </Image>

The handle won't turn to "off" so your Mouse code may need to be changed as well.

Walter
 
Adding to Walter's code, this will give it proper rotations :
XML:
      <Nonlinearity>
            <Item Value="0" X="50" Y="100"/>
            <Item Value="1" X="0" Y="50"/>
            <Item Value="2" X="50" Y="0"/>
            <Item Value="3" X="100" Y="50"/>
      </Nonlinearity>
Also, I replaced ( option ) the <Click> code that does the exact same thing as your original :
XML:
        <Cursor Type="DownArrow"/>
        <Click>(L:Fuel Gauge Switch, enum) -- 0 max (&gt;L:Fuel Gauge Switch, enum)</Click>

        <Cursor Type="UpArrow"/>
        <Click>(L:Fuel Gauge Switch, enum) ++ 3 min (&gt;L:Fuel Gauge Switch, enum)</Click>
While the gauge really doesn't do anything ( yet? ), it does animate properly, tested.
Finally, the full code :
XML:
<Gauge Name="fuel_gauge_selector" Version="1.0">
  <Image Name="fuel_gauge_selector_background.bmp"/>

  <Element>
    <Position X="49" Y="49"/>
    <Image Name="fuel_gauge_selector_knob.bmp" PointsTo="North" UseTransparency="Yes">
      <Axis X="20" Y="40"/>
    </Image>
    <Rotate>
      <Value>(L:Fuel Gauge Switch, enum)</Value>
      <Nonlinearity>
            <Item Value="0" X="50" Y="100"/>
            <Item Value="1" X="0" Y="50"/>
            <Item Value="2" X="50" Y="0"/>
            <Item Value="3" X="100" Y="50"/>
      </Nonlinearity>
      <Delay DegreesPerSecond="180"/>
    </Rotate>
  </Element>

  <Mouse>
  <Help ID="HELPID_SPITFIRE_FUEL_SELECTOR"/>
    <Tooltip ID="TOOLTIPTEXT_FUEL_GAUGE_SELECTOR"/>
    <Area Left="0" Right="0" Width="100" Height="100">
      <Area Right="50">
        <Cursor Type="DownArrow"/>
        <Click>(L:Fuel Gauge Switch, enum) -- 0 max (&gt;L:Fuel Gauge Switch, enum)</Click>
      </Area>
      <Area Left="51">
        <Cursor Type="UpArrow"/>
        <Click>(L:Fuel Gauge Switch, enum) ++ 3 min (&gt;L:Fuel Gauge Switch, enum)</Click>
      </Area>
    </Area>
  </Mouse>

</Gauge>
example.png
 
Last edited:
I only know such rotary switches as suggested by Adino! I just tried it on one of my switches and it works wonderfully! As a result, my lumpy animation of the switch for each position is no longer necessary!
 
I tried that earlier because another gauge had done that. I can do that by using photoshop with the handle in four different positions. If you can make the code work that way that would be fine. Thank you.

This should work for the bitmap animation and if you add Roman simplified code in your mouse section you are done.
remember to replace the bitmap names with your bitmap names for each position.

Code:
 <Element>
    <Position X="60" Y="20"/>       
      <Select>
        <Value>(L:Fuel Gauge Switch, enum)</Value>
          <Case Value="0">
            <Image Name="Position0.bmp"/>
         </Case>
         <Case Value="1">
            <Image Name="Position1.bmp"/>
         </Case>
          <Case Value="2">
            <Image Name="Position2.bmp"/>
         </Case>
         <Case Value="3">
            <Image Name="Position3.bmp"/>
         </Case>         
      </Select>
   </Element>
 
Thank you everyone. I will be testing these all this afternoon and I am sure that I will be successful with a gauge for the Seagull which is where that accurate bmp is from a book I have.
 
First, thank you all for your help. I still have a problem. I think that I copied all the code correctly and actually corrected a few typos...here is the code:

<Gauge Name="fuel_gauge_selector" Version="1.0">
<Image Name="fuel_gauge_selector_background.bmp"/>
<Element>
<Position X="49" Y="49"/>
<Image Name="fuel_gauge_selector_knob.bmp" PointsTo="North" UseTransparency="Yes">
<Axis X="20" Y="40"/>
</Image>
<Rotate>
<Value>(L:Fuel Gauge Switch, enum)</Value>
<Nonlinearity>
<Item Value="0" X="50" Y="100"/>
<Item Value="1" X="0" Y="50"/>
<Item Value="2" X="50" Y="0"/>
<Item Value="3" X="100" Y="50"/>
</Nonlinearity>
<Delay DegreesPerSecond="360"/>
</Rotate>
</Element>

<Mouse>
<Help ID="HELPID_SPITFIRE_FUEL_SELECTOR"/>
<Tooltip ID="TOOLTIPTEXT_FUEL_GAUGE_SELECTOR"/>
<Area Left="0" Right="0" Width="100" Height="100">
<Area Right="50">
<Cursor Type="DownArrow"/>
<Click>(L:Fuel Gauge Switch, enum) -- 0 max(&gt;L:Fuel Gauge Switch, enum)</Click>
</Area>
<Area Left="51">
<Cursor Type="UpArrow"/>
<Click>(L:Fuel Gauge Switch, enum) ++ 3 min(&gt;L:Fuel Gauge Switch, enum)</Click>
</Area>
</Area>
</Mouse>

</Gauge>

But this is what I got and it does not rotate at all.
SOC VC with Fuel Selector Gauge.jpg


I am sure I did something wrong but can't see what it is
 
the only thing that accomplished is to put the handle bmp upside down still no clicks...very frustrating
 
The following code works perfectly for me:


Code:
<Gauge Name="fuel_gauge_selector" Version="1.0">
<Image Name="fuel_gauge_selector_background.bmp"/>
<Element>
<Position X="49" Y="49"/>
<Image Name="fuel_gauge_selector_knob.bmp" PointsTo="North" UseTransparency="Yes">
<Axis X="20" Y="40"/>
</Image>
<Rotate>
<Value>(L:Fuel Gauge Switch, enum)</Value>
<Nonlinearity>
<Item Value="0" X="50" Y="100"/>
<Item Value="1" X="0" Y="50"/>
<Item Value="2" X="50" Y="0"/>
<Item Value="3" X="100" Y="50"/>
</Nonlinearity>
<Delay DegreesPerSecond="360"/>
</Rotate>
</Element>

<Mouse>
<Help ID="HELPID_SPITFIRE_FUEL_SELECTOR"/>
<Tooltip ID="TOOLTIPTEXT_FUEL_GAUGE_SELECTOR"/>
<Area Left="0" Right="0" Width="100" Height="100">
<Area Right="50">
<Cursor Type="DownArrow"/>
<Click>(L:Fuel Gauge Switch, enum) -- 0 max (&gt;L:Fuel Gauge Switch, enum)</Click>
</Area>
<Area Left="51">
<Cursor Type="UpArrow"/>
<Click>(L:Fuel Gauge Switch, enum) ++ 3 min (&gt;L:Fuel Gauge Switch, enum)</Click>
</Area>
</Area>
</Mouse>

</Gauge>

You wouldn't have renamed or removed your background image?

Walter
 
I am going to have to find out what is going on with this on my end...I can't even get your code to show me a gauge in FSPanel Studio. Thank you for your help. I will get back here tomorrow or the next day. Frustrated right now why it works for you and not me. I had this problem with a gauge from Rob Barendregt who patiently worked with me here. Same thing...worked fine on his FSX and not mine. No matter what we tried for hours. But EVERYTHING in my FSX works fine otherwise. Go figure. I am going to walk away right now.
 
I'll put the Fuel Temp Selector switch code here, maybe it will help solve the problem! The structure is basically the same only different values!

FT_BACK_MASK.bmp = 101 x 77
SW_FT.bmp = 31 x 63

Code:
<Gauge Name="FUEL_TEMP_SW" Version="1.0">
<Image Name="FT_BACK_MASK.bmp"/>
<Element>
    <Position X="47" Y="43"/>
    <Image Name="SW_FT.bmp" PointsTo="North" UseTransparency="Yes">
      <Axis X="16" Y="32"/>
    </Image>
    <Rotate>
      <Value>(L:FUEL_TEMP_SEL,enum)</Value>
      <Nonlinearity>
            <Item Value="0" X="16" Y="28"/>
            <Item Value="1" X="29" Y="14"/>
            <Item Value="2" X="48" Y="7"/>
            <Item Value="3" X="67" Y="14"/>
            <Item Value="4" X="78" Y="29"/>
      </Nonlinearity>
      <Delay DegreesPerSecond="100"/>
    </Rotate>
  </Element>
<Mouse>
      <Area Right="50">
        <Cursor Type="DownArrow"/>
        <Click>(L:FUEL_TEMP_SEL,enum) -- 0 max (>L:FUEL_TEMP_SEL,enum)</Click>
      </Area>
      <Area Left="51">
        <Cursor Type="UpArrow"/>
        <Click>(L:FUEL_TEMP_SEL,enum) ++ 4 min (>L:FUEL_TEMP_SEL,enum)</Click>
      </Area>
      <Tooltip>%((L:FUEL_TEMP_SEL,enum) 0 ==)%{if}Tank No1%{end}%((L:FUEL_TEMP_SEL,enum) 1 ==)%{if}Engine 1%{end}%((L:FUEL_TEMP_SEL,enum) 2 ==)%{if}Engine 2%{end}%((L:FUEL_TEMP_SEL,enum) 3 ==)%{if}Engine 3%{end}%((L:FUEL_TEMP_SEL,enum) 4 ==)%{if}Engine 4%{end}</Tooltip>
    </Mouse>
</Gauge>
 
In the Navy when we made a mistake the code was 'MY FACE IS RED...OUT". Walter's code works perfectly, thank you Walter. MY MISTAKE WAS...when I copied the code out of here and pasted it into Notepad++ it was saved as .txt not .xml When I went back into Notepad++ I noticed this and corrected it. THEN I pasted it into a default Cessna 172 and it works perfectly too. Pasted it into the SOC3 Seagull 2D panel and it works too. Since this is now working, I will try and get it into the VC but not tonight. Maybe tomorrow. We can close this and thank you to ALL OF YOU for taking the time out of your Sundays to help me. Everybody here at FSDevelopers has never let me down when I needed help and Thank you for the descriptive text which is a good teaching tool for me too.
 
Nothing to do with the problem that tgycgijoes is experiencing, but to do with the Fuel Selector on a real aircraft. Can the lever be turned further than 360º, in the given example for instance, from OFF, to AUX ON, to MAIN ON, to RES ON, to OFF, to AUX ON and so on, without reaching a stop? Or all the way backwards through the positions? I have no experience with real aircraft except for an introductory flight in a Cessna 172 gifted to me, and then I spent most of my time being amazed at how tiny the yoke was (it looked like a toy)!
 
I think it depends on the aircraft. I know of one Boeing where you could do that; the B-314. Some aircraft design does depend on the manufacturer assuming that the crew will know what they are doing. I remember sitting in the cockpit of an SD-3-60 a couple of decades ago, leaning back and punching the electrical settings into a configuration that the crew would never select in flight. On querying this, the instructor who was with me said 'well, the aircraft will let you do it...'.
 
Back
Top