Jump to content
Sign in to follow this  
n4gix

XML Initialization

Recommended Posts

Hey guys, what is the XML equivalent to a C gauge's "case PANEL_SERVICE_PRE_DRAW:" section?There are some initial values I need to set during gauge loading and have them persist until changed manually.Also, am I correct in assuming that if you have multiple, successive "events" to trigger during a single mouse click that the preferred method is to use a @Macro?TIA!


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

Hi Bill,1.I don't know C-gauges so I can't comment on the PRE-DRAW.I'm not sure what you mean by "untill changed manually", but if you mean "untill a user action like mouseclicking something": just project this initialisation code with a bool variable, which is changed when the user action is performed.2.I don't understand your second point as well.Do you mean that the event should be repeated while the mousebutton is held ??The only thing a macro does, it helping you to prevent to write the same XML code multiple times (you can use a macro in a Click area).Or use "parameterised" macroes using the stack or other "transfer" variables.Rob

Share this post


Link to post
Share on other sites

>Hi Bill,>>1.>I don't know C-gauges so I can't comment on the PRE-DRAW.>I'm not sure what you mean by "untill changed manually", but>if you mean "untill a user action like mouseclicking>something": just project this initialisation code with a bool>variable, which is changed when the user action is performed.I'll try to make it simple. I have multiple "pages" of information to display, that must remain in their current order.The page I wish to display upon gauge load happens to be page 2, not page 1... ;)The "page number" variable is @g:currentPageNAV, and of course defaults to a value of 0. I need to set the value to 1 when the gauge is first loaded, so the correct page will display.I'm sure it's simply a syntax error, but this doesn't seem to be working as expected, based on observing the diagnostic string display: (L:DoOnce) 0 == if{ 1 (>g:currentPageNAV) 1 (>L:DoOnce) }>2.>I don't understand your second point as well.>Do you mean that the event should be repeated while the>mousebutton is held ??>The only thing a macro does, it helping you to prevent to>write the same XML code multiple times (you can use a macro in>a Click area).>Or use "parameterised" macroes using the stack or other>"transfer" variables.Nope, much simpler than either guess:if (mouseclicked) do this, and this, and this, and this too...


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
Guest dko60202

1. I asked the same question awhile back, and the suggestion I got (which works fine) is something along the lines of:(L:this_gauge_initialised, bool) ! if{ 1 (>L:this_gauge_initialised, bool) *your initialization code here*}You can set your L:var back to 0 to re-initialize.2. Macros aren't required; typically I use this: 1 (>K:event the first) 1 (>K:event the second)Do not cut and paste...I don't have my code with me; the syntax above is from memory, and my memory sucks, but you get the idea.Douglas

Share this post


Link to post
Share on other sites
Guest dko60202

>I'm sure it's simply a syntax error, but this doesn't seem to>be working as expected, based on observing the diagnostic>string display:>>> (L:DoOnce) 0 == if{ 1 (>g:currentPageNAV) 1 (>L:DoOnce) }>>Yup. Don't forget the ,bool (L:DoOnce, bool) 0 == if{ 1 (>g:currentPageNAV) 1 (>L:DoOnce, bool) }Douglas

Share this post


Link to post
Share on other sites

"Yup. Don't forget the ,bool"In the 1000+ hours I have spent in developping/debugging my XML gauges,forgetting the "units" in L:Vars is by far my #1-made error :-)Cheers, Rob

Share this post


Link to post
Share on other sites

>Yup. Don't forget the ,bool>>> (L:DoOnce, bool) 0 == if{ 1 (>g:currentPageNAV) 1>(>L:DoOnce, bool) }>Lord how I despise XML... ;) This is so trivial in C as to be laughable...It still will not work...The reported value of L:DoOnce never changes from 0...This is the precise code entered: (L:DoOnce, bool) 0 == if{ 1 (>g:currentPageNAV) 1 (>L:DoOnce, bool) } I suppose I *could" "cheat" and make the first page -1 so the "default page" 0 will display on panel load! ;)


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
Guest dko60202

Bill,I thought that G: vars had to be named G:var1 thru G:var9. Should currentPageNav be an L:var (with units, :) )?Another thought...I always put code that needs to get executed every cycle, inside a .... You might try that if you haven't.dko

Share this post


Link to post
Share on other sites

Bill, Please try this: (L:DoOnce, bool) 0 == if{ 1 (>g:currentPageNAV) 1 (>L:DoOnce, bool) } must come before Regards,Tom

Share this post


Link to post
Share on other sites

>Bill, >>Please try this:>>> > > (L:DoOnce, bool) 0 == if{ 1 (>g:currentPageNAV) 1> (>L:DoOnce, bool) }> > >>>> must come before Oddly enough, as I mentioned in another thread, L:variables just won't work at all in this gauge... I don't know why, but I had a couple of unused G:VarX's I could spare. There was also one small part missing to the puzzle, and that is that the g:currentPageNAV is a "macro," so it needed the @ prefix to work... ;)This works fine now: (G:Var8) 0 == if{ 1 (>@g:currentPageNAV) 1 (>G:Var8) }Thanks for all the help guys! ;)


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
Guest Karl R Pettersen

"Still will not work."I had similar problems in my Baron mod, and I actually had to wait a little for the initialization stuff to kick in. All default values are set during initialization. If not some of the values, but not all, would be omitted and completely forgotten, with no clues on what had happened.To me, the problem appears to be that after the plane is loaded, the default values from the default.flt flight file is still being loaded and prosessed, overwriting whatever values you set during init. Wait until the .flt is prosessed (2.5 seconds should be more than enough), then do your initializations as required.

Share this post


Link to post
Share on other sites

>"Still will not work."...>To me, the problem appears to be that after the plane is>loaded, the default values from the default.flt flight file is>still being loaded and prosessed, overwriting whatever values>you set during init. Wait until the .flt is prosessed (2.5>seconds should be more than enough), then do your>initializations as required.Thanks for the reply, Karl. I did solve the problem finally; it turned out (as usual) to be a self-inflicted wound. Having overcome my own incompetence on this issue , I'm now in the final stages of 'tweaking' the vector graphics to ensure that all the elements remain 'lined up' at as many of the weird resolutions simmers might use as possible, which is always a balancing act worthy of Seigfried & Roy...


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