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

FS2004 Gauges to trigger playing sounds

I mean the handle neutral / OFF position like in B737
1.jpg
xWdq_D33upP4K3yDbMgrPeGOQn774vhm6RCl59Jm0i0pu6vlkr8ZgB88ZH1lz2Ea1P9BtAiuu1R1ZOys9YV8-iq32wG1bg


In the model it returns to this position automatically when the gear is fully up or down.
 
Last edited:
I don't have one that returns automatically, but here is a manual version:

XML:
<Gauge Name="Gear" Version="1.0">
   <Element>
      <Select>
         <Value>
         (A:Gear handle position,position) 0.5 &gt;
         if{ -1 (&gt;L:gearposit, number) }
         els{ (L:gearposit, number) 0  &lt; if{ 1 (&gt;L:gearposit, number) } }
         (L:gearposit, number)
         </Value>
         <Case Value="1">
            <Image Name="GEAR_UP.bmp" ImageSizes="70,100"/>
         </Case>
         <Case Value="0">
            <Image Name="GEAR_OFF.bmp" ImageSizes="70,100"/>
         </Case>
         <Case Value="-1">
            <Image Name="GEAR_DOWN.bmp" ImageSizes="70,100"/>
         </Case>
      </Select>
   </Element>
   <Mouse>
         <Tooltip>LANDING GEAR HANDLE</Tooltip>
      <Area Bottom="35">
         <Cursor Type="UpArrow"/>
         <Click>07 (&gt;L:km_xml_sound_id, number) (A:AIRSPEED INDICATED,knots) 180 &lt; if{ 0 (&gt;L:Speed_Brake,bool) } 1 (&gt;L:gearposit, number) 0 (&gt;K:GEAR_UP) </Click>
      </Area>
      <Area Top="40" Bottom="60">
         <Cursor Type="Hand"/>
         <Click>03 (&gt;L:km_xml_sound_id, number) (A:Gear handle position,position) 0.5 &gt;
         if{ 0 (&gt;K:GEAR_UP) 1 (&gt;L:gearposit, number) }
         els{ 0 (&gt;L:gearposit, number) } </Click>
      </Area>
      <Area Top="65">
         <Cursor Type="DownArrow"/>
         <Click>07 (&gt;L:km_xml_sound_id, number) 0 (&gt;K:GEAR_DOWN) -1 (&gt;L:gearposit, number)</Click>
      </Area>
   </Mouse>
</Gauge>

Hope this helps,
 
Hope this helps,
Thanks! I just thought (A:Gear left position,percent) could be used somehow for the handle OFF position sound2. In real aircraft it's manual but in this model it goes off automatically in 2D / VC. I don't know what LVar if any is used for the handle. For 2D I have this one:

XML:
<Gauge Name="Landing gear control" Version="1.0">
   <Element>
      <Select>
         <Value>(A:Gear left position,percent) (A:Gear right position,percent) + near s0 200 == s1 l0 0 == l1 || ! (>G:Var1) 0
                      (A:Gear handle position,percent) 50 &gt; (G:Var1) &amp;&amp; if{ 1 }
                      (A:Gear handle position,percent) 50 &lt; (G:Var1) &amp;&amp; if{ -1 }
        </Value>
           <Case Value="-1">
             <Image Name="gear_up.bmp" ImageSizes="64,128,0,0"/>
           </Case>
           <Case Value="0">
             <Image Name="gear_nt.bmp" ImageSizes="64,128,0,0"/>
           </Case>
           <Case Value="1">
             <Image Name="gear_dn.bmp" ImageSizes="64,128,0,0"/>
           </Case>
      </Select>
   </Element>
   <Mouse>
      <Area>
         <Cursor Type="Hand"/>
         <Click Event="GEAR_TOGGLE"/>
      </Area>
   </Mouse>
</Gauge>
What comes to my mind promptly is to look into the animation in VC and see how long it takes for the handle to go off after the gear is up or down and link the sound2 to sound1 with a delay. Also I noticed the handle animation matches with the Landing Gear Indicator Lights so I'd better look into 2D to see if I have any LVars there that work in VC to link the sound2 with.
 
You could try this idea. not tested.
1 possible drawback I see is that when the aircraft is first loaded a sound mirroring the handle position might play just once.
Can't see anyway around it. That is, if it even works at all.
EDIT - Looking at it again, it probably will not play a sound just once when the aircraft is first loaded,
1) G:Var2 & G:Var3 will both equal 0. Are they different? No, no sound is played.
2) In nearly 100% of the time the sim will be started with the aircraft on the ground and gear down. Once again, both G:Var2 & G:Var3 will both equal 0. No sound is played.

XML:
<Gauge Name="Landing gear control" Version="1.0">

    <Update>
        <!-- Sounds get commanded here -->
        <!-- G:Var2 is the value from the display value, below -->
        <!-- G:Var3 is a register to indicate if the sound has played yet -->
        <!-- If they do not equal, play the sound with the value from G:Var2 selecting which sound to play -->
       
       
        <!-- Register does not equal commanded sound to play, play a sound -->
        (G:Var2) (G:Var3) != if{
            (G:Var2) 1 == (G:Var2) -1 == || if{
                    <!-- Play sound for handle up or handle down (sound #1) -->
                    1 (>L:Sound1, enum)
            } els{
                (G:Var2) 0 == if{
                    <!-- Play sound for handle centered (sound #2) -->
                    1 (>L:Sound2, enum)
                }
           
            }
            <!-- Reset the register, G:Var3, get ready to play the next sound -->
            (G:Var2) (>G:Var3)
        }
    </Update>

   <Element>
      <Select>
         <Value>(A:Gear left position,percent) (A:Gear right position,percent) + near s0 200 == s1 l0 0 == l1 || ! (>G:Var1) 0
                      (A:Gear handle position,percent) 50 &gt; (G:Var1) &amp;&amp; if{ 1 }
                      (A:Gear handle position,percent) 50 &lt; (G:Var1) &amp;&amp; if{ -1 }
                             <!--
                             Use the values calculated here for the sound update
                             The values calc'd above get placed in G:Var2 and s3, s3/l3 is used by the display below, G:Var2 by the update above
                             -->
                             s3 (>G:Var2) l3
        </Value>
           <Case Value="-1">
             <Image Name="gear_up.bmp" ImageSizes="64,128,0,0"/>
           </Case>
           <Case Value="0">
             <Image Name="gear_nt.bmp" ImageSizes="64,128,0,0"/>
           </Case>
           <Case Value="1">
             <Image Name="gear_dn.bmp" ImageSizes="64,128,0,0"/>
           </Case>
      </Select>
   </Element>
   <Mouse>
      <Area>
         <Cursor Type="Hand"/>
         <Click Event="GEAR_TOGGLE"/>
      </Area>
   </Mouse>
</Gauge>
 
Last edited:
Hi,

No, the default variable only goes up and down, no center position. I use a custom L: variable to handle it, while Gary uses a generic G: variable. The disadvantage of a G: variable is that it is local to the single gauge, and thus will not trigger other things like a modeled handle in the VC (assuming it is custom coded to react to the L: variable, or there is a "translation gauge" that converts the L: variable to what is coded in the VC handle).
 
Thanks guys! Did not find any LVars in the Landing Gear Indicator Lights 2D. It uses A instead for the gear position. So I used them for the sound:
XML:
       (A:Gear handle position,percent) 50 &gt; (L:HandlePrevious,number) 50 &lt; &amp;&amp; (L:HandleDNArmed,bool) ! &amp;&amp;
       if{ 1 (&gt;L:Sound1,enum) 1 (&gt;L:HandleDNArmed,bool) }
       (A:Gear handle position,percent) 50 &lt; (L:HandlePrevious,number) 50 &gt; &amp;&amp; (L:HandleDNArmed,bool) ! &amp;&amp;
       if{ 1 (&gt;L:Sound1,enum) 1 (&gt;L:HandleUPArmed,bool) }
      
      
       (A:Gear center position,percent) 0 &gt; (A:Gear right position,percent) 0 &gt; || (A:Gear left position,percent) 0 &gt; ||
       (A:Gear center position,percent) near 100 == (A:Gear right position,percent) near 100 == ||
       (A:Gear left position,percent) near 100 == || &amp;&amp;
       (L:HandleDNArmed,bool) &amp;&amp;

       if{
               1 (&gt;L:Sound2,number)
               0 (&gt;L:HandleDNArmed,bool)                 (* Resets *)
            }   

       (A:Gear center position,percent) 100 &lt; (A:Gear right position,percent) 100 &lt; || (A:Gear left position,percent) 100 &lt; ||
       (A:Gear center position,percent) near 0 == (A:Gear right position,percent) near 0 == ||
       (A:Gear left position,percent) near 0 == || &amp;&amp;
       (L:HandleUPArmed,bool) &amp;&amp;

       if{
               1 (&gt;L:Sound2,number)
               0 (&gt;L:HandleUPArmed,bool)                 (* Resets *)               
            }   

       (A:Gear handle position,percent) (&gt;L:HandlePrevious,number)
What do you think? It does play both sounds once when the aircraft is first loaded but the sounds now match the handle animation in VC / 2D.
 
You can add the first two lines of Bill's code to prevent the sound when the aircraft is loaded - then just add "(L:init,bool) and" to your code as an extra test to play the sound.
 
Is there a way to add sound to knobs of an old-fashion transponder in VC except Key Events (KEY_XPNDR) that appears to be working? 2D panel code:
XML:
<Gauge Name="Transponder" Version="1.0">
   <Image Name="transp_bg.bmp" Luminous="Yes" ImageSizes="413,193,0,0"/>
   <Element>
      <Position X="57" Y="139"/>
      <Image Name="xpdr_galet.bmp">
        <Axis X="21" Y="41"/>
      </Image>
      <Rotate>
         <Value>(A:Transponder1 code,number) 1000 / int 10 %</Value>
         <Nonlinearity>
            <Item Value="0" Degrees="-90"/>
            <Item Value="3" Degrees="0"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="255"/>
      </Rotate>
   </Element>
   <Element>
      <Position X="157" Y="151"/>
      <Image Name="xpdr_galet.bmp">
        <Axis X="21" Y="41"/>
      </Image>
      <Rotate>
         <Value>(A:Transponder1 code,number) 100 / int 10 %</Value>
         <Nonlinearity>
            <Item Value="1" Degrees="-90"/>
            <Item Value="4" Degrees="0"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="255"/>
      </Rotate>
   </Element>
   <Element>
      <Position X="257" Y="151"/>
      <Image Name="xpdr_galet.bmp">
        <Axis X="21" Y="41"/>
      </Image>
      <Rotate>
         <Value>(A:Transponder1 code,number) 10 / int 10 %</Value>
         <Nonlinearity>
            <Item Value="0" Degrees="-90"/>
            <Item Value="3" Degrees="0"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="255"/>
      </Rotate>
   </Element>
   <Element>
      <Position X="357" Y="139"/>
      <Image Name="xpdr_galet.bmp">
        <Axis X="21" Y="41"/>
      </Image>
      <Rotate>
         <Value>(A:Transponder1 code,number) 10 %</Value>
         <Nonlinearity>
            <Item Value="1" Degrees="-90"/>
            <Item Value="4" Degrees="0"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="255"/>
      </Rotate>
   </Element>

   <Mouse>
      <Area Left="17" Top="97" Right="97" Height="95">
        <Area Right="47">
           <Cursor Type="DownArrow"/>
           <Click Repeat="Yes">(A:Transponder1 code,number) 1000 / int 10 % 0 &gt; if{ 0 (>K:XPNDR_1000_DEC) }</Click>
        </Area>
        <Area Left="47">
           <Cursor Type="UpArrow"/>
           <Click Repeat="Yes">(A:Transponder1 code,number) 1000 / int 10 % 7 &lt; if{ 0 (>K:XPNDR_1000_INC) }</Click>
        </Area>
      </Area>
      <Area Left="117" Top="97" Right="197" Height="95">
        <Area Right="47">
           <Cursor Type="DownArrow"/>
           <Click Repeat="Yes">(A:Transponder1 code,number) 100 / int 10 % 0 &gt; if{ 0 (>K:XPNDR_100_DEC) }</Click>
        </Area>
        <Area Left="47">
           <Cursor Type="UpArrow"/>
           <Click Repeat="Yes">(A:Transponder1 code,number) 100 / int 10 % 7 &lt; if{ 0 (>K:XPNDR_100_INC) }</Click>
        </Area>
      </Area>
      <Area Left="217" Top="97" Right="297" Height="95">
        <Area Right="47">
           <Cursor Type="DownArrow"/>
           <Click Repeat="Yes">(A:Transponder1 code,number) 10 / int 10 % 0 &gt; if{ 0 (>K:XPNDR_10_DEC) }</Click>
        </Area>
        <Area Left="47">
           <Cursor Type="UpArrow"/>
           <Click Repeat="Yes">(A:Transponder1 code,number) 10 / int 10 % 7 &lt; if{ 0 (>K:XPNDR_10_INC) }</Click>
        </Area>
      </Area>
      <Area Left="317" Top="97" Right="397" Height="95">
        <Area Right="47">
           <Cursor Type="DownArrow"/>
           <Click Repeat="Yes">(A:Transponder1 code,number) 10 % 0 &gt; if{ 0 (>K:XPNDR_1_DEC) }</Click>
        </Area>
        <Area Left="47">
           <Cursor Type="UpArrow"/>
           <Click Repeat="Yes">(A:Transponder1 code,number) 10 % 7 &lt; if{ 0 (>K:XPNDR_1_INC) }</Click>
        </Area>
      </Area>
  </Mouse>
</Gauge>
Many thanks for any help as always.
 
If you mean Doug's gauge this thread is all about that. I need to add sound to knobs of a transponder in VC I would rather ask for example what these 2 expressions mean mathematically: 1000 / int 10 % 0 &gt; and 1000 / int 10 % 7 &lt;
You asked how to add sound, the answer was given. This thread is not the documentation on how to use Doug Dawson's sound gauge and you should really read that documentation so that you have a better understanding of how to add sound to the transponder's controls. Once you understand how to use the gauge to add sound, I think everything else will fall into place without any need to ask about a simple math equation that's simply ensuring you don't try to go above 7 or below 0.

P.S.
Maybe I'm being harsh, but I really hate when people won't read the documentation and just want someone to give them the answer they could get from documentation.
 
If you mean Doug's gauge this thread is all about that. I need to add sound to knobs of a transponder in VC I would rather ask for example what these 2 expressions mean mathematically: 1000 / int 10 % 0 &gt; and 1000 / int 10 % 7 &lt;
Divide the current number by 1000. Take only the integer portion of the result. Get the modulo 10 of the result (divide the result by 10 and return the remainder of the division). Check if the result is greater than 0 AND less than 7,
 
I only read his post immediately above, but WarpD is right is there are separate click spots.
Thanks Tom! The 2D is just for the reference. I need the sound in VC. It appears the transponder animation is linked to (A:Transponder1 code,number). Will this work:
XML:
       (A:Transponder1 code,number) (L:Transponder1,number) !=
       if{ 1 (&gt;L:Knob Sound,number) (A:Transponder1 code,number) (&gt;L:Transponder1,number) }
What do you think?
 
Back
Top