FSX Turbine Throttle Levers

#1
I have decided to have another go at coding my throttle levers contained in a 2D gauge, I was not happy with the select & shift elements I have used & decided to use only shift elements. The throttle lever needs two seperate elements, one from cut-off-idle & one from idle-full power where idle is 10% throttle, so I need to code the first element for the throttle lever to move from cut-off to idle (0%-10% throttle percentage) which when the starter is engaged the engine ignites at =>20% N2 & then the second element controls the throttle percentage from 10% to 100%. Here's the code I have come up with so far, the animation works but the engine ignition does not.

Code:
<SimGauge.Macro id="Ignition Left" Name="Ignition_L">
    <MacroValue>(A:TURB ENG IGNITION SWITCH:1,bool) 1 == if{ (A:Turb eng N2:1, percent) 20 &gt; (A:General Eng1 Fuel Valve, bool) 1 == (A:GENERAL ENG1 FUEL PUMP SWITCH,bool) 1 ==  }</MacroValue>
</SimGauge.Macro>


<SimGauge.Element id="Cut Off-Idle L">
    <FloatPosition>14.000,185.000</FloatPosition>
    <Visibility>(A:General Eng Throttle Lever Position:1,percent) 0 ==</Visibility>
    <Image id="Throttle_Cut_left.bmp" Name="Throttle_Cut_left.bmp">
        <Transparent>True</Transparent>
        <Bright>True</Bright>
    </Image>
    <MaskImage id="Throttle_lever_left_mask.bmp" Name="Throttle_lever_left_mask.bmp">
    </MaskImage>
    <Shift id="Shift">
        <Scale>0.000,1.000</Scale>
        <Expression id="Expression">
            <Minimum>0.000</Minimum>
            <Maximum>10.000</Maximum>
            <Script>(A:General Eng Throttle Lever Position:1,percent) (L:Eng Cut:1, bool)</Script>
        </Expression>
    </Shift>
</SimGauge.Element>

<SimGauge.Element id="Throttle Left">
    <FloatPosition>14.000,17.000</FloatPosition>
    <Visibility>(A:General Eng Throttle Lever Position:1,percent) 0 &gt;</Visibility>
    <Image id="Throttle_lever_left.bmp" Name="Throttle_lever_left.bmp">
        <Transparent>True</Transparent>
        <Axis>-1.000,-165.000</Axis>
        <Bright>True</Bright>
    </Image>
    <MaskImage id="Throttle_lever_left_mask.bmp" Name="Throttle_lever_left_mask.bmp">
    </MaskImage>
    <Shift id="Shift">
        <Scale>0.000,-1.400</Scale>
        <Expression id="Expression">
            <Minimum>10.000</Minimum>
            <Maximum>100.000</Maximum>
            <Script>(A:General Eng Throttle Lever Position:1,percent)</Script>
        </Expression>
    </Shift>
</SimGauge.Element>


<SimGauge.MouseArea id="Cut Off-Idle L">
    <FloatPosition>10.000,260.000</FloatPosition>
    <Size>80,75</Size>
    <CursorType>Hand</CursorType>
    <MouseClick id="MouseClick">
        <Script>    (M:Y) 130 - 134 /  0  max 1 min  1 - /-/  1
(A:Throttle lower limit,part)
s0 - * l0 +  1638.0 *  (&gt;K:THROTTLE1_SET)
                                    (L:Eng Cut:1, bool) 10 == if{ (&gt;K:MIXTURE1_RICH) (&gt;@Ignition_L) }
                                    (L:Eng Cut:1, bool) 0 == if{ (&gt;K:MIXTURE1_LEAN) }</Script>
        <ClickType>LeftSingle+LeftDrag</ClickType>
        <MouseWheelFlip>True</MouseWheelFlip>
    </MouseClick>
</SimGauge.MouseArea>


<SimGauge.MouseArea id="Throttle-Left">
    <FloatPosition>10.000,5.000</FloatPosition>
    <Size>80,250</Size>
    <CursorType>Hand</CursorType>
    <MouseClick id="MouseClick">
        <Script>(M:Y) 130 - 134 /  0  max 1 min  1 - /-/  1
(A:Throttle lower limit,part)
s0 - * l0 +  16384.0 *  (&gt;K:THROTTLE1_SET) </Script>
        <ClickType>LeftSingle+LeftDrag</ClickType>
        <MouseWheelFlip>True</MouseWheelFlip>
    </MouseClick>
    <Tooltip id="Tooltip">
        <DefaultId>TOOLTIPTEXT_THROTTLE_ENG1_THROTTLE_PERCENT</DefaultId>
    </Tooltip>
</SimGauge.MouseArea>

In the "Cut Off-Idle L" mouse script I changed the 16384.0 to 1638.0 as it is 10%, I am not sure what the (M:Y) 130 - 134 / 0 max 1 min 1 - /-/ 1 does or the s0 - * l0 +, still got lots to learn!
I would greatly appreciate any help with this.
 
#3
Code:
<SimGauge.Macro id="Ignition Left" Name="Ignition_L">
    <MacroValue>(A:TURB ENG IGNITION SWITCH:1,bool) 1 == if{ (A:Turb eng N2:1, percent) 20 &gt; (A:General Eng1 Fuel Valve, bool) 1 == (A:GENERAL ENG1 FUEL PUMP SWITCH,bool) 1 ==  }</MacroValue>
</SimGauge.Macro>
I don't understand your Macro logic..do you want to start engine ignition with it? In that case maybe it is not working because you need to query the variables in different order:
you might want to check wether
N2 > 20%
check for fuel valve open
Fuel pump switch on
and all those conditions met then you fire ignition.

Code:
            <Script>(A:General Eng Throttle Lever Position:1,percent) (L:Eng Cut:1, bool)</Script>
this is another Im not quite sure I understand what you want to achieve.. If I assume you want to set value of LVar you might want to do so:
Code:
            <Script>(A:General Eng Throttle Lever Position:1,percent) (>L:Eng Cut:1, bool)</Script>
or
Code:
            <Script>(A:General Eng Throttle Lever Position:1,percent) (&gt;L:Eng Cut:1, bool)</Script>
By default boolean variables can be true=1 or false=0 so you test by one of those two conditions testing for anything else seem odd (might work never tested, but then you need to set the value) look at your code below it seems to me you are looking for the 10% but then you better use LVar (L:Eng Cut:1, enum) or (L:Eng Cut:1, number)
Code:
        <Script>    (M:Y) 130 - 134 /  0  max 1 min  1 - /-/  1
(A:Throttle lower limit,part)
s0 - * l0 +  1638.0 *  (&gt;K:THROTTLE1_SET)
                                    (L:Eng Cut:1, bool) 10 == if{ (&gt;K:MIXTURE1_RICH) (&gt;@Ignition_L) }
                                    (L:Eng Cut:1, bool) 0 == if{ (&gt;K:MIXTURE1_LEAN) }</Script>
There might be more of this stuff wrapped around you need to check your scripting logic it might be likely the issue here...
 
#4
I have done it:), I thought why should I use 2 elements when I can do it with one, just me over complicating things!! so I just used a single throttle element & added the cut-idle code to mouse script.

Code:
<SimGauge.Element id="Throttle Left">
    <FloatPosition>14.000,17.000</FloatPosition>
    <Image id="Throttle_lever_left.bmp" Name="Throttle_lever_left.bmp">
        <Transparent>True</Transparent>
        <Axis>-1.000,-165.000</Axis>
        <Bright>True</Bright>
    </Image>
    <MaskImage id="Throttle_lever_left_mask.bmp" Name="Throttle_lever_left_mask.bmp">
    </MaskImage>
    <Shift id="Shift">
        <Scale>0.000,-1.400</Scale>
        <Expression id="Expression">
            <Minimum>0.000</Minimum>
            <Maximum>100.000</Maximum>
            <Script>(A:General Eng Throttle Lever Position:1,percent)</Script>
        </Expression>
    </Shift>
</SimGauge.Element>

<SimGauge.MouseArea id="Throttle-Left">
    <FloatPosition>10.000,5.000</FloatPosition>
    <Size>80,250</Size>
    <CursorType>Hand</CursorType>
    <MouseClick id="MouseClick">
        <Script>(M:Y) 130 - 134 /  0  max 1 min  1 - /-/  1
(A:Throttle lower limit,part)
s0 - * l0 +  16384.0 *  (&gt;K:THROTTLE1_SET)
(A:General Eng Throttle Lever Position:1,percent) 10 &gt; if{ (&gt;K:MIXTURE1_RICH) (&gt;@Ignition_L) }
(A:General Eng Throttle Lever Position:1,percent) 1 &lt; if{ (&gt;K:MIXTURE1_LEAN) }</Script>
        <ClickType>LeftSingle+LeftDrag</ClickType>
        <MouseWheelFlip>True</MouseWheelFlip>
    </MouseClick>
    <Tooltip id="Tooltip">
        <DefaultId>TOOLTIPTEXT_THROTTLE_ENG1_THROTTLE_PERCENT</DefaultId>
    </Tooltip>
</SimGauge.MouseArea>

I must learn not to over think things, making it harder than it actually is!!

Thanks adino for your input.
 
Top