Jump to content
Sign in to follow this  
Guest Skymed

Storing values into xml variables

Recommended Posts

Guest iagman

1.I wish to store a 0 or 1 into both the PWR_TOGGLE and LEFT_TURN variables. Why doesn

Share this post


Link to post
Share on other sites

1.Because after you write a variable with the current stack value, the next value you write will be the value of "stackpointer-1".So what you need to do is place the value on the stack twice, using the "d" operator.I.e.:(L:PWR_TOGGLE, bool) ! d (>L:PWR_TOGGLE, bool) (>>L:LEFT_TURN, bool)2. Assuming that this variable just needs an initial value, and can be changed by the code later on: start your gauge code with an initialisation element, that is only executed once.Like:(L:INIT,bool) !if{ 1 (>L:INIT,bool) 25 (>L:VARIABLE_A,number)} Note: use an L:Var for this INIT variable, NOT an G:Var.Because a G:Var will be reset to 0 when you change from WindowedMode to FullScreenMode, vice versa.Cheers, Rob Barendregt

Share this post


Link to post
Share on other sites
Guest iagman

"(>>L:LEFT_TURN, bool"What purpose does the "greater than" symbol perform in xml when used in this manner?Glenn

Share this post


Link to post
Share on other sites

Hi,"(>&g;L:LEFT_TURN, bool)"Is wrong, for sure Rob's typo :-). You may use(>L:LEFT_TURN, bool)or (>L:LEFT_TURN, bool)Because ">" is not supported by some editors, it can be replaced by ">" (forget the quotes)Regards,Tom

Share this post


Link to post
Share on other sites

Thanks Tom ..Yes, that was a typo :-)Since I've ran into at least one situation where ">" didn't work in XML (can't remember why anymore) I'm used used to using ">" only ...Cheers, Rob

Share this post


Link to post
Share on other sites
Guest iagman

In answering question two regarding initializing variables, you wrote,"(L:INIT,bool) !if{ 1 (>L:INIT,bool) 25 (>L:VARIABLE_A,number) }"I don't understand the reason behind having the L:INIT variable. What purpose is it serving prior to putting value 25 into L:VARIABLE_A? Would you walk me through your thinking, please.Glenn

Share this post


Link to post
Share on other sites
Guest Skymed

Let me see if I can get this right:The sim starts and looks at (L:INIT,bool) to see what it is reading ( a 1 or a zero) and you ask it to see if (L:INIT,bool) is equal to zero by adding !(L:INIT,bool) ! says Is (L:INIT,bool) 0 == , IF IT IS EQUAL TO ZERO if{Change its state to a 1 1 (>L:INIT,bool) so this sequence does not get repeated next time the gauge refreshes and also put 25 into a variable: 25 (>L:VARIABLE_A,number)So the gauge reads the state of L:init,bool, checks to see it is zero, id so changes it to a 1 and also puts 25 ( or your numbers) into a specified variable. It only does this when L:Init is zero, so will only do it the very first time the gauge is activated.I hope that makes sense?Steve

Share this post


Link to post
Share on other sites
Guest iagman

I think the light is slowly coming on.You use the bool variable value to prevent Variable A from being continously initialized each time the gauge is refreshed. Without it, I could never store another value into it, if needed, later in the program since that would be quickly overwritten by the initialization process that is taking place x-number of times per second. Without the bool var. check, the code is useless.Glenn

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