Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[FS9] XML Condition Statement

Featured Replies

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

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
The 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

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

  • 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
  • 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.

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.