• 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 Problem updating XML variables

Messages
47
Country
belgium
Hi,

Recently I ran into an issue with FSX.

I use XML variables for many of my internal variables so they can communicate with the VC and external model.

I have about 100 of them and they all worked fine until recently when I started working directly with SimConnect for some other stuff, now some (not all) variables will not update or update only after several tries!

I use:

Code:
register_named_variable("MyVariable");

double ret = get_named_variable_value(check_named_variable("MyVariable"));

set_named_variable_value(check_named_variable("MyVariable"), 1.0);


To "create" the variable, read the current value and set a new value.

Is there a limit on the number of XML var's FSX can handle ? or nayone have other ideas what may be going on here ?

Björn
 
Is there a limit on the number of XML var's FSX can handle ? or nayone have other ideas what may be going on here ?

We had 102 named Vars for the MS F/A-18, so I don't think 100 would be too high. I guess that, if you were hitting a limit, the register_named_variable() would probably fail to return a new ID when called.

I never used the check_named_variable() function which, if called everytime you are reading a variable, might be not very efficent, since you force to do a lookup over a string table with hundreds names, when the only thing you need it's the ID of the variable, which is the same when the variable was registered.

So, I wrapped everything in a C++ class, call register_named_variable() in the class Constructor and save the ID in an internal member variable, then I use to "Accessor" member function, one to Get() the value and the other to Set() the value, that use the member ID, without having to call check_named_variable() every time.
 
Thx Umberto, yes the variables all get a valid ID number upon registration, so the problem must be located somewhere else then.

Saving the ID at registation is a good idea, I'll add that also !

Kind regards,
Björn
 
Back
Top