December 14, 201015 yr I have this code brewed up with some help here in the forum.. <Element> <Select> <Value> (A:Spoilers handle position,percent) 5 < (A:Spoilers handle position,percent) 1 > && if{ 1 (>L:Sound3,number) } els{ 0 (>L:Sound3,number) } </Value> </Select></Element> What I want is that with a little movement, lets say from 1 to 5 percent, I want to have a sound played. (dsd_xml_sound3 in FS9)Now, above works but is reverse, when I put the spoiler (axis on throttle quadrant) back to 0 percent, the sound is played, not by leaving the gate.I just looking for the initial movement of the lever as a sound.What did I do wrong here ?:Confused:Johan
December 14, 201015 yr I have this code brewed up with some help here in the forum..<Element> <Select> <Value> (A:Spoilers handle position,percent) 5 < (A:Spoilers handle position,percent) 1 > && if{ 1 (>L:Sound3,number) } els{ 0 (>L:Sound3,number) } </Value> </Select></Element> What I want is that with a little movement, lets say from 1 to 5 percent, I want to have a sound played. (dsd_xml_sound3 in FS9) My FSX(check the FS9 version) SDK says;Spoiler handle position, Percent Over 100 "or" Position (16K = down, 0 = up) It does not say that percent is not used though.Try using the decimals.You can also try using "Range" for status detection, the direction of travel doesn't matter... <Value> 0.01 0.05 (A:Spoilers handle position,percent over 100) rng if{ 1 (>L:Sound3,number) } els{ 0 (>L:Sound3,number) } </Value> Using the "rng" argument, if the third entry falls between the first two it equates to a "1".I use it for detecting transitions in gear, flaps etc...Don
December 14, 201015 yr I have this code brewed up with some help here in the forum..<Element> <Select> <Value> (A:Spoilers handle position,percent) 5 < (A:Spoilers handle position,percent) 1 > && if{ 1 (>L:Sound3,number) } els{ 0 (>L:Sound3,number) } </Value> </Select></Element> What I want is that with a little movement, lets say from 1 to 5 percent, I want to have a sound played. (dsd_xml_sound3 in FS9)Now, above works but is reverse, when I put the spoiler (axis on throttle quadrant) back to 0 percent, the sound is played, not by leaving the gate.I just looking for the initial movement of the lever as a sound.What did I do wrong here ?:Confused:Johan Hi Johan,I'm not exactly sure how you want it work.1. Play a sound once when the spoiler lever is set out of the initial (OFF) position only ?2. Play a sound at any small movement of the lever in upward (towards full spoiler) direction ?3. Or .... ?Another thing:I assume you are testing this when the aircraft is on the ground and standing still with idle throttle ?Because the Spoilers function behaves rather funny in MSFS, when on the ground with Idle throttle. When the Spoiler axis is moved out of null (with Throttle Idle), the Spoiler variable is set to 100% (probably has to do with Arming Spoilers).I'm still wondering if this is a "feature" or "bug" .Try it now (when on the ground) by setting the throttle to at least 10%.My guess is that you want to give an audible warning signal, if, and only if, the Spoiler lever is set out of the idle position when you are flying. Right ?If so, try the following code (in the air):<Element> <Select> <Value> (A:Sim On Ground,bool) ! (A:Spoilers handle position,percent) 5 > && (L:PreviousSHP,number) 5 < && if{ 1 (>L:Sound3,number) } (A:Spoilers handle position,percent) (>L:PreviousSHP,number) </Value> </Select></Element> Or in plain text: the sound is played once when the Spoiler axis transitions through 5% in upward direction. The value 5 is just used to allow for a Spoiler axis that is not fully calibrated (won't return to exactly 0) or is "jittering" slightly.Cheers, Rob
December 16, 201015 yr Author Thanks, I tried, but its not what I want..I like to hear when the lever is between lets say 3 and 7 percent, just once. When up AND down.I only hear it when the lever is going back to 0.Same for the parking brakes, when set and release. My sound keeps on repeating with my culprits.I am 'prutser'.
December 16, 201015 yr I like to hear when the lever is between lets say 3 and 7 percent, just once. When up AND down.I only hear it when the lever is going back to 0.My sound keeps on repeating with my culprits.I am 'prutser'. That last remark is yours, and I won't comment on it ... :( But I'm still not sure what you are trying to achieve here .... :Rolling Eyes:1. Do you want to play the sound (once) when you place the spoiler lever in that 3-7% area (in upward direction, coming from a position from less then 3%, and in downward direction, coming from a position from greater than 7%)?And if so, how long should the lever be in that postion (to distinguish between "transitioning" through the area and "placing" it in that area) ??2. Or want the sound played when the lever transitions through that area in upward and downward direction ?But if 2., what's the point of the 3 - 7 % area ?? Even worse, if you move the lever too fast, you miss detecting the lever going through that area.Still confused, or maybe we should do this in Dutch :smile:Because the way you describe it is just too ambiguous for me to code it :( Cheers, Rob
December 16, 201015 yr Author well, actually, what I am looking for Rob , is just very simple..When one moves the spoiler lever from 0 to whatever, play a sound once.. then from whatever back at 0, play it again.
December 17, 201015 yr well, actually, what I am looking for Rob , is just very simple..When one moves the spoiler lever from 0 to whatever, play a sound once.. then from whatever back at 0, play it again.Hi Johan,That's clear :( Try the code below.Again: IN THE AIR only, because you won't hear the sound on the ground (see explanation in a previous post)<Element> <Select> <Value> (A:Sim On Ground,bool) ! if{ (A:Spoilers handle position,percent) 1 > (L:PreviousSHP,number) 1 < && (A:Spoilers handle position,percent) 1 < (L:PreviousSHP,number) 1 > && || if{ 1 (>L:Sound3,number) } } (A:Spoilers handle position,percent) (>L:PreviousSHP,number) </Value> </Select> </Element> This code is as trivial as it can get; but if it doesn't work (I tested it) there's another 10 reasons or so why it won't do what you want, but has nothing to do with this code.To mention a few:- If you still hear the sound only in downward direction: this isn't the XML code (or XML gauge containing it) that is executed by FS.- Your aircraft is not in the air.- Another gauge is controlling "spoilers" also- If you don't hear anything at all: the sound gauge isn't at the place you defined it, or the sound.ini has errors or is in another place that you defined in the panel.cfg, or this panel.cfg (but another panel.cfg) isn't used, ....- Your spoiler lever isn't calibrated properly- and another few reasons.If still not successfull, contact me via normal Email.Cheers, Rob
December 17, 201015 yr Johan,You wrote - "What I want is that with a little movement, lets say from 1 to 5 percent" .... Does that mean you want the sound to play anytime there's a 5% change? If not then the 1-5% above examples should work. The arm spoilers as Rob mentioned may play into it though.. ( Rob, I do have code to override that though, just gotta find it... EDIT - THAT CODE WAS FOR FS02!! It worked correct then, a MS update (FS04) pooched it!) Now the big question - Do you just want the sound just as the handle is moved -or- if the handle is moved and the actual spoilers are still moving? In any case the 1st thing you'd want to do is to store the previous position of the handle at the time of last trigger so you would know what to compare the next time the spoiler handle is moved. Also store the handle position last time moved even if it didn't trigger the sound IE < 5%. <Element><Select><Value>(A:Spoilers handle position,percent) (L:My_last_handle_pos,number) - abs 4 > if{ 1 (>L:Sound3,number) (A:Spoilers handle position,percent) (>L:My_last_handle_pos, number) } els{ 0 (>L:Sound3,number) (A:Spoilers handle position,percent) (L:My_last_handle_pos, number) != if{ (A:Spoilers handle position,percent) (L:My_last_handle_pos, number) } }</Value></Select></Element> A little cleaned up using s1,s2 & l1,l2 as temporary stores also with the "near" function to give a whole number, just make it less sensitive. <Element><Select><Value>(A:Spoilers handle position,percent) near s1 (L:My_last_handle_pos, number) near s2 - abs 4 > if{ 1 (>L:Sound3,number) l1 (>L:My_last_handle_pos, number) } els{ 0 (>L:Sound3,number) l1 l2 != if{ l1 (>L:My_last_handle_pos, number) } }</Value></Select></Element> Even more so using the update tag instead of the element/select/value set of tags. <Update>(A:Spoilers handle position,percent) near s1 (L:My_last_handle_pos, number) near s2 - abs 4 > if{ 1 (>L:Sound3,number) l1 (>L:My_last_handle_pos, number) } els{ 0 (>L:Sound3,number) l1 l2 != if{ l1 (>L:My_last_handle_pos, number) } }</Update> There's many more ways to write the same thing -- Just thaught of one - <Update>(A:Spoilers handle position,percent) near s1 (L:My_last_handle_pos, number) near s2 != if{ l1 (>L:My_last_handle_pos, number) l2 - abs 4 > if{ 1 (>L:Sound3,number) } els{ 0 (>L:Sound3,number) } }</Update> Hope this may help,RomanEdited - replaced =! with != Edited December 17, 201015 yr by spokes2112 FS RTWR SHRS F-111 JoinFS Little Navmap
December 17, 201015 yr Author Yes, the last one worked the best!Thanks a lot, I gonna try to adapt it for a parking brake sound also, and the flaps lever.:(
Create an account or sign in to comment