• 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

Messages
98
Rob, thanks a lot!

Is it correct that I just add a copy of the code above between <Element> ... </Element> with new LVars - in this case L:ARMED**, L:Altitude**, L:FAMessages** if I want to add some more altitude callouts like 'seat belt sign off', food service onboard, etc?

Well it's a simple logic so is there a way to do it depending on the assigned cruise level? For example the 'seat belt sign off' callout around 5,000-7,000 feet to the cruise level altitude? And food service starts around 5 minutes after reaching cruise altitude?
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
Yes, that's correct.
Just make sure the Lvars in each section remain unique (where needed).

As to adding other cruise level - derived sounds:
You have the basics working now, so for other callouts I suggest you first do some digging and trial-and-error yourself.
Like there are many threads on how to use timers in XML.

I'm Always willing to help further if you are running into troubles, but you need to get through the learning-curve yourself.
Programming this is just trial-and-error once you understand the basics.
That's how we all learned it …. LoL

Best regards, Rob
 
Messages
113
Country
unitedstates
Programming this is just trial-and-error once you understand the basics.
That's how we all learned it …. LoL
Boy, is that ever right, Rob! :rolleyes:

I've been working on integrating a new TacPack missile onto a plane. Just ONE kind of missile! I've been at it for a few weeks now, and I'm just getting to the "testable" point. This is giving me a splitting headache, too o_O
It seems like every <element.../element> I add to a single gauge doesn't work right the first time. Or maybe the 5th time...

But I am learning XML programming and plane gauges. Steep learning curve, for me, but I'm getting it!
Long, slow, process, but immensely rewarding when I finally get an Element to work correctly. It's a really awesome feeling :cool:

Just wanted to throw that in. Sorry to have intruded.
Pat☺
 
Messages
98
Thanks, guys! Now trying to detect turbulence for a callout 'fasten seat belts' when the seat belt signs are assumed to be off and then to unfasten when the turbulence ends.

It's not 'fool-proof' since I'm trying to link it with an altitude above 10,000 feet during climb or at cursing altitude when the seat belt signs have been already turned off.

Anyway have taken part of the code by Heretic in this thread::
https://www.fsdeveloper.com/forum/threads/any-variable-or-similar-for-turbulence.437593/
XML:
<Element>
    <Select>
      <Value>

      
(E:Absolute Time, seconds) (L:Wind Change Start Time, seconds) - 1 &gt;
if{ (E:Absolute Time, seconds) (>L:Wind Change Start Time, seconds)
(A:AIRSPEED INDICATED, knots) (>L:Airspeed Delayed, number)
(A:VERTICAL SPEED, feet per minute) (>L:Vertical Speed Delayed, number)
}

(A:AIRSPEED INDICATED, knots) (L:Airspeed Delayed, number) - abs 15 &gt;
(A:VERTICAL SPEED, feet per minute) (L:Vertical Speed Delayed, number) - abs 500 &gt;
if{ 1 (>L:TurbulenceON, number)

}


      </Value>
    </Select>
</Element>

Yet it keeps activating L:TurbulenceON again and again. Is there any way to have it play only once and only above 10,000 feet and also play L:TurbulenceOFF when the turbulence stops?

Tried to add (A:Radio Height, feet) 10000 &gt;= to the code and triggers similar to the previous gauge logic but it didn't work.

Any help would be appreciated.
 
Messages
542
Country
australia
Playing triggered sounds is incredible , it's quite neat the effect that can be achieved .

This is just for an example of what can be done , it might be of interest to some to listen to an audio example .
The audio is about 2.5 minutes long of GCA approach guidance triggered from the Synthetic ILS instrument that I created a while ago .

Link is ,
https://www.flightsim.com/vbfs/show...-instrument-For-every-Runway-at-every-Airport

Relevant replies at that thread are ,
Reply # 39 - discusses examples of proposed audio text that might be used .
Reply # 47 - series of screenshots of auto approach control linked to Synthetic ILS instrument .
Reply # 56 - provides a link to the 2.5 min audio .

In my opinion it is rather impressive .

Cheers
Karol
 
Messages
98
Looks like adding the height variable just triggers the sound above 10,000 feet no matter if there is turbulence or not... Well detecting turbulence is way beyond my knowledge so giving it up.
 

ddawson

Resource contributor
Messages
862
Country
canada
Looks like adding the height variable just triggers the sound above 10,000 feet no matter if there is turbulence or not... Well detecting turbulence is way beyond my knowledge so giving it up.
If you've ever taken a statistics course...
If you are in level flight, your average vertical speed will be zero. The standard deviation will also be at or near zero.
In turbulent conditions, your average vertical speed will still be zero, but the standard deviation will be non-zero.
Capturing that in an xml gauge is probably not for the faint of heart...
 
Messages
98
Thanks, Doug! The code above by Heretic looks like really detecting turbulence but I could not have it work for me...

Well decided to make a gauge that will trigger playing boarding/unboarding pax sounds. The idea was that when opening the doors at gate there could heard boarding pax sound looped (and unboarding on arrival) that stops when closed. Then all reset for the next or return flight.

Used some logic Rob suggested for triggering 'Doors to manual'. Will this work:
XML:
<Element>
    <Select>
      <Value>
      
            (* Arming for unboarding on arrival *)
            (A:GROUND VELOCITY,knots) 80 &lt; (L:PREVIOUS GROUND VELOCITY,knots) 80 &gt;=  &amp;&amp;
            if{ 1 (>L:UNBOARDARMED,bool) }
           (A:GROUND VELOCITY,knots) (>L:PREVIOUS GROUND VELOCITY,knots)
    
    (* EXIT Open *)
    (A:EXIT OPEN:0,bool) (A:CIRCUIT AVIONICS ON,bool) &amp;&amp; (L:UNBOARDARMED,bool) &amp;&amp;
    (A:Brake parking position,bool)  &amp;&amp; (L:PlayUnboard,bool) ! &amp;&amp;
    if{ 2 (>L:UnboardSound,number) 1 (>L:PlayUnboard,bool)
    
    } (* play loop until closed *)
    (* EXIT Closed *)
    (A:EXIT OPEN:0,bool) ! (L:UNBOARDARMED,bool) &amp;&amp;
    (A:Brake parking position,bool)  &amp;&amp; (L:PlayUnboard,bool) &amp;&amp;
    if{ 0 (>L:UnboardSound,number) 0 (>L:PlayUnboard,bool)
               0 (>L:UNBOARDARMED,bool)                 (* Unboard reset *)   
    } (* Stop sound *)
      
             (* Arming for boarding *)
             (A:SIM ON GROUND,bool) (A:Brake parking position,bool) &amp;&amp;
             if{ 1 (>L:BOARDARMED,bool) }

    (* EXIT Open *)
    (A:EXIT OPEN:0,bool) (A:CIRCUIT AVIONICS ON,bool) &amp;&amp; (L:BOARDARMED,bool) &amp;&amp;
    (L:PlayBoard,bool) ! &amp;&amp; (L:UNBOARDARMED,bool) ! &amp;&amp;
    if{ 2 (>L:BoardSound,number) 1 (>L:PlayBoard,bool)
    
    } (* play loop until closed *)
    (* EXIT Closed *) 
    (A:EXIT OPEN:0,bool) ! (L:UNBOARDARMED,bool) ! &amp;&amp;
    (L:PlayBoard,bool) &amp;&amp; (L:UNBOARDARMED,bool) ! &amp;&amp;
    if{ 0 (>L:BoardSound,number) 0 (>L:PlayBoard,bool)
               0 (>L:BOARDARMED,bool)                 (* Board reset *)   
    } (* Stop sound *)
      
 
      </Value>
    </Select>
</Element>
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
You're making this way too complex IMO ...LoL
Not sure why you would use two sounds for board and unboard (noise of footsteps, etc are the same for board and unboard ??) , but a few tips:

The Avar for EXIT OPEN:0 isn't a boolean, but a number varying between 0 and 1 (any value between 0 and 1 , depending on the state of the animation).
Or use percent.
Also, for playing a sound repeatedly, you don't need build in a protection against playing once. Just keep writing the Lvar to 2 at every schedule while the condition is true, and write 0 when false.

So simply use:
Code:
(A:EXIT OPEN:0,percent) 99 &gt;
(A:CIRCUIT AVIONICS ON,bool) &amp;&amp;
(A:Brake parking position,bool)  &amp;&amp;
if{ 2 } els{ 0 } (>L:PaxSound,number)

Rob
 
Last edited:
Messages
98
Rob, thanks! Well needed 2 sounds because FA's say Hi while pax boarding and Bye when unboarding and seat belts flipping is more intense once the doors are open
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
Rob, thanks! Well needed 2 sounds because FA's say Hi while pax boarding and Bye when unboarding and seat belts flipping is more intense once the doors are open
Ok, then you just need to add one bool criterium that maintains whether you are boarding or unboarding if doors are opened.
Rob
 
Messages
98
Thanks! Also what is the difference if I put each Element separately like <Element>..</Element> in one XML gauge and to put all between:

XML:
    <Update Frequency="2"/> or "0"?
        <Element>   
        <Shift>
        <Value>
                ...
        
        </Value>
        </Shift>
    </Element>
in one gauge? And what is Update Frequency?
 
Messages
113
Country
unitedstates
I believe, and I am not going to say "I think" because I don't at this time of day, that Update Frequency is how often per second the XML gauge updates. Like any A: Vars there may be, or whatever.

Also what is the difference if I put each Element separately like <Element>..</Element> in one XML gauge and to put all between:
If you mean "Can you make multiple Elements in one XML gauge", then the answer is a resounding YES.
Like this:
Code:
<Element>   
        <Shift>
        <Value>
                ...
        
        </Value>
        </Shift>
    </Element>
    
    <Element>   
        <Shift>
        <Value>
                ...
        
        </Value>
        </Shift>
    </Element>
    
    <Element>   
        <Shift>
        <Value>
                ...
        
        </Value>
        </Shift>
    </Element>
As many as you need for that particular gauge.

Does this help at all?
Pat☺
 
Messages
98
Also I would like to use landing lights as a trigger when cleared of the runway. Will (A:LIGHT LANDING,bool) !
influence other lights for example in the default b737 like cabin lighting (shift + L) so when the cabin lighting is ON the trigger won't work?
 
Messages
113
Country
unitedstates
Thanks, Pat! Is it the same if it all would be as one Element? Will it work?
It's the same as all one gauge.
In other words, you want a gauge that will play a sound if X happens, and another if Y happens, while ensuring the engines have started, and that the plane has turned on a light.
Each of those can be a separate Element.

Like this:
(Pretend code!)
Code:
Element

    select

        value

if (A:event X) (>k:play sound1)

        /value

    /select

/element

Element

    select

        value

if (A:event y) (>k:play sound2)

        /value

    /select

/element

Element

    select

        value

if (A:airplane's speed is below 10kts) (>k:turn on taxi lights) (>k:play sound3) and

        /value

    /select

/element
You see?
Obviously, this IS NOT real xml code, but it gets the point across, I hope.
Obviously too, the whole thing would be wrapped in Gauge.../Gauge and all the other "stuff" you need for a proper gauge.

Also I would like to use landing lights as a trigger when cleared of the runway. Will (A:LIGHT LANDING,bool) !
influence other lights for example in the default b737 like cabin lighting (shift + L) so when the cabin lighting is ON the trigger won't work?
No, each light has it's very own Key Event (K:Blah blah). They don't interact, unless you choose to use the L command (master lights on/off switch) key event.

Hope this answers your questions. :)
I am just a beginner at this XML stuff, so I sincerely hope one of the super-gurus will correct me when (not if!) I make mistakes, but I believe the above is pretty close to the answers you seek, HP.

Pat☺
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Thanks! Also what is the difference if I put each Element separately like <Element>..</Element> in one XML gauge and to put all between:

XML:
    <Update Frequency="2"/>
         ...
         ...
         ...
   </Update>
It is not necessary to use the <Element>xxx</Element> structure in an <Update>...</Update> section. Use the <Update> only for pure "logic" you want to have evaluated every cycle (or at a set "Frequency").

For items that require textures, use the <Element> structure. Those will be evaluated on every cycle regardless.
 
Top