Jump to content
Sign in to follow this  
martinlest2

What defines a switch default on or default off?

Recommended Posts

Who's addon are you asking him to fix?


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

So it's a commercial product.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

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:

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...