FSX Flap Gauge Coding

#1
Hi all,

Sorry I am a bit stuck on this one and not sure if it can be done in a 2D gauge is there anyway you can clicl the flap lever down or up and returns to center after each click.
e.g do drop 3 notches of flap you will have to push it three times and image always centered.

I have looked through SDK and Forum search and drawn a blank below is all I have so far.

Any help would be graciously received

Cheers
Matt

XML:
<Gauge Name="Flaps" Version="1.0">
<Element>
<Select>
 <Value>(A:Flaps handle index,number)</Value>
<Case Value="0">
 <Image Name="flaps1.bmp"/>
 </Case>
<Case Value="1">
 <Image Name="flaps2.bmp"/>
 </Case>
<Case Value="2">
 <Image Name="flaps3.bmp"/>
 </Case>
 </Select>
 </Element>
<Mouse>
<Area Height="100" Width="100" Top="100" Left="0">
 <Cursor Type="DownArrow"/>
 <Click Repeat="Yes" Event="FLAPS_DECR"/>
 </Area>
<Area Height="100" Width="100" Top="0" Left="0">
 <Cursor Type="UpArrow"/>
 <Click Repeat="Yes" Event="FLAPS_INCR"/>
 </Area>
 </Mouse>
 </Gauge>




 
Last edited:
#4
Your mouse areas are way too complicated.
Try;
XML:
<Area Top="0" Bottom="100">
 <Cursor Type="DownArrow"/>
 <Click Repeat="Yes" Event="FLAPS_DECR"/>
 </Area>
<Area Top="100" Bottom="200">
 <Cursor Type="UpArrow"/>
 <Click Repeat="Yes" Event="FLAPS_INCR"/>
 </Area>
Now that you've got that working you can think about adding conditionals into your case values to have it do what you wanted to do in your first post.
But I'd be worried about not knowing your flap position if the handle is always in the centre.
 
#5
You could do this in a few ways, below are some examples.
The first one relies on a simple timer,the second one relies on a click type handler.
Neither one has been tested live but code examples have been used before.
XML:
<Gauge Name="Flaps" Version="1.0">
    <Update>
        (G:Var1) s1 0 != if{
            l1 0 &gt; if{ l1 1 - } els{ l1 1 + } (>G:Var1)
        }
    </Update>
    <Element>
        <Select>
            <Value>l1 0 == if{ 0 } els{ l1 0 &lt; if{ 2 } els{ 1 } } </Value>
            <Case Value="0"> <!-- SWITCH CENTER -->
                <Image Name="flaps1.bmp"/>
             </Case>
            <Case Value="1"> <!-- SWITCH UP -->
                <Image Name="flaps2.bmp"/>
             </Case>
            <Case Value="2"> <!-- SWITCH DOWN -->
                <Image Name="flaps3.bmp"/>
             </Case>
         </Select>
     </Element>
    <Mouse>
    <!-- THE 9 / -9 IS THE TIMER VALUE, IN THIS CASE 9 / -9 IS EQUIVALENT TO 1/2 SECOND -->
        <Area Height="100" Width="100" Top="0" Left="0">
             <Cursor Type="UpArrow"/>
             <Click Repeat="No">
                9 (>G:Var1) (>K:FLAPS_DECR)
            </Click>
         </Area>
        <Area Height="100" Width="100" Top="100" Left="0">
             <Cursor Type="DownArrow"/>
             <Click Repeat="No">
                -9 (>G:Var1) (>K:FLAPS_INCR)
            </Click>
         </Area>
     </Mouse>
</Gauge>

XML:
 <Gauge Name="Flaps" Version="1.0">
    <Element>
        <Select>
            <Value>(G:Var1)</Value>
            <Case Value="0"> <!-- SWITCH CENTER -->
                <Image Name="flaps1.bmp"/>
             </Case>
            <Case Value="1"> <!-- SWITCH UP -->
                <Image Name="flaps2.bmp"/>
             </Case>
            <Case Value="2"> <!-- SWITCH DOWN -->
                <Image Name="flaps3.bmp"/>
             </Case>
         </Select>
     </Element>
    <Mouse>
        <Area Height="100" Width="100" Top="0" Left="0">
             <Cursor Type="UpArrow"/>
             <Click Repeat="No" Kind="LeftSingle+LeftRelease+Leave">
                (M:Event) 'LeftSingle' scmp 0 == if{
                    1 (>G:Var1) (>K:FLAPS_DECR)
                } els{
                    0 (>G:Var1)
                }
            </Click>
         </Area>
        <Area Height="100" Width="100" Top="100" Left="0">
             <Cursor Type="DownArrow"/>
             <Click Repeat="No" Kind="LeftSingle+LeftRelease+Leave">
                (M:Event) 'LeftSingle' scmp 0 == if{
                    2 (>G:Var1) (>K:FLAPS_INCR)
                } els{
                    0 (>G:Var1)
                }
            </Click>
         </Area>
     </Mouse>
</Gauge>
 
Last edited:

tgibson

Resource contributor
#6
Hi,

Many older planes used levers of this type, usually combined with a flaps position gauge. Often you moved the lever to the center position to avoid keeping pressure in the hydraulic control lines for long periods of time (or similar issues). Many aircraft did the same thing for landing gear levers.
 
#7
Thank you gentlemen will make the adjustments and give it a whirl. Don't worry Chris there is a flap gauge as well. Nearly finished pic below Commander 115 pleased with cowl flap. As it is a pull out job it gets larger the more open the cowls get.

114.jpg
 
#8
Quick Update

I have the Gauge working I tried both The timer gauge works well and I will be using that one.
The second one did not move the .bmps

Spokes and Chris thank you both so much for your time.

Cheers
Matt


 
#9
Matt,
The second one is all my fault - not enough coffee when written, hehe..
Corrected now and should work although not tested. Available as an example.

Roman
 
#10
Roman! You've ruined my day :)
Just got into work (boring babysitting job) and I find it's all done.
Now what am I going to do for the rest of the day?
 
Top