Sign in to follow this  
taguilo

Macros for reusing Objects?

Recommended Posts

Hi,I'm making a gauge with 20 functions that use each use one of 3 functions that look like this: 0.000True1.000True2.000True... 20.000TrueThe only variables are the expression to be evaluated, the divisor of that expression (in this example 5.55), the number of cases to be evaluated (20, 10, and 8 respectively), and the filenames of the bitmaps, which vary only in the first character (L, S, and V respectively).Rather than having to maintain 20 different Select Objects, is it possible to create 3 macros to be used in each of the 20 functions in the gauge, passing them a string containing the above variables?I can figure out how to use a macro in an expression, but I can't figure out how to call a macro as an objecti.e. instead of (all the stuff in the middle goes here)Use:<@selectLargeGauge(expression,divisor,21,"L")/>Thomas[a href=http://www.flyingscool.com] http://www.flyingscool.com/images/Signature.jpg [/a]I like using VC's :-)N15802 KASH '73 Piper Cherokee Challenger 180

Share this post


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

>>Rather than having to maintain 20 different Select Objects, is>it possible to create 3 macros to be used in each of the 20>functions in the gauge, passing them a string containing the>above variables?>>I can figure out how to use a macro in an expression, but I>can't figure out how to call a macro as an object>>i.e. instead of >> (all the stuff in the middle goes here)>>>Use:>><@selectLargeGauge(expression,divisor,21,"L")/>>>Thomas>You can't call a macro as an object like you want. Macros are literal replacement of text and are only supported inside scripting areas. In your example, you must use 20 different structures to hold each of the 20 different bitmaps needed to represent the increase in RPM. Versus only one bmp (or at least two) that uses only one (or at least two) command(s)... :-roll Tom

Share this post


Link to post
Share on other sites

Thanks, I was afraid of that. I assume I'd have to use C to implement subroutines.Yep, I'll be trying that method, too. But I've got to figure out the angles and how to change the size of the mask image as the area getting masked gets smaller. I understand what you mean in using two rotating images, but, eventually, the mask area is significantly smaller than the bar area. Maybe I could use 3 images, 1 image for the bars and two mask images that eventually overlay each other. In other words, each is only 115 degrees of a pie, but next to each other they cover 230 degrees. I can think of several combinations of this, but I'll have to work out the details. But what I don't want is for the bars to look like they are rotating. Each bar should just appear and disappear.Plus, I'd like to compare the two (three) programming methods to see which is smoother.This is really an exercise to learn as much as I can about gauge programming. It's a very simple gauge I know for somebody who knows what they are doing, but I am starting from scratch. And the documentation is rather lacking for doing that. For instance, when I taught myself fortran, the manual I had explained every command and every part of every command and how all the syntax worked (which was pretty simple compared to this). Here, there's no explanation about what needs parentheses where, etc.. At least that's my impression so far. As I write more and practice, I understand it better.Thomas[a href=http://www.flyingscool.com] http://www.flyingscool.com/images/Signature.jpg [/a]I like using VC's :-)N15802 KASH '73 Piper Cherokee Challenger 180

Share this post


Link to post
Share on other sites

>Maybe I>could use 3 images, 1 image for the bars and two mask images>that eventually overlay each other. In other words, each is>only 115 degrees of a pie, but next to each other they cover>230 degrees. I can think of several combinations of this, but>I'll have to work out the details. >Yes, that's almost the way to do that. >But what I don't want is for the bars to look like they are>rotating. Each bar should just appear and disappear.>The optical effect is such that it appears a new bar is added instead.>Plus, I'd like to compare the two (three) programming methods>to see which is smoother.>Certainly you need to calculate the exact amount of rotation to make it turn into a smooth change.>This is really an exercise to learn as much as I can about>gauge programming. It's a very simple gauge I know for>somebody who knows what they are doing, but I am starting from>scratch. And the documentation is rather lacking for doing>that. For instance, when I taught myself fortran, the manual>I had explained every command and every part of every command>and how all the syntax worked (which was pretty simple>compared to this). Here, there's no explanation about what>needs parentheses where, etc.. At least that's my impression>so far. As I write more and practice, I understand it>better.>Well, the SDK (ALL versions, even FSX one) is good for knowing supported structures, commands and operators but not for learning on how to use them. If you are looking for an "extra" tutorial that will tell you the "secrets" of XML, just search this forum; quite a lot of answers are already posted here. Tom

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