• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX About Macro

Messages
371
Country
france
Hello,

I am not sure to undestand properlly all about Macro, because I am an old boy with a old brain.

I would like to know if Macro are the same thing as a function, meaning that it return always a value ?

or

Can I use a Macro as "sub", that I call to avoid to have the same code at several place in my gauge ?

Exemple :
I have these 2 following lines four times in one of my gauge (overwrite FSX PLN files) :

Code:
(L:Seconds,number) 60 == if{ (L:Minutes,number) 1 + (>L:Minutes,number) 0.00 (>L:Seconds,number) }
(L:Minutes,number) 60 == if{ (L:Degrees,number) 1 + (>L:Degrees,number) 0 (>L:Minutes,number) }

Can I create 2 macros like this :

Code:
<Macro id="Macro" Name="Secondes">
    <MacroValue>(L:Seconds,number) 60 == if{ (L:Minutes,number) 1 + (>L:Minutes,number) 0.00 (>L:Seconds,number) }</MacroValue>
</Macro>
<Macro id="Macro" Name="Minutes">
    <MacroValue>(L:Minutes,number) 60 == if{ (L:Degrees,number) 1 + (>L:Degrees,number) 0 (>L:Minutes,number) }</MacroValue>
</Macro>

And use them by call @Secondes and @Minutes, without a return value required.
I am right or not ?


Edit : I tested with this code, but as the chance to have a waypoint with a 60' value or a 60' value is small, I don't know if the macro synthax works when I overwrite my flight plan.

So, if someone can confirm to me that my macro using is ok....

Thanks

Francois
 
Last edited:
Can I use a Macro as "sub", that I call to avoid to have the same code at several place in my gauge ?

That's basically the main purpose of a macro. Whatever code you define in the macro is simply put to the place in your gauge where you call the macro.

Code:
<Macro Name="h">(A:PLANE HEADING DEGREES TRUE,radians)</Macro>

<Update>

@h (>L:test,number)

</Update>

...would be just the same like...

Code:
<Update>

(A:PLANE HEADING DEGREES TRUE,radians) (>L:test,number)

</Update>

This way macros save you a lot of time if you have a lot of repetitive code, like in your autopilot gauges.

(My example is in FS9 syntax, but I think you get the point ;) The principle should be the same in FSX scheme..)


Hope this is of any help.
 
Back
Top