July 20, 201015 yr Moderator I have an unusual requirement for a model I'm working on. The mixture lever(s) make a "ratcheting noise" when moved by the pilot, as they pass by small detents...What this means is that I need to detect whenever either lever is moved and play a very short sound clip...At first I thought perhaps an <On Event=....> might work (ignore the @PlayRacket, as I know it does work!): <Keys> <On Event="MIXTURE1_DECR">@PlayRacket</On> <On Event="MIXTURE1_INCR">@PlayRacket</On> </Keys> Since that didn't work, I next thought of trying to trap the current position and test it against a future movement using different <Update Frequency=xx> sections: <Macro Name="PlayRacket">1 (>L:XMLSND1,bool)</Macro> <Update Frequency="16"> (A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) (>L:OldMixturePos,enum) </Update> <Update Frequency="8"> (A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) (L:OldMixturePos,enum) > if{ @PlayRacket } </Update> Well, that doesn't work either. Can anyone come up with some new ideas or suggestions? I'd really like to get this racket going! :( Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
July 20, 201015 yr Bill, On your second example,, just reverse them! When the macro is called the previous mix is already saved before you can check if it changed. Also, donot know for sure if you can run 2 update/freqs. in the same gauge?? Maybe try w/o the updates.. <Macro Name="PlayRacket">1 (>L:XMLSND1,bool)</Macro> <Update Frequency="16"> (A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) (>L:OldMixturePos,enum) </Update> <Update Frequency="8"> (A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) (L:OldMixturePos,enum) > if{ @PlayRacket } </Update> Try this maybe for a first go... It includes a check to make sure it doesn't play racket on first load. <Macro Name="PlayRacket">1 (>L:XMLSND1,bool)</Macro><Update>(A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) s1 (L:OldMixturePos,enum) s2 == ! l2 0 == ! & if{ @PlayRacket l1 (>L:OldMixturePos,enum) }</Update> Just off the top of my head,, no more FS for me for a while, cannot test. My bit cruncher blowed up reeeaaal good :-(PS --- QUIET WITH THAT RACKET! LOLRoman FS RTWR SHRS F-111 JoinFS Little Navmap
July 21, 201015 yr Author Moderator Thanks for the suggestions, unfortunately neither works.Yes, you can have more than one <Update> in an XML script. The default GPS has several...The winner is "Flying Officer Jevans" who posted his suggestion at FS-Developer: <Macro Name="PlayRacket">1 (>L:XMLSND1,bool)</Macro> <Update Frequency="16"> (A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) (L:OldMixturePos1, percent) != if{ @PlayRacket } (A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) (>L:OldMixturePos1,percent) (A:GENERAL ENG MIXTURE LEVER POSITION:2,percent) (L:OldMixturePos2, percent) != if{ @PlayRacket } (A:GENERAL ENG MIXTURE LEVER POSITION:2,percent) (>L:OldMixturePos2,percent) </Update> In case anyone is wondering, here is what it sounds like when the mixture lever(s) are moved about 10%...http://n4gix.home.comcast.net/~n4gix/MixerLeverMoving.wavHmmm... Odd that Netscape will play the sound fine, but Internet Exploder says: Unable to display webpage... Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
July 21, 201015 yr Roger that Danny,You hit it on the nail! Either/Or should work, I included a startup check, otherwise all in all, the same. (A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) near s1 (L:OldMixturePos,enum) d =! 0 =! & if{ l1 (>L:OldMixturePos,enum) @PlayRacket }Roman FS RTWR SHRS F-111 JoinFS Little Navmap
July 21, 201015 yr Author Moderator Being the honest soul that I am, I must confess that when I tried both of your script suggestions......I had an alternate panel version of the a/c in question loaded, with it's own 'uncabbed' version of the gauge scripts running......hence, the edits I made were to an .xml file that wasn't even being used!So. Now I have to go stand in the corner for a few hours wearing that silly conical hat with the words D U N C E in huge white letters... :( When my self-imposed punishment period is over, I'll try again, perhaps using a modulus to only detect movement of 2% or greater, since the CH controls are just a bit "jittery..." :) Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
July 21, 201015 yr Bill, That's funny :( ! It happens. One way to get the 2% is to take the difference between stored and current, absolute, 2 > == RACKET ( also maybe use NEAR for the current mix position )Maybe something like this, w/o duplicates or stores. - cannot test. My previous load ini will not work.. You may have a "racket" on first panel load. (A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) near (L:OldMixturePos,enum) - abs 2 > if{ (A:GENERAL ENG MIXTURE LEVER POSITION:1,percent) near (>L:OldMixturePos,enum) @PlayRacket } Roman FS RTWR SHRS F-111 JoinFS Little Navmap
Create an account or sign in to comment