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

P3D v2 Logic Module

Messages
53
Country
us-hawaii
I am working on building my Gauge programming repertoire and I am beginning to move into advanced logic. With my software engineering background I have a pretty thorough understanding of OOP (albeit mostly in C#) and I have worked with SimConnect from external modules. My day job is flying C-130s for the Coast Guard so I want to combine this knowledge to create some better simulations.

The project I am currently working on is gutting the CaptainSim C-130 and bringing it up to snuff. Unfortunately the polygons in the cockpit limit me from putting in some of our updated avionics but I am adapting. I have successfully used the Cabin Comfort example to input custom variables from outside the sim but it seemed like a pretty bulky solution. That all being said I'll start with my question...

To interact with L:Vars in XML gauges do I need to instantiate the Aircraft class and all the other stuff in the Cabin Comfort example or can I define an L:Var in an XML gauge (A CDI Deflection for example) and then use a Logic module to drive it. That brings me to my next question, I have used the GDI+ example and understand it, as well as the recent C++ tutorial in here, however I was wondering if I can create a non-visible gauge that drives the systems logic for the aircraft (Do I just use the Transparent decleration?)

My final question is, if I can identify the name of the L:Vars (basically the ones in the ModelDef for things like electrical switches) in the CaptainSim C-130, can I remove all of the captainsim guages and use my own logic driven off those switch positions?


Thanks for all the help! I am constantly learning from all of you on here and truly think this place is a great resource.

-Matt
 
There is a wiki piece here on interacting with L:Vars from a C gauge or other in-process module. Have a look at that, it will answer most, if not all your questions.
You don't need to use GDI to create a non-visible gauge. Just create a conventional C gauge that has an RGB(0,0,0) static background and no other bitmaps. You can add a gauge callback function to put your logic in.
There is a gauge on my website that will list for you all of the L:Vars active in the current session.
You can get it directly: http://www.douglassdawson.ca/files/XML_VARS.ZIP
Add it on a separate panel window in your project and you can scroll through all the L:Vars, 20 at a time.
You can also have a go at the model with a hex editor - you should see most of the L:Var names.
 
To interact with L:Vars in XML gauges do I need to instantiate the Aircraft class and all the other stuff in the Cabin Comfort example or can I define an L:Var in an XML gauge (A CDI Deflection for example) and then use a Logic module to drive it. That brings me to my next question, I have used the GDI+ example and understand it, as well as the recent C++ tutorial in here, however I was wondering if I can create a non-visible gauge that drives the systems logic for the aircraft (Do I just use the Transparent decleration?)

No, you don't need to instantiate a class using the Cabin Comfort method. That one must make a reference to a Custom Var (C:CLASS:CustomVar,unit) within an XML/C++ gauge to trigger the instantiation.
Just a plain C++ gauge will work perfectly; you can read/write LVars using different functions (get(set)_named_variable_value; execute_calculator_code). And your C++ gauge needs at least one static macro (ie MAKE_STATIC ) defined otherwise it won't work.

My final question is, if I can identify the name of the L:Vars (basically the ones in the ModelDef for things like electrical switches) in the CaptainSim C-130, can I remove all of the captainsim guages and use my own logic driven off those switch positions?

Yes, absolutely.

Tom
 
There is a wiki piece here on interacting with L:Vars from a C gauge or other in-process module. Have a look at that, it will answer most, if not all your questions.
You don't need to use GDI to create a non-visible gauge. Just create a conventional C gauge that has an RGB(0,0,0) static background and no other bitmaps. You can add a gauge callback function to put your logic in.
There is a gauge on my website that will list for you all of the L:Vars active in the current session.
You can get it directly: http://www.douglassdawson.ca/files/XML_VARS.ZIP
Add it on a separate panel window in your project and you can scroll through all the L:Vars, 20 at a time.
You can also have a go at the model with a hex editor - you should see most of the L:Var names.


Hello, your xml_vars.gau works , May I know how do you get a list of L:Vars's string name?

I also use c gauge dll, but I do not know how to get the L:Vars's string name.
 
Hello, your xml_vars.gau works , May I know how do you get a list of L:Vars's string name?

I also use c gauge dll, but I do not know how to get the L:Vars's string name.

You can also try LocalVarLogger.xml gauge from XMLTools module. It returns the complete set of LVars defined in any aircraft, expressed in plain XML code.

And this SDK function is used to get any LVar's string name:

Code:
PCSTRINGZ get_name_of_named_variable( ID id );

Where id goes from 0 to n.
 
You can also try LocalVarLogger.xml gauge from XMLTools module. It returns the complete set of LVars defined in any aircraft, expressed in plain XML code.

And this SDK function is used to get any LVar's string name:

Code:
PCSTRINGZ get_name_of_named_variable( ID id );

Where id goes from 0 to n.
Thank you very much.
 
Back
Top