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

Fuel Selectors Issue

Messages
10,158
Country
us-arizona
Hey guys,


As you know, I have been working on a fuel selector for ages now. Real basic. Just a 'Left-Off/On' and 'Right-Off/On' type of thing.

Right now, its actually semi working! Thoug it isnt working totally correct. The dials work 'together' (one issue), and the dials (selectors) to not point to where they should, (issue two).

Also, the right fuel selector thinks its 'fuel selector 3', which it isnt, its fuel selector 2. (I took this from the Ford Trimotor and adjusted accordingly, but evidently not enough).

The dials are properly adjusted for 'Left On and Left Off', and also 'Right On, and Right Off'.

I noticed I had at least 3 selections going (tapped an area and got an extra movement from the selectors, somehow, couldnt duplicate the click zone).

The knobs work together instead of independently, which is what I need.



Here is the code;
Code:
<Gauge Name="Kodiak Fuel Popup" Version="1.0">
  <Image Name="Kodiak_Fuel_Selectors_Background.bmp"/>



  <!-- ========================= Fuel Control - Left =============== -->
  <Element>
    <Position X="333" Y="342"/>
    <Image Name="Fuel_Selector_Knob.bmp" PointsTo="North">
      <Axis X="32" Y="233"/>
    </Image>
    <Rotate>
      <Value>
          (A:Fuel tank selector 1,enum)
          s0
          1 ==
          if{ 2 }
          els{ l0 }
      </Value>
      <Nonlinearity>
        <Item Value="0" X="342" Y="108"/> <!-- OFF -->
        <Item Value="2" X="92" Y="341"/> <!-- LEFT -->
      </Nonlinearity>
      <Delay DegreesPerSecond="360"/>
    </Rotate>
  </Element>

  <!-- ========================= Fuel Control - Right ============== -->
  <Element>
    <Position X="534" Y="342"/>
    <Image Name="Fuel_Selector_Knob.bmp" PointsTo="North">
      <Axis X="32" Y="233"/>
    </Image>
    <Rotate>
      <Value>
          (A:Fuel tank selector 2,enum)
          s0
          1 ==
          if{ 3 }
          els{ l0 }
      </Value>
      <Nonlinearity>
        <Item Value="3" X="780" Y="341"/> <!-- RIGHT -->
        <Item Value="0" X="541" Y="108"/> <!-- OFF -->        
      </Nonlinearity>
      <Delay DegreesPerSecond="360"/>
    </Rotate>
  </Element>

<Mouse>

    <!-- ************************* Fuel Control - Left *************** -->
    <Area Left="90" Top="94" Right="372" Bottom="380">
      <Help ID="HELPID_GAUGE_FUEL_SELECTOR"/>
      <Tooltip ID="TOOLTIPTEXT_FUEL_SELECTOR_1"/>
      <Area Left="0" Top="0" Right="277" Bottom="130">
         <Cursor Type="Hand"/>
         <Click Event="FUEL_SELECTOR_OFF"/>
      </Area>
      <Area Left="0" Top="131" Right="277" Bottom="277">
         <Cursor Type="Hand"/>
         <Click Event="FUEL_SELECTOR_LEFT"/>
      </Area>                         
    </Area>


    <!-- ************************* Fuel Control - Right ************** -->
    <Area Left="496" Top="94" Right="775" Bottom="380">
      <Help ID="HELPID_GAUGE_FUEL_SELECTOR"/>
      <Tooltip ID="TOOLTIPTEXT_FUEL_SELECTOR_2"/>
      <Area Left="0" Top="0" Right="277" Bottom="130">
         <Cursor Type="Hand"/>
         <Click Event="FUEL_SELECTOR_2_OFF"/>
      </Area>
      <Area Left="0" Top="131" Right="277" Bottom="277">
         <Cursor Type="Hand"/>                               
         <Click Event="FUEL_SELECTOR_2_RIGHT"/>
      </Area>
    </Area>



  </Mouse>
</Gauge>



Any idea's why the right tank is working with the left tank, and why they arent pointing to their origins of On and Off?


Here is also a JPG of the panel. The panel is undersized in the art, actual size being 875 X 513 pixels.


I would be greatful for any input.

So far, in my studies of the fuel tanks in the SDK Docs, off is 0, Left Main is 2, and Right Main is 3, so the Enum for Right should be 3, as it is in the code, and 2 for Left as well....

Any ideas?



Many thanks,


Bill
 
Last edited:
Man, this is wierd..

I found out that it is indeed moving 3 seperate movements, both dials at once.

Click on 'On' area on left and tank goes to either Left or Main.
Click on 'On' area on right and tank goes to Main
Click on the 'Off' area of either left or right side, and the tanks go to off

The dials however, make odd movements, like 5 degrees of travel only, instead of full top to full left or right.

Somehow, all the gauge code for selector movements is in that code somewhere.... What I need is for one side to behave seperate from the other, and have only;
* Left On/Off
and....
* Right On/Off





Bill
 
Well.. I guess I was fading out when I was creating the gauge selector coordinates (point too zones).

Repaired..


Code:
 <!-- ========================= Fuel Control - Left =============== -->
  <Element>
    <Position X="333" Y="342"/>
    <Image Name="Fuel_Selector_Knob.bmp" PointsTo="North">
      <Axis X="32" Y="233"/>
    </Image>
    <Rotate>
      <Value>
          (A:Fuel tank selector 1,enum)
          s0
          1 ==
          if{ 2 }
          els{ l0 }
      </Value>
      <Nonlinearity>
        <Item Value="2" X="35" Y="349"/> <!-- LEFT -->
        <Item Value="0" X="329" Y="91"/> <!-- OFF -->
      </Nonlinearity>
      <Delay DegreesPerSecond="360"/>
    </Rotate>
  </Element>

  <!-- ========================= Fuel Control - Right ============== -->
  <Element>
    <Position X="534" Y="342"/>
    <Image Name="Fuel_Selector_Knob.bmp" PointsTo="North">
      <Axis X="32" Y="233"/>
    </Image>
    <Rotate>
      <Value>
          (A:Fuel tank selector 2,enum)
          s0
          1 ==
          if{ 3 }
          els{ l0 }
      </Value>
      <Nonlinearity>
        <Item Value="0" X="527" Y="91"/> <!-- OFF -->        
        <Item Value="3" X="778" Y="349"/> <!-- RIGHT -->
      </Nonlinearity>
      <Delay DegreesPerSecond="360"/>
    </Rotate>
  </Element>


I still have extra elements per each side (I think its adding Right tank to the left tank selector, and Main tank to the right side selector, so there is Off, Left, Right on the left selector, and 'Off, Right, Main' on the right selector, and they both 'function' at the same time for some reason, (click on left side, and it works both the left and the right, instead of the left only).


How on Earth could my coordinates be that far off?? No substance abuse was going on... I swear.. arrghh.. Was taking my time so it would work the first time around.

I dont know how you guys can do it, how you can handle it....


Bill
 
Could someone explain what this means?

(A:Fuel tank selector 1,enum)
s0
1 ==
if{ 3 }
els{ l0 }

My problem must be right in here, I am 'guessing'.




Bill
 
I think I am beginning to see a problem..

Fuel_Cutoff means 'all tanks are cut off, even if by a left or right selector... So clicking the 'Fuel Left Off' will turn off all tanks..


Second, by having selectors state 'Left On' and 'Right On', this means that you will not have 'both' running if both are selected, as they will auto-select 'one', such as right on, and not both right and left on...


Grim..




Bill
 
Yep... Stumped you all on this one..

:eek:

It is possible...

:D


(Bad for me though... arrghh :( ).



Bill
 
Could someone explain what this means?

(A:Fuel tank selector 1,enum)
s0
1 ==
if{ 3 }
els{ l0 }

That's simple, once you know what "s" and "l" mean...

sn means storen, where n can be 0-49

ln means loadn, where n can be 0-49

So, in the above script, (A:Fuel tank selector 1,enum) is being stored in the register location s0.

In the conditional section, the l0 is "loading" the contents of the register variable.

The one caveat is that these "register location(s)" only exist within the context of the script in which they are used.

Furthermore, since they are not too clearly identified, it makes debugging the script more difficult, especially if you've stored "s24" one place, and then use "l24" 3,000 lines later!

So, my advice is to not use the register locations except when they are contained within a single statement such as has been done in your example.

Although extremely fast in execution, it is too hard to keep track of them in any large gauge script. Use named (L:var,unit) instead... :D

(A:Fuel tank selector 1,enum)
s0
1 ==
if{ 3 }
els{ l0 }

// is the same as:

(A:Fuel tank selector 1,enum)
1 ==
if{ 3 }
els{ (A:Fuel tank selector 1,enum) }
 
Hey Bill,

Many thanks for the info and lesson on that thread of code above. I appreciate it. I hate it that there are so many ways to write the same thing. With so many variations, its difficult for a beginner to get them all down.


I tried your code idea and it still does the same thing. arrghh..


I have put in a call of SOS to Susan at her blog (Engauged). I dont know if the team get to keep their blogs. I am hoping they do. My thoughts are that I cant make my selectors do what I want, that they are linked, so I have asked her if its even possible.

Thanks again for the help.


Bill
 
Unfortunately Susan, like all but six employees left as "caretakers," no longer has access to either the former MS/FS beta newsgroups or MS email account.

What you want to accomplish however really is not possible using only stock commands and variables, because in FS all tanks are associated with a specific engine, which is of course engine 1 unless there's an index used:

(FUEL TANK SELECTOR:index,number)(where index is 1, 2, 3, or 4)

The Kodiak, having only one engine can therefore have as many tanks as you wish, but only one "real" tank selector. This is why all your attempts so far have both "selectors" responding no matter which one on which you click.

You could define unique (L:TankSelectorLeft,enum) and (L:TankSelectorRight,enum) variables, along with the mouse code to control their positions.

Then, in an <Update> routine, "read" the two custom variables and SET the actual tank to be used based on them.

In pseudo-code:

if{ L=1 and R=1 } SET BOTH on
if{ L=1 and R=0 } SET LEFT on
if{ L=0 and R=1 } SET RIGHT on
if{ L=0 and R=0 } SET OFF
 
Ahh so...


So I was right then.. Only one selector is possible even with two or three selectors.. . arrghh..


That Spirit of St. Louis must be a nightmare to code, lol.... I'll have to check that out to see how they got through it.


Thanks also for letting me know on Susans statis. Sad... I was hoping they could at least blog..


Bill
 
Its sinking in now how you meant using an L:var for movements. Linking those to 'fuel on' but still having them use their own animations 'might' just work.

A day of rest though...




Bill
 
Its sinking in now how you meant using an L:var for movements. Linking those to 'fuel on' but still having them use their own animations 'might' just work.

A day of rest though...

Bill

Yes, the Lord's Day is best set aside for rest... ;)

I'm delighted to hear that!

You know I could simply write the XML script for you, but I'd much rather provide the hints and let you do the rest yourself. That's the only real way to learn... :teacher:
 
Back
Top