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.

XML Initialization

Featured Replies

  • Moderator

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

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

  • Author
  • Moderator

>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

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

>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

"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

  • Author
  • Moderator

>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

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

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

  • Author
  • Moderator

>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

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

  • Author
  • Moderator

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

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.