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

Setting L variables with a lever?

Messages
36
Country
argentina
Hi everyone

I've been trying to set a variable in a panel using a lever I have free in my joystick. The variable in question is (L:Fuel_Lever1_position, number).

The fuel lever position has 3 values: 0, 1, and 2. The idea is that, if the joystick lever is between 0 and 30%, the fuel lever position value is 0; 1 if it's between 31 and 70%; and 2 if it's over 71%. I'm thinking about using the joystick lever as a prop lever (looks like it's not used in the aircraft). This is what I've done:

Code:
<Gauge Name="JS31 Fuel levers" Version="1.0">
  <Size X="15" Y="15" />
  <Element>
    <Image Name="bkgnd.bmp"/>
  </Element>
  <Element>
    <Select>
      <Value>
        (A:GENERAL_PROPELLER_LEVER_POSITION,percent) 30 &lt; if{0 (&gt;L:Fuel_Lever1_position, number)}
        (A:GENERAL_PROPELLER_LEVER_POSITION,percent) 70 &gt; if{2 (&gt;L:Fuel_Lever1_position, number)}
      </Value>
    </Select>
  </Element>
  <Element>
    <Text x="15" Y="15" Length="1" Font="Arial" Color="White" Adjust="Center">
      <String>(L:Fuel_Lever1_position, number)</String>
    </Text>
  </Element>
</Gauge>

I assigned the lever and tried the gauge, however, I'm not getting any results. The background is just a 15x15 red bitmap, so that I can print there the value of the variable I'm trying to set (using the code in the third Element section) so that I can check if the gauge is working. But I can't any values inside the square :( Maybe this should be done in another way?

I forgot to say: this is for FS9.

Best regards from Colombia,
Luis Miguel
 
Last edited:
Syntax errors. You must have a space following the if{ statement, the closing } requires a space as well:

Code:
if{0  // This is incorrect!
if{ 0  // This is correct!

)}  // This is incorrect!
) }  // This is correct!
 
Last edited:
Syntax errors. You must have a space following the if{ statement, the closing } requires a space as well:

Oops, my bad. Thank you for the remark, Bill, I applied the corrections and this is what I've got:

Code:
<Gauge Name="JS31 Fuel levers" Version="1.0">
  <Update Frequency="6"/>
  <Size X="5" Y="5"/>
  <Element>
    <Select>
      <Value>
        (A:GENERAL ENG1 PROPELLER LEVER POSITION, percent) 30 &gt; (A:GENERAL ENG1 PROPELLER LEVER POSITION, percent) 70 &lt; &amp;&amp; if{ 1 (&gt;L:Fuel_Lever1_position, number) }
       els{ (A:GENERAL ENG1 PROPELLER LEVER POSITION, percent) 70 &gt; if{ 2 (&gt;L:Fuel_Lever1_position, number) } els{ 0 (&gt;L:Fuel_Lever1_position, number) } }
      </Value>
    </Select>
  </Element>
  <Element>
    <Select>
      <Value>
        (A:GENERAL ENG2 PROPELLER LEVER POSITION, percent) 30 &gt; (A:GENERAL ENG2 PROPELLER LEVER POSITION, percent) 70 &lt; &amp;&amp; if{ 1 (&gt;L:Fuel_Lever2_position, number) }
        els{ (A:GENERAL ENG2 PROPELLER LEVER POSITION, percent) 70 &gt; if{ 2 (&gt;L:Fuel_Lever2_position, number) } els{ 0 (&gt;L:Fuel_Lever2_position, number) } }
      </Value>
    </Select>
  </Element>
</Gauge>

As you may see, I removed the red square and its text (it was only for verification). Now the gauge works as intended.

The fuel lever value was originally controlled by +/- click zones in the pedestal (I got bored of opening the pedestal and I wrote the code lines you see). However, I notice that the click zones do not work anymore, like if they were overridden by the lever. I don't know if this is as expected, but I'd like to know if there is a way to give priority to the click zones over the lever.

Best regards from Colombia,
Luis Miguel
 
No, there isn't really any way to give mouse click zones "priority" over a controller (lever) command. It's truly an this-or-that proposition.
 
No, there isn't really any way to give mouse click zones "priority" over a controller (lever) command. It's truly an this-or-that proposition.

Well, I can live with that ;) Thank you very much, Bill.

Best regards from Colombia,
Luis Miguel
 
Back
Top