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

Confused about macros.

Messages
35
Country
sweden
I try to learn and understand macros in XML-gauges.
I found a macro like this:
<Macro Name="ReadKB">
@Read4(@1_4, @1_3_4, 21 >>)
@Read4(@1_3, @1_2_4, 21 >>)
@Read4(@1_2, @1_1_4, 21 >>)
@Read4(@1_1, M:Key)
</Macro>
I see it is a macro containing other macros. But what is macro @1_4, @1_3_4. Have searched but not found any explanation. I do think it has with variables to the macro to do.
Can someone tell me?
 
What gauge is this from?

You should also use [code][/code] tags for gauge code in the future because the forum software will make it more legible.
 
Last edited:
Those macros use other macros as parameters.

For example:

@Read4(@1_4, @1_3_4, 21 >>)

There should be at least two other macros:

<Macro Name="1_4">Etc1 </Macro>
<Macro Name="1_3_4">Etc2 </Macro>

and the calling one:

<Macro Name="Read4"> Do something with @1 do something with @2 do something with @3 </Macro>

So the parser translates all this mess to

Do Something with Etc1 do something with Etc2 do something with 21 >>

Tom
 
Macro is from Blackbox3. Blackbox3 create a gauge for storing parameters in a .csv file. I think macros are for enter a filename in the gauage.

I can't find any macro like this in the gauge:
<Macro Name="1_4">Etc1 </Macro>
<Macro Name="1_3_4">Etc2 </Macro>

What is a macro like @1?
Has i to do with transfering parameters to the macro?
 
I can't find any macro like this in the gauge:
<Macro Name="1_4">Etc1 </Macro>
<Macro Name="1_3_4">Etc2 </Macro>

Ok, then @1_4 and @1_3_4 are not macros but instead @1 is a received parameter, probably part of a variable name, and "_4"/"_3_4" are other parts of a variable name added to the passing parameters.

Must be something like:

<Macro Name="ReadKB">
@Read4(@1_4, @1_3_4, 21 >>)
...
</Macro>

<Macro Name="Read4"> Do something with @1 do something with @2 do something with @3 </Macro>

And the calling:

@ReadKB(Etc1)

Parser translation:

Do Something with Etc1_4 do something with Etc1_3_4 do something with 21 >>

As you see, macros can become into complex structures, so it is important to take some time trying to understand how those works.
Finally they are not difficult to manage at all, once you get the point.

Tom
 
Tom addressed your basic question, but, if you are interested, this offers a little background on what those particular macros do:

They are from a string storage script that Robbie McElrath wrote. A gauge provided in the Blackbox3 download uses those macros to store the file name of a LOGGER flight recording*. The macros allow the user to store strings up to 64 characters long in an "L:Var" without the use of a module like XMLTOOLS - XMLVARS. Description of the macros can be found in the Storing Strings wiki and in the GPS Module Guidebook v.2.0 (pages 213-216).

Behind the scenes, the macros actually construct sixteen L:Vars containing 4 ascii characters each by utilizing the ascii hexadecimal value of each character together with XML's built in Bit Operators (>>, <<, |, &) to keep track of the order.

The user chooses an arbitrary variable name which is attached to the 16 L:Vars as a prefix, uniquely labeling them (name_[1-4]_[1-4]). The 16 building block L:Vars are never shown individually, and just one L:Var name (prefix) is entered. Therefore, to the user, the appearance is that a single L:Var holds a string up to 64 characters long.

To someone of my level, those macros are very hard to follow, so I'd say they aren't a good place to start learning about macro use in XML.

Bob

* now that LOGGER is bundled with XMLTOOLS, there shouldn't be much need for those macros, but they are still available for the odd application where the user needs to store strings but does not install XMLTOOLS.
 
Last edited:
Thank's all for the answers. I have got a better understanding of this type of macros and will read the document proposed.
 
Back
Top