Sign in to follow this  
rcbarend

XML initialization code

Recommended Posts

My XML Question of the Day: Is it possible to have XML code that gets executed just once, at gauge (or panel) load time? That is, without setting my own flag and testing it every frame...

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

No, not possible.But the trick to protect it with a flag works perfect.Don't be worried about performance... The schedule overhead of a gauge that should run only once (but now is scheduled everytime) is not noticeable.But if you are still worried about (if you have an extremely complex panel, with lots of gauges containing such code): Make one gauge that does this initialisation (using L:vars), and let this run with UpdateFrequency 1 (1 schedule per second).But again, it's not worth the effort IMO.Cheers, Rob Barendregt

Share this post


Link to post
Share on other sites

If I understand you correctly, yes it is possible. I have a number of gauges where default values are set on panel load, and do this just once. If you say(G:Var1) if equals zero then set, say, your variable (click or L type)and in the same statement set (G:Var1) to 1, and the variable setting will not be repeated.Nick.

Share this post


Link to post
Share on other sites

Thanks Nick. I believe this is the solution Rob recommended as well.

Share this post


Link to post
Share on other sites

>Thanks Nick. I believe this is the solution Rob recommended>as well.Yes.Which was (I assume) you already suggested yourself in your original post :-)Cheers, Rob

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