May 21, 201016 yr Hi everybody!I'm developing an extension to an existing gauge for personal use with the UKMIL Harriers. What I'm trying to achieve is a "betty" style voice who will yell at me if I pull too much G (a terrible habit of mine.) I'm going to adapt the existing code to achieve this and use the DSD XML Sound Gauge to play the sounds.Anyhow, here is the condition statement I'm having trouble understanding: (A:G FORCE, gforce) abs 3.0 > (A:Airspeed Indicated,knots) 100 > && if{ (A:LIGHT TAXI,bool) ! if{ (>K:TOGGLE_TAXI_LIGHTS) } } els{ (A:LIGHT TAXI,bool) if{ (>K:TOGGLE_TAXI_LIGHTS) } }Is the part highlighted in bold a "nested" if statement or is it just a variation of how a single if statement is written in gauge syntax? Furthermore, I'd like to know what the purpose of the else statement is if some kind soul could explain?Thanks in advance,- Argy
May 21, 201016 yr Hi everybody!I'm developing an extension to an existing gauge for personal use with the UKMIL Harriers. What I'm trying to achieve is a "betty" style voice who will yell at me if I pull too much G (a terrible habit of mine.) I'm going to adapt the existing code to achieve this and use the DSD XML Sound Gauge to play the sounds.Anyhow, here is the condition statement I'm having trouble understanding: (A:G FORCE, gforce) abs 3.0 > (A:Airspeed Indicated,knots) 100 > && if{ (A:LIGHT TAXI,bool) ! if{ (>K:TOGGLE_TAXI_LIGHTS) } } els{ (A:LIGHT TAXI,bool) if{ (>K:TOGGLE_TAXI_LIGHTS) } }Is the part highlighted in bold a "nested" if statement or is it just a variation of how a single if statement is written in gauge syntax? Furthermore, I'd like to know what the purpose of the else statement is if some kind soul could explain?Thanks in advance,- ArgyThe way I read this, it is a nested if statement If the absolute value of the G FORCE is greater than 3.0 and the airspeed is greater than 100 knots,then:if the taxi lights are not on, turn them onelse:if the taxi lights are on, turn them off Bert
May 21, 201016 yr Hi!You can use one conditional stament whit just a single if{ } omiting the els{ } part if it is not required (it's a kind of "if not" after the conditios of the "if" are not satisfied). the nested if{ } is to add a second condition to the main statement, in this case to trigger the event just once and not all the time the main conditions are meet. In fact you can use only one if{ } to update a boolean parameter. For example this a simplified version of what use in HUD Control Panel: (L:NavHasGS, bool) (L:A3Available, bool) ! && (L:NavHasGS, bool) ! (L:A3Available, bool) && || if{ (L:A3Available, bool) ! (>L:A3Available, bool) } Javier
May 22, 201016 yr Moderator or example this a simplified version of what use in HUD Control Panel:Same script, but formatted for easier reading! :)(L:NavHasGS, bool)(L:A3Available, bool) ! and(L:NavHasGS, bool) ! (L:A3Available, bool) andorif{ (L:A3Available, bool) ! (>L:A3Available, bool) } Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
May 22, 201016 yr Author Hi everybody, and thanks for your quick help and replies!I understand that piece of code now, and my understanding of condition statements in XML has been improved dramatically. Thank you so much Bert, Jav, and n4gix.Once again, thanks very much one and all!Best regards- ArgyP.S. I'll probably be back in a couple of weeks when my exams are finished to say that I can't get it to work :( or hopefully, present a working piece of code to you all.
May 22, 201016 yr P.S. I'll probably be back in a couple of weeks when my exams are finished to say that I can't get it to work :( or hopefully, present a working piece of code to you all.Look for the XML primer in your SDK file if you have not found it already..Program Files/Microsoft Games/Microsoft Flight Simulator X SDK/SDK/SimObject Creation Kit/Panels and Gauges SDK/creating xml gauges.html Bert
Create an account or sign in to comment