• 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 Missing brain

Messages
1,468
Country
italy
As you know sometimes my brain is missing
In the code below I want to play a sound if two criteria are met.
Altitude less than 7000ft and cabin rate set to 300fpm.
the cabin rate value for 300fpm is minus20
But no value is transferred to the L:soundvar
it is not a click gauge
vololiberista
Code:
<Gauge Name="Cabin comm test" Version="1.0">
   <Element>
    <Select>
      <Value>
(A:Indicated altitude, feet) 7000 &lt; (L:Cabin_Rate_Select,number) 20 - == and if{ 1 (>L:Sound_mes3,number) }
      </Value>
    </Select>
   </Element>
</Gauge>
 
This works BUT I only want the sound played Once ONLY
vololiberista
Code:
<Value>
(A:Indicated altitude, feet) 7000 &lt; (L:Cabin_Rate_Select,number) 20 - and if{ 1 (>L:Sound_mes3,number) }
      </Value>
 
Set up another variable (L:Sound_Played, bool) and set it to 1 when the sound is triggered. Then test for (L:Sound_Played, bool) 0 == when playing the sound. It should then only play once.

You'll need a way to reset (L:Sound_Played, bool) to 0 so the sound can be played again.
 
Vololiberista,


In your code, you have the sound command where a condition should go. I 'think' this might work.

<Value>
(A:Indicated altitude, feet) 7000 &lt;
if{ (L:Cabin_Rate_Select,number) 20 - == 1 (>L:Sound_mes3,number) }
els{ 0 }
</Value>


I believe that will only 'trigger' at 20, but, I dont know if the - is necessary. If you wanted 20 and-less-then, I believe you would write it as such;

if{ (L:Cabin_Rate_Select,number) 20 &lt; == 1 (>L:Sound_mes3,number) }

With the sound files; 1 denotes 1 play of the sound, 2 is loop, and 3 is the kill switch, so 1 should work.


I hope that code works. From what I understand, in a if/els, you start with a condition, then another condition with an action, condition/action, etc. Thus, you have a dual condition scenario and actions are noted secondary per each additional condition.

(wipes sweat from eyebrows)

Cool name; Volo Liberista. I just looked it up on Translate.google and its Italian for Free Flight.

Bill
 
Last edited:
Yes your translation is almost correct!!
vololiberista=free flyer. When i'm not pedalling in an aircraft cockpit I go paragliding in the Alps!!

The cabin rate value in my code has to be -20 (minus 20) as that equates to a 300fpm rate of change (thus identifying a/c in descent preparing for landing). -50=zero and +50=1000fpm.
I'll have a look at your code and work it in. It also has to trigger the steward's light on the captain's OH panel!
vololiberista
 
Last edited:
This now seems to be the working solution:-
Code:
 <Value>
(L:sound_played,bool) 0 == (A:Indicated altitude, feet) 7000 &lt; (L:Cabin_Rate_Select,number) 20 - and and if{ 1 (>L:Sound_mes3,number) 1 (>L:sound_played,bool) 1 (>L:CABIN CALL,number) (P:local time, seconds) 20.5 + (>L:CAB LIGHT 2,number) and and }
      </Value>
The cabin message is played just once and the steward's light comes on until cancelled by the Captain.
All the cabin communications to the flightdeck are now automatic :-))
vololiberista
 
Back
Top