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

FSXA Throttle control

euroastar350

Resource contributor
Messages
863
Country
us-delaware
Hi guys,

Well here is very complicated set of controls and need to know how to transform from a 2D gauge to a workable 3D code.

First off is the idle control or throttle lock if you will. Basically I place the throttle into "IDLE" and cannot be moved into the "OFF" position until I depress the "IDLE" control switch, then the throttle can be moved into the "OFF" position

Since the project I am doing for Milviz has an idle release switch, I need to know how I would go about converting the 2D script into a workable script for a 3D object.

The 2D script is setup for 2 engines....but for my application, I need it for just only 1 engine.

Here is the 2D script:

Code:
<Gauge Name="Idle Release" Version="1.0">
   <Update Frequency="6"/>
   <Size X="843" Y="804"/>
   <Image Name="idle_release_bckgrnd.bmp" Luminous="Yes"/>
   <Element>
      <Position X="268" Y="531"/>
      <Image Name="Idle_Release.bmp" Luminous="Yes"/>
   </Element>
   <Element>
      <Visible>(L:Eng2IdleStopRelease, bool)</Visible>
      <Position X="268" Y="531"/>
      <Image Name="Idle_Release.bmp" Luminous="Yes"/>
   </Element>
   <Element>
      <Visible>(L:Eng3IdleStopRelease, bool)</Visible>
      <Position X="268" Y="531"/>
      <Image Name="Idle_Release.bmp" Luminous="Yes"/>
   </Element>
   <Element>
      <Select>
         <Value>30 (&gt;L:IdleStopDuration,enum)









			(L:Eng2IdleStopTimer, enum) 0 &gt;









			if{









			(L:Eng2IdleStopTimer, enum) -- (&gt;L:Eng2IdleStopTimer, enum)









			}









			(L:Eng3IdleStopTimer, enum) 0 &gt;









			if{









			(L:Eng3IdleStopTimer, enum) -- (&gt;L:Eng3IdleStopTimer, enum)









			}









			</Value>
      </Select>
   </Element>
   <Mouse>
      <Area Left="240" Top="550" Width="35" Height="54">
         <Cursor Type="Hand"/>
         <Click Kind="LeftSingle+Leave">(M:Event) 'LeftSingle' scmp 0 == (L:Eng2IdleStopRelease, bool) 0 == and if{ 1 (&gt;L:Eng2IdleStopRelease, bool) (L:IdleStopDuration,enum) (&gt;L:Eng2IdleStopTimer, enum) }









  			(M:Event) 'Leave' scmp 0 == (L:Eng2IdleStopRelease, bool) 1 == and if{ 0 (&gt;L:Eng2IdleStopRelease, bool) }			









			</Click>
      </Area>
      <Area Left="340" Top="550" Width="45" Height="54">
         <Cursor Type="Hand"/>
         <Click Kind="LeftSingle+Leave">(M:Event) 'LeftSingle' scmp 0 == (L:Eng3IdleStopRelease, bool) 0 == and if{ 1 (&gt;L:Eng3IdleStopRelease, bool) (L:IdleStopDuration,enum) (&gt;L:Eng3IdleStopTimer, enum) }









  			(M:Event) 'Leave' scmp 0 == (L:Eng3IdleStopRelease, bool) 1 == and if{ 0 (&gt;L:Eng3IdleStopRelease, bool) }			









			</Click>
      </Area>
      </Mouse>
</Gauge>
 
And here is the click section of the throttle control. Again setup for 2 engines, but need it for just 1 engine.

The first 2 lines is for controlling engine 1

The second 2 lines is for controlling both engines

The third 2 lines are for controlling engine 2

All my engine needles are pretty much working now, just need to add the working throttle to have engine control.

Code:
<Area Left="220" Top="150" Width="35" Height="55">
         <Cursor Type="UpArrow"/>
         <Click Repeat="Yes" MouseWheelFlip="Yes">(A:General Eng Mixture Lever Position:2,percent) ++ 163.84 * (&gt;K:MIXTURE2_SET) 









			</Click>
      </Area>
      <Area Left="220" Top="270" Width="35" Height="55">
         <Cursor Type="DownArrow"/>
         <Click Repeat="Yes" MouseWheelFlip="Yes">(A:general eng mixture lever position:2,percent) int 4 &gt;









			(A:general eng mixture lever position:2,percent) int 4 &lt; ||









			(L:Eng2IdleStopTimer, enum) 0 &gt; ||









			if{









			(&gt;K:MIXTURE2_DECR_SMALL)









			(A:General Eng Mixture Lever Position:2,percent) -- 163.84 * (&gt;K:MIXTURE2_SET) 









			}









			</Click>
      </Area>
      <Area Left="305" Top="150" Width="35" Height="55">
         <Cursor Type="UpArrow"/>
         <Click Repeat="Yes" MouseWheelFlip="Yes">(A:General Eng Mixture Lever Position:2,percent) ++ 163.84 * (&gt;K:MIXTURE2_SET) 









			(A:General Eng Mixture Lever Position:3,percent) ++ 163.84 * (&gt;K:MIXTURE3_SET) 









			</Click>
      </Area>
      <Area Left="305" Top="270" Width="35" Height="55">
         <Cursor Type="DownArrow"/>
         <Click Repeat="Yes" MouseWheelFlip="Yes">(A:general eng mixture lever position:2,percent) int 4 &gt;









			(A:general eng mixture lever position:2,percent) int 4 &lt; ||









			(L:Eng2IdleStopTimer, enum) 0 &gt; ||









			if{









			(A:General Eng Mixture Lever Position:2,percent) -- 163.84 * (&gt;K:MIXTURE2_SET) 









			}









			(A:general eng mixture lever position:3,percent) int 4 &gt;









			(A:general eng mixture lever position:3,percent) int 4 &lt; ||









			(L:Eng3IdleStopTimer, enum) 0 &gt; ||









			if{









			(A:General Eng Mixture Lever Position:3,percent) -- 163.84 * (&gt;K:MIXTURE3_SET) 









			}









			</Click>
      </Area>
      <Area Left="380" Top="150" Width="35" Height="55">
         <Cursor Type="UpArrow"/>
         <Click Repeat="Yes" MouseWheelFlip="Yes">(A:General Eng Mixture Lever Position:3,percent) ++ 163.84 * (&gt;K:MIXTURE3_SET) 









			</Click>
      </Area>
      <Area Left="380" Top="270" Width="35" Height="55">
         <Cursor Type="DownArrow"/>
         <Click Repeat="Yes" MouseWheelFlip="Yes">(A:general eng mixture lever position:3,percent) int 4 &gt;









			(A:general eng mixture lever position:3,percent) int 4 &lt; ||









			(L:Eng3IdleStopTimer, enum) 0 &gt; ||









			if{









			(A:General Eng Mixture Lever Position:3,percent) -- 163.84 * (&gt;K:MIXTURE3_SET) 









			}









			</Click>
      </Area>

Sorry about long code boxes as I copied the scripts from the actual gauges themselves. The throttle control has the idle release variable and determines where the throttle will stop when in idle. Any help is appreciated
 
And here is the click section of the throttle control.

Sorry about long code boxes as I copied the scripts from the actual gauges themselves. The throttle control has the idle release variable and determines where the throttle will stop when in idle. Any help is appreciated

Well, the first "help" is to remove all the blank lines and make the scripts readable...
Code:
<Area Left="220" Top="150" Width="35" Height="55">
  <Cursor Type="UpArrow"/>
  <Click Repeat="Yes" MouseWheelFlip="Yes">
    (A:General Eng Mixture Lever Position:2,percent) ++ 163.84 * 
    (&gt;K:MIXTURE2_SET)
  </Click>
</Area>

<Area Left="220" Top="270" Width="35" Height="55">
  <Cursor Type="DownArrow"/>
  <Click Repeat="Yes" MouseWheelFlip="Yes">
    (A:general eng mixture lever position:2,percent) int 4 &gt;
    (A:general eng mixture lever position:2,percent) int 4 &lt; ||
    (L:Eng2IdleStopTimer, enum) 0 &gt; ||
    if{
    (&gt;K:MIXTURE2_DECR_SMALL)
    (A:General Eng Mixture Lever Position:2,percent) -- 163.84 * 
    (&gt;K:MIXTURE2_SET)
    }
  </Click>
</Area>

<Area Left="305" Top="150" Width="35" Height="55">
  <Cursor Type="UpArrow"/>
  <Click Repeat="Yes" MouseWheelFlip="Yes">
    (A:General Eng Mixture Lever Position:2,percent) ++ 163.84 * 
    (&gt;K:MIXTURE2_SET)
    
    (A:General Eng Mixture Lever Position:3,percent) ++ 163.84 * 
    (&gt;K:MIXTURE3_SET)
  </Click>
</Area>

<Area Left="305" Top="270" Width="35" Height="55">
  <Cursor Type="DownArrow"/>
  <Click Repeat="Yes" MouseWheelFlip="Yes">
    (A:general eng mixture lever position:2,percent) int 4 &gt;
    (A:general eng mixture lever position:2,percent) int 4 &lt; ||
    (L:Eng2IdleStopTimer, enum) 0 &gt; ||
    if{
    (A:General Eng Mixture Lever Position:2,percent) -- 163.84 * 
    (&gt;K:MIXTURE2_SET)
    }

    (A:general eng mixture lever position:3,percent) int 4 &gt;
    (A:general eng mixture lever position:3,percent) int 4 &lt; ||
    (L:Eng3IdleStopTimer, enum) 0 &gt; ||
    if{
    (A:General Eng Mixture Lever Position:3,percent) -- 163.84 * 
    (&gt;K:MIXTURE3_SET)
    }
  </Click>
</Area>

<Area Left="380" Top="150" Width="35" Height="55">
  <Cursor Type="UpArrow"/>
  <Click Repeat="Yes" MouseWheelFlip="Yes">
    (A:General Eng Mixture Lever Position:3,percent) ++ 163.84 * 
    (&gt;K:MIXTURE3_SET)
  </Click>
</Area>

<Area Left="380" Top="270" Width="35" Height="55">
  <Cursor Type="DownArrow"/>
  <Click Repeat="Yes" MouseWheelFlip="Yes">
    (A:general eng mixture lever position:3,percent) int 4 &gt;
    (A:general eng mixture lever position:3,percent) int 4 &lt; ||
    (L:Eng3IdleStopTimer, enum) 0 &gt; ||
    if{
    (A:General Eng Mixture Lever Position:3,percent) -- 163.84 * 
    (&gt;K:MIXTURE3_SET)
    }
  </Click>
</Area>
 
And now the first bit of script in readable format:
Code:
<Gauge Name="Idle Release" Version="1.0">
  <Update Frequency="6"/>
  <Size X="843" Y="804"/>
  <Image Name="idle_release_bckgrnd.bmp" Luminous="Yes"/>
  <Element>
    <Position X="268" Y="531"/>
    <Image Name="Idle_Release.bmp" Luminous="Yes"/>
  </Element>
  <Element>
    <Visible>(L:Eng2IdleStopRelease, bool)</Visible>
    <Position X="268" Y="531"/>
    <Image Name="Idle_Release.bmp" Luminous="Yes"/>
  </Element>
  <Element>
    <Visible>(L:Eng3IdleStopRelease, bool)</Visible>
    <Position X="268" Y="531"/>
    <Image Name="Idle_Release.bmp" Luminous="Yes"/>
  </Element>
  <Element>
    <Select>
      <Value>
        30 (&gt;L:IdleStopDuration,enum)
        (L:Eng2IdleStopTimer, enum) 0 &gt;
        if{
        (L:Eng2IdleStopTimer, enum) -- (&gt;L:Eng2IdleStopTimer, enum)
        }

        (L:Eng3IdleStopTimer, enum) 0 &gt;
        if{
        (L:Eng3IdleStopTimer, enum) -- (&gt;L:Eng3IdleStopTimer, enum)
        }
      </Value>
    </Select>
  </Element>
  
  <Mouse>
    <Area Left="240" Top="550" Width="35" Height="54">
      <Cursor Type="Hand"/>
      <Click Kind="LeftSingle+Leave">
        (M:Event) 'LeftSingle' scmp 0 == (L:Eng2IdleStopRelease, bool) 0 == and if{ 1 (&gt;L:Eng2IdleStopRelease, bool) (L:IdleStopDuration,enum) (&gt;L:Eng2IdleStopTimer, enum) }
        (M:Event) 'Leave' scmp 0 == (L:Eng2IdleStopRelease, bool) 1 == and if{ 0 (&gt;L:Eng2IdleStopRelease, bool) }
      </Click>
    </Area>

    <Area Left="340" Top="550" Width="45" Height="54">
      <Cursor Type="Hand"/>
      <Click Kind="LeftSingle+Leave">
        (M:Event) 'LeftSingle' scmp 0 == (L:Eng3IdleStopRelease, bool) 0 == and if{ 1 (&gt;L:Eng3IdleStopRelease, bool) (L:IdleStopDuration,enum) (&gt;L:Eng3IdleStopTimer, enum) }
        (M:Event) 'Leave' scmp 0 == (L:Eng3IdleStopRelease, bool) 1 == and if{ 0 (&gt;L:Eng3IdleStopRelease, bool) }
      </Click>
    </Area>
  </Mouse>
</Gauge>
 
Ok so I implemented the code into the model and I get a slight movement and it doesn't read full. This is the code I am using converted from the 2D gauge code:

Code:
<PartInfo>
        <Name>throttle_grip</Name>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (A:general eng2 mixture lever position, position) 1 min d 0 &gt;= if{ 10 * near }
                </Code>
                <Lag>200</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <MouseFlags>LeftSingle+LeftDrag</MouseFlags>
            <CallbackCode>
                (A:General Eng Mixture Lever Position:2,percent) ++ 163.84 * 
                (&gt;K:MIXTURE2_SET)

                (A:general eng mixture lever position:2,percent) int 4 &gt;
                (A:general eng mixture lever position:2,percent) int 4 &lt; ||
                (L:Eng2IdleStopTimer, enum) 0 &gt; ||
                if{
                (A:General Eng Mixture Lever Position:2,percent) -- 163.84 * 
                (&gt;K:MIXTURE2_SET)
                }
            </CallbackCode>
        </MouseRect>
    </PartInfo>

This is for rich mixture
Code:
(A:General Eng Mixture Lever Position:2,percent) ++ 163.84 * 
                (&gt;K:MIXTURE2_SET)

This is for lean mixture
Code:
(A:general eng mixture lever position:2,percent) int 4 &gt;
                (A:general eng mixture lever position:2,percent) int 4 &lt; ||
                (L:Eng2IdleStopTimer, enum) 0 &gt; ||
                if{
                (A:General Eng Mixture Lever Position:2,percent) -- 163.84 * 
                (&gt;K:MIXTURE2_SET)
                }

The handle has 3 postions. 0-50-100. There is also an idle release which I haven't coded yet and a custom Lvar is already in place in the lean mixture script. Any help is appreciated
 
Hi,

I'm not sure what you are doing with this line:

(A:general eng2 mixture lever position, position) 1 min d 0 &gt;= if{ 10 * near }

The 1 min sets the maximum value to 1, which is already true for position units, I believe. But even with multiplying by 10 it probably doesn't move much. That sets the maximum keyframe possible to 10 out of 100.

If you use percent instead of position, does it move more?
 
Ok so I have been going at this for the last 3 days with no success. I get some movement, but nothing happens at all. Keep in mind that this throttle is unique because it uses the engine 2 mixture variable for controlling engine power. Here is the modified script:

Code:
<PartInfo>
        <Name>throttle_grip</Name>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (L:Eng2ThrottlePercent,enum)
                </Code>
                <Lag>200</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <MouseFlags>LeftSingle+LeftDrag</MouseFlags>
            <CallbackCode>
                (A:General Eng Mixture Lever Position:2,percent) ++ 163.84 * (&gt;K:MIXTURE2_SET)

                (A:general eng mixture lever position:2,percent) int 4 &gt;
                (A:general eng mixture lever position:2,percent) int 4 &lt; ||
                (L:Eng2IdleStopTimer, enum) 0 &gt; ||
                if{
                (&gt;K:MIXTURE2_DECR_SMALL)
                (A:General Eng Mixture Lever Position:2,percent) -- 163.84 * (&gt;K:MIXTURE2_SET) 
                }
            </CallbackCode>
        </MouseRect>
    </PartInfo>

The code works very well in 2D form, making it work on a 3D throttle is quite challenging. Any ideas is most welcome
 
I don't understand why you are using a custom throttle variable:

(L:Eng2ThrottlePercent,enum)

and when clicked it changes the mixture? How is this L: variable controlled - a 2D gauge?
 
Hi,

Something is unclear to me: you stated the model code is for 1 engine only, but you are using (A:General Eng Mixture Lever Position:2,percent) and (&gt;K:MIXTURE2_SET)?? Have you defined a "phantom" second engine in the .cfg file? Otherwise your code won't work at all, obviously :confused:

Tom
 
The custom variable is read from a system gauge which is placed in the configuration file. The code does come from a 2D gauge and it does work, just want to convert it to work as a 3D script. As for the lag, not sure why I placed that there.
 
Unless you have Engine.1 defined in aircraft.cfg, (A:general eng mixture lever position:2,percent) will be always 0, no matter what value you assign to K:MIXTURE2_SET or how much MIXTURE2_INC/DEC issue.
So, in this part of the code:

(A:General Eng Mixture Lever Position:2,percent) -- 163.84 * (&gt;K:MIXTURE2_SET)

you are actually doing -163.84 (>K:MIXTURE2_SET)

Now, if you have an event handler in a C++ gauge within the panel, you can actually inspect the value passed by MIXTURE2_SET and do some action, but in this case the only usable value would be that coming from MIXTURE2_INC, as MIXTURE2_SET would be always -163.84.


Tom

Edit: How many engines has the aircraft you're working on? Is that the final aircraft or you need to port the code to another with only one engine? Or maybe you have only one engine defined as engine.1 ?
 
Last edited:
Have you confirmed that your custom L: variable ranges between 0 and 100 as you expect?
 
Tom,

I guess he needs that code for his Bell 407 project. If I'm right then the main problem is he won't be able to use (A:General Eng Mixture Lever Position:2,percent) as the Bell has only one engine (Simconnect appart). Therefore he'd need to think about an alternate way of coding the example he's taking from probably a 2 engine aircraft.

Tom
 
Back
Top