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

A module for handling XML vars

taguilo

Resource contributor
Messages
1,585
Country
argentina
Hi,

This past weekend I swept the dust from some old C++ code I have used to build custom DLLs; found interesting snippets from which to make a rebuilt and the result is XMLVARS.DLL. This small but powerful module enables de use of custom variables -kind of LVars- for storing and retrieving data across the entire gaugeset of an aircraft panel. Like Lvars, this variables can have any name, can hold numeric values of any kind and, unlike LVars, can also handle string values. Besides, they can handle *standard* multidimension array-style manipulation of data, a powerful tool that is not possible to work with through the native LVarset unless a complex group of macros is suited for the task.

XMLVARS supports storing and retrieving a total of 1024 different variables, with names up to 64 char, numeric values of type FLOAT64 and string values up to 128 char.It can minimize the use of repetitive code in complex gauges like FMS, Navigation Display, TCAS and similar as one of its strongest point is the ability to maintain variable values across the different gauges, like Lvars do (and most gpsvars don't). However, unlike LVars, those values still remain even after an aircraft reload, aircraft change or flight reset; something that could be useful for debugging purposes. In this case, making a RELOAD_USER_AIRCRAFT in FSX equals to make RELOAD_PANELS in FS9 (a powerful event for developers that was lost in FSX).

XMLVARS was tested in FSX under Windows Vista and Windows 7 64 bits. Despite it uses the FSX version of gauges.h, should work fine in FS9 as the base class is defined the same in both headers.

Instructions on how to install and some XML examples are included in the dowloadable zip:

* Updated, see:

http://www.fsdeveloper.com/forum/showthread.php?t=207518


Comments and suggestions are always welcomed!.

Tom
 
Last edited:
Comments and suggestions are always welcomed!.

Hi Tom,

I'm anxious to try this. Thanks! The Flight Sim developer community - especially, the XML types like me, are getting a lot of new tools and new ways to be creative! Very fun.

Regards,

Bob
 
Hi,
while maybe a little bit too advanced for my limited grasp of XML, i do thank you for the effort!

This might certainly be of use sometime in the future. FSX is going to be around for a while, so it is a good thing that development of things like this takes place. This way we can lift FSX and the aircraft we create to the next level!!

Thank you.

grt
Willem
 
Need to think about array use

Hi Tom,

I've d/l XMLVars and read the pdf, but not yet installed into FS9 or FSX ... will get to that over the weekend. The Readme, by the way, is clear and thorough. Very well written.

I understand your points and see immediate use in the gps area: strings and var sharing across different gauges that use gps.dll.

I need to think more about array manipulation, however, as I have never tried this in my gauges to date. Can you provide an example of a situation where this is used? That will jump-start my learning.

In the last few months, you, Doug, and Robbie have certainly given the XML community some big vitamins!

Thanks again,

Bob
 
Sounds very useful for making complex gauges like an FMC and the code will
be miles shorter. What do you use to export C++ ?
 
Hi Tom,

I've d/l XMLVars and read the pdf, but not yet installed into FS9 or FSX ... will get to that over the weekend. The Readme, by the way, is clear and thorough. Very well written.

I understand your points and see immediate use in the gps area: strings and var sharing across different gauges that use gps.dll.

I need to think more about array manipulation, however, as I have never tried this in my gauges to date. Can you provide an example of a situation where this is used? That will jump-start my learning.

In the last few months, you, Doug, and Robbie have certainly given the XML community some big vitamins!

Thanks again,

Bob

Hi Bob,
Thanks again:). Soon I will post an example on how to take advantage of manipulating data through array variables. Unfortunately, it seems I've lost a couple of XML gauges that were part of my FMS project, grounded for so long, in where I used that concept extensively. So I'm going to write some code starting from what I can still remember since the old times:D

Regards,

Tom
 
Last edited:
Hi,
while maybe a little bit too advanced for my limited grasp of XML, i do thank you for the effort!

Hi Willem, I can tell you the implementation can't be more simple if you use the universal macros as the primary input/output.

Being more specific, if you can write

nnnnValue (>L:MyLocalVar, number)

as a standard var assignment, you should be able to write

nnnnValue @V('>MyLocalVar', number)

instead when using the module. The only requeriment is that you copy
<Macro Name="V">...</Macro>
from the example XML and put it on top of the gauges where you plan to use it. Like when coding gps gauges you would place <Macro Name="c">..</Macro> on top as well.


Tom
 
Sounds very useful for making complex gauges like an FMC and the code will
be miles shorter. What do you use to export C++ ?

The module is an adaptation of the Cabin_Confort example, using the same classes but with different constants and custom functions, that all.

Tom
 
I need to think more about array manipulation, however, as I have never tried this in my gauges to date. Can you provide an example of a situation where this is used?

Best example i can think of is the steerpoint storage system i used in the Milviz F-15E that Larry Zambrano made for Milviz.

Basically, arrays allow you to access multiple variables under one "index" variable. For example in the F-15E i had 3 variables that could be accessed under the 99 steerpoints I had available.

latitude
longitude
steerpoint ID (id number, offset id number(if applicable), route id (A, B, or C)

if i sent a 5 to the LIST point 5 it would return the lat and lon values in 2 C vars of that steerpoint along with its associated ID in a 3rd variable. So basically arrays are a indexing system that allow you to get/store the same type of variable over a wide range without creating a million different vars and then interfacing them with a horrible mess of ifs/elses/cases.
 
Testing XMLVars in FS9 (FS9.1) without success

Hi Tom,

I am testing XMLVars in FS9. XMLVars.dll was copied to the Modules folder and the following XML added to a gauge:

Code:
<Element Name="XMLVars NUMBER READBACK">	
   <Position X="40" Y="35"/>				
   <FormattedText X="150" Y="30" Font="Courier New" FontSize="8" LineSpacing="13" Color="gray" Bright="Yes" >
	  <String>%((L:XMLVarsNumber1,number))%!7.3f!</String>
   </FormattedText>
</Element>	

[FONT="Arial"]and in the Mouse section where a click area does the following:[/FONT]

<Area Left="5" Top="30" Width="15" Height="15">
   <Cursor Type="Hand" /> 
      <Click>					
         'FS9_NUMBER_TEST1' (>C:XMLVars:StoreVarName,string)
         'FS9_NUMBER_TEST2' (>C:XMLVars:StoreVarName,string)						
         'FS9_NUMBER_TEST1' (>C:XMLVars:SearchVarName,string)
         (A:NAV1 ACTIVE FREQUENCY, mhz) (>C:XMLVars:NumberValue,number)	
         (C:XMLVars:NumberValue,number) (>L:XMLVarsNumber1,number)
      </Click>
</Area>

I intended the mouse click to:

1) establish two XMLVar variables, FS9_NUMBER_TEST1 and TEST2,
2) then set the index pointer back to the first variable using 'FS9_NUMBER_TEST1' (>C:XMLVars:SearchVarName,string)
I believe 'FS9_NUMBER_TEST1' (>C:XMLVars:StoreVarName,string) should accomplish the same thing in this case?
3) store the A:Var number (A:NAV1 ACTIVE FREQUENCY, mhz) into the first XMLVar
4) and, finally, read the value of that XMLVar and store it into (L:XMLVarsNumber1,number)

The <Element> should display the Nav1 frequency number, but I just get zero.

I went through an analogous sequence to store and read-back a string value, (A:NAV1 IDENT, string), also with no success

Suggestions?

Bob

FS9.1 running in WinXP x32 SP3
 
Hi Bob,

Your code seems to be ok. Maybe the module doesn't work in FS9, I can't test it because I don't have FS9 installed. However, you could try using C:XMLVARS:, in caps, like is defined in the class. Meanwhile, I'm going to finish a good example on how to use arrays of vars to display a CAS (Crew Alert System).

Tom
 
Tom, all caps is how I set it up initially, and no success that way either. Bob
 
Back
Top