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

FS2004 Attempting to use XMLVars... (Solved)

Messages
261
Country
ireland
Hi,

I can get around XML a wee bit and have developed gauges using it - but the l0, sp1, s0 etc commands really intimidate me and break me out in a cold sweat.

I have a Bendix-King radio in my FS2004 Cessna. I want to make it a bit more realistic and store frequencies as they can in real life.

I wanted to use XMLVars for the purpose.

The manual and example XML supplied with XMLVars are way above my head - though I have gone through both in search of the answer. (Taguilo did say that it wasn't easy!)

I have the XMLVars9.dll file in my Modules folder.

I have the macros in my radios.xml gauge.

The frequency required to be stored is in (L:Rad1Freq,Mhz).

The unidimensional array in which I want to put it is Radios1.

The slot number in which I want it to go is held in (L:Com1Stor, number).

So I thought that (L:Rad1Freq,Mhz) @NSA('>Radios1',(L:Com1Stor, number)) might work. No!

Or that (L:Rad1Freq,Mhz) @Va1('>Radios1',number,(L:Com1Stor, number)) might work. No!

I have stored the frequency using (L:Rad1Freq,Mhz) @NSA('>Radios1',2) and retrieved it using
@NLA('Radios1',2), so I know the thing works fine.

I was also successful storing it with (L:Rad1Freq,Mhz) @Va1('>Radios1',number,2) .

I suppose the big and basic question is - how do I bring the value of (L:Com1Stor, number) into the macros?

I might even use bidimensional arrays if I can master these basics! :)

Thanks

Walter
 
Hi Walter,

It's a bit hard to know for sure what you want to do, but as powerful as XMLVars is (and I am a huge fan of Tom Aguilo's incredible XMLVars module), I don't necessarily see the need for XMLVars to do what you want.

You might want to take a look at the bottom entries in this wiki (Alternatively, let FS handle the Units conversion). It will show you a simple way to store radio frequencies in L:Vars with no macros needed.

If I was working on a Bendix-King radio for my Cessna and wanted the ability to store frequencies, I might just stick to plain vanilla L:Vars. OTOH, XMLVars can be used to construct an "array" of frequencies which can simplify the work as long as you are comfortable with XMLVars ... which really don't cause cold sweats after you get just a little familiar with them.

Why don't you post a little code and let people offer suggestions?

Rgds,

Bob
 
Hi Walter,

The solution is as simple as:

(L:Rad1Freq,Mhz) @Va1('>Radios1',number,(L:Com1Stor, number) int)

Remember LVars are of type float (double) so you must convert them to integers before being able to use them as array index positions.

Tom
 
Bob,

in real life the user of the radio can store his/her 32 favourite frequencies or the frequencies used on this trip. These can be retrieved then at will.

Changing from Mhz to number and vice versa should not be a problem - I have already been helped on this forum with that.

If I use bog-standard XML, I would have to name 32 L Variables to hold the individual stored frequencies for each of the two radios.

I would have to have 32 IF statements to put the frequencies from the standby frequency desired in to correct one of the 32 variables, based on the value in (L:Com1Stor, number), for each of the two radios.

I would have to have 32 more IF statements to retrieve the stored frequency and put it into the standby area, again based on the value in (L:Com1Stor, number), for each of the two radios.

Using XMLVars I hope to have 2 calls to the Va1 macro for each radio using the value in (L:Com1Stor, number) - one to store the frequency and the other to retrieve the frequency.

And now that Tom has provided me with the 'simple' solution (which works beautifully! Thanks Tom) I will attempt to achieve this in my radio gauge.

Thanks
 
Hi,

just to end the story...

The storage and retrieval of frequencies into and from the XMLVars arrays proved to be the easiest bit of the task.

Multi-function switches and knobs make life very difficult :(

Multipurpose displays complicate things even more.... :(:(

2 radios double the task...

But the job is done :D.

Radios work now as per the manual.

2 calls of macro Va1 to store the frequencies and 2 to retrieve is all it took - I will be looking for other applications for XMLVars now :) - thanks Tom, nice work.

I just hope that the coding inside the real Bendix-King in no way resembles the coding in my virtual one - spaghetti junction!

Thanks

Walter
 
Had to glance at your country flag there. It's years since I've heard the term spaghetti junction.
Are the police still finding lost souls who have been driving around it for years?
 
Many countries seem to have adopted the "spaghetti principle" for various roadways. For example, just to the northeast of Bergen, Norway there is a complex of "spaghetti tunnels", some of the junctions in the U.K. are really spaghetti like, as are the tunnels under Oslo proper.

Some of the junctions in Houston, Texas and Chicago, Illinois resemble spaghetti as well!
 
Back
Top