• 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 C: Vars and how to set it up

cheangjc

Resource contributor
Messages
111
Country
singapore
Hi,

I am currently playing with C++, learning to get to grips with internal C++ to XML Var interaction.

I have successfully read/write L: Vars, but am now looking to see how to let a XML gauge read a C: Var.

(C:MyGauge:Varname,unit) is the syntax from what I understand.

However, I do not know what Mygauge is; Is it the GAUGE_NAME as declared or is it the file name?

Also, How do I set up a C: Var in the C++ gauge, do I have to register with the panel service or something similar to L:Var?

Thanks in advance for any help given :)
 
You can't read C++ .gau/dll vars from an XML gauge.
I see you are confusing C: vars ("Custom") which are XML-type vars managed from a dll module (not gauge). in your (C:MyGauge:Varname,unit), what you call MyGauge is in fact the name of a C++ class.
I suggest you check the Panel and GaugesSDK, Mixed Mode folder, Cabin_Comfort example.
And to read a C:Var type in a C++ gauge you're right, first need to register it. Also is a bit more tricky than in XML.

Tom
 
XML cannot "read" C variables at all.

You need to pass the value of any C variable to an XML L:var...

In the PRE_UPDATE case:
Code:
xml_SND1_id = check_named_variable ( "XMLSND1" ) ;
xml_SND1 = get_named_variable_value (xml_SND1_id);

To pass any changes from the C variable to the XML L:var use the set_ construct:
Code:
set_named_variable_value(xml_SND1_id, xml_SND1) ;
 
Mmmmm. Looks like I have indeed misunderstood that C: Vars can be used in gauges. I basically needed that for String Vars, but I will have to figure an alternative.

Thanks for both of your inputs.
 
But of course C:Vars can be read/written in .gau/dll gauges.

From your statement I understand you need to read XML string vars (like XMLVars or fs9gps) within C++ gauges. Or maybe others?

If you post some details I can give you an example for both.

Tom
 
But of course C:Vars can be read/written in .gau/dll gauges.

From your statement I understand you need to read XML string vars (like XMLVars or fs9gps) within C++ gauges. Or maybe others?

If you post some details I can give you an example for both.

Tom

Hi,

It can? Well, I just tried the Cabin Comfort Code into the a dll gauge and there was no output: (blank or 0)

I would appreciate the example for the C: var in a dll gauge.
 
This is an example on how to retrieve GPS C: variables.

http://www.fsdeveloper.com/forum/showpost.php?p=378156&postcount=10

For another Custom class, ie XMLVARS, you must replace "fs9gps" in the register_callback functions with "XMLVars".

Bear in mind that if you want to share those C: vars with XML gauges, you'll need to define the source C++ variables in the dll module (like Cabin_comfort.dll) as PUBLIC, and manage the code to handle the exchange process properly.

Tom
 
Back
Top