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.

What defines a switch default on or default off?

Featured Replies

  • Author

VirtualCol Jetstream 31 -  the developers are looking into this, kindly, (as it's not a fault per se - the generator switch error apart), but I would like to push my own xml knowlege a bit too, and Bill is helping in this.

Martin Stebbing, EGLF (UK)

  • Author

Bill, I have successfully set the other switches too. I don't quite understand the syntax though:


  <!-- INITIALIZATION SECTION, DO ONCE AT GAUGE LOAD -->
  <Update>
    (G:Var1) 0 == if{ (A:ELECTRICAL MASTER BATTERY, bool) (>L:BATTERY_MASTER, enum) 1 (>G:Var1) }
  </Update>
  <!-- END INITIALIZATION SECTION -->
  

Where does " A:ELECTRICAL MASTER BATTERY " come from? How would that transfer for example to lights or other panel functions. For the generators, I haven't changed it, just the value before 'enum' (of course) and it seems to work fine..

 

I notice that this addition does not set the switches to the same 'off' position every time you load the aircraft, but sets the switches to the same way they were when the aircraft was closed. This seems to work even after restarting FS9. If the switches are on, they load as on; the same with all positions. If the code does not set the switches to 'off' in itself, how does the sim remember the last position and manage to reload the same later??

 

:wink:

Martin Stebbing, EGLF (UK)

  • Moderator

To briefly answer your questions, the "error" stopping the XML script from running was in Roman's example of how to initialize the custom battery L: variable (problem highlighted in red):

 

(G:Var1) 0 == if{ (A:ELECTRICAL MASTER BATTERY, bool) ! (>L:BATTERY_MASTER, enum) 1 (>G:Var1) }

 

An "exclamation point" used at this point is a "syntax error" since it has no meaning in the context of a simple variable update assignment.

 

Simplifying the above for the sake of explanation, (A:var) (>L:var) simply means take the value of the sim's (A:var) and push it into my custom (>L:var) - where the operator symbol ">" means "push"...

 

The "!" symbol in "XML Speak" is "negation", so clearly it has no place in a such variable assignment!

 

To answer your other question, all A: variables belong to the sim engine. It keeps track of them automatically. That is why the "initialization routine" is necessary to synchronize the custom (L:var) with the sim's (A:var).

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author

OK, I see what Roman meant now. And I missed the fact that he had highlighted the "!" in red... my eyes not being what they once were. (None of me is, come to that).

 

A: variables belong to the sim engine

 

So after A:, what governs the text of the entry? In theory, you can put anything before the comma? Not sure I have understood what you mean by belonging to the sim engine.

 

Thanks for your patience with a relative beginner at xml coding!

Martin Stebbing, EGLF (UK)

  • Moderator

No, you can't just make stuff up. There is an SDK (Software Development Kit) in which all sim variables are listed, along with descriptions of what they represent. There is also a complete list of all command events (K:command) that may be used.

 

There is an on-line version of the "ESP SDK" that is virtually identical to the FSX SDK:

https://msdn.microsoft.com/en-us/library/cc526948.aspx

 

Here is a direct link to the pages of the above SDK describing the sim variables:

https://msdn.microsoft.com/en-us/library/cc526981.aspx

 

I highlighted the "!" character to point out the mistake in Roman's suggestion. I surmise he was typing a bit fast and missed it, as he's usually spot-on accurate. :Whistle:

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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.