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.

Storing a variable

Featured Replies

Gurus, Bill and all, you guys are an invaluable resource. My next question: I used the construct: (L:First, enum) (L:Second, enum) 2 * + ...etc... And it's working just fine. But as my gauge gets bigger, I'm realizing that I need to re-use that first RPN evaluation statement again and again. It makes sense to me to store it in an L:Var, for repeated use and to simplify later calculations, but I'm getting stuck. This doesn't work: (L:First, enum) (L:Second, enum) 2 * + (>L:Result)Basically, L:Result stays zero. What's the best way to go about it? Thanks.---Will

I can try this one but you want to let Tom, Jan, Bill, Jon (or someone else who knows for sure!) double check this:I'd try:<Macro Name="TheMacro"> @1 @2 2 * + </Macro>The @1 and @2 are place holders for arguments to be passed in, just like a function.Then call it with:<Value> @TheMacro((L:First, enum),(L:Second, enum)) </Value>To set the result into an L:Var, simply use:@TheMacro((L:First, enum),(L:Second, enum)) (>L:Result,enum)A nice thing about macros is that they don't have to be inside of elements or value tags in order to do the behind the scenes manipulations.I am a macro newbie myself... get a second opinion on this and I'm sure that there are many points I'm missing too. But, as far as I know, that example should meet your needs.Scott / Vorlin

Errff, macros are scary, but that's how we learn, right? Thanks Scott. Any other takers?---Will

Well, I have the macro up and running. Works great. Thanks again, Scott.---Will

  • Author

Maybe for your understanding.The reason why your original assignment didn't work is that you omitted the unit in (>L:Result). Probably the most common mistake in XML coding (at least for me :-) )About macros vs. "saved" calculations:Both methods are valid and have their pro's and con's, and it's not always that trivial which one to choose.But realise that there IS a big difference.In your first line, (L:Result,enum) gets a value assigned ONCE, which is fixed through the subsequent code. Even if L:First and L:Second are changed later on in the code.If you use the macro form: the value of L:Result is caculated EACH time at the moment you call the macro in the code, and uses the values of L:First and L:Second at the moment of calling.So realise this difference.Also, you may pay a performance penalty in the gauge, because the macro calculation is done at each time you call it in the code (which could cause a fps hit for very complex macros). Not really an issue, it's just so you know :-)Cheers, Rob Barendregt

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.