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

[Solved] Passing strings between gauges (XMLVars?)

Heretic

Resource contributor
Messages
6,830
Country
germany
I need to pass two different strings (filenames) between two XML gauges for processing in Logger.
Let's call them "File_A.txt" and "File_B.txt".

From what I've read, handling strings via L: vars is a PITA and macros aren't processed across XML gauges.

So I'm looking at XMLVars as a solution.

The code in gauge #1 contains the strings to be processed by XMLVars.

Code:
'File_A.txt' (>C:XMLVARS:StringValue1,string)
'File_B.txt' (>C:XMLVARS:StringValue2,string)

In gauge #2, the strings are then to be used for Logger's save/load capabilities.

Code:
(C:XMLVARS:StringValue2,string) (>C:LOGGER:openRead)
...
(C:XMLVARS:StringValue1,string) (>C:LOGGER:openRead)
...
...
(C:XMLVARS:StringValue1,string) (>C:LOGGER:openWrite)
...
(C:XMLVARS:StringValue2,string) (>C:LOGGER:openWrite)

The syntax examples in XMLTools.pdf are not quite clear on how to make this work for multiple strings and my example above doesn't work in FSX.

Any idea, Tom (or Robbie)?


(Cue thread marked solved and edit with a solution in 3...2...)




- Edit:

Called it!

Associate a variable with every string you want to save and then simply call the string from a macro. Let Logger process the result of said macro and everything will be fine and dandy.

Gauge #1:
Code:
'First File' (>C:XMLVARS:StoreVarName,string)
'File_A.txt' (>C:XMLVARS:StringValue,string)
'Second File' (>C:XMLVARS:StoreVarName,string)
'File_B.txt' (>C:XMLVARS:StringValue,string)

Gauge #2:
Code:
<Macro Name="A">'First File' (>C:XMLVARS:SearchVarName,string) (C:XMLVARS:StringValue,string)</Macro>
<!-- Pick a filename for the company's save file! -->
<Macro Name="B">'Second File' (>C:XMLVARS:SearchVarName,string) (C:XMLVARS:StringValue,string)</Macro>
...
...
...
@B (>C:LOGGER:openRead)
@A (>C:LOGGER:openRead)
...
@A (>C:LOGGER:openWrite)
@B (>C:LOGGER:openWrite)
 
Last edited:
I'm glad you solved it by yourself, saved me a lot of written explanations! :D

Tom
 
Back
Top