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

How to connect L:vars and A:vars by XML Gauges?

Messages
66
Country
china
Hello, every one.
How can I to connect L:vars and A:vars by XML Gauges or XML files?
Like "L:TotalWeight,lbs" and "A:PAYLOAD STATION WEIGHT:1,pounds".
I mean, when L:vars changes, A:vars will change accordingly,two attributes of data are linked together.
Thanks!
 
A:variables are not "settable" at all directly. Some of them may be "set" via a SimConnect (C code) module, but not all of them.
 
A:variables are not "settable" at all directly. Some of them may be "set" via a SimConnect (C code) module, but not all of them.
Thank you for reply!
For I need to link these A: variables which are all be "settable", for example:"GENERAL ENG GENERATOR ACTIVE:index" "ELECTRICAL MASTER BATTERY".
 
I reference this:
<MouseClick id="MouseClick">
<Script>(L:Eng1_GeneratorSwitch,bool) ! (&gt;L:Eng1_GeneratorSwitch,bool)</Script>
<ClickType>LeftSingle+Wheel</ClickType>
</MouseClick>
and I write code like this:
<Update id="Update">
<Script>
(L:Battery1Switch,bool) 0 != if{ 1 (&gt;A:ELECTRICAL MASTER BATTERY,bool) } els{ 0 (&gt;A:ELECTRICAL MASTER BATTERY,bool) }
(L:Eng1_GeneratorSwitch,bool) 0 != if{ 1 (&gt;A:GENERAL ENG GENERATOR ACTIVE:1,bool) } els{ 0 (&gt;A:GENERAL ENG GENERATOR ACTIVE:1,bool) }
(L:Eng1_FuelCutOffSwitch,bool) 0 != if{ 1 (&gt;A:GENERAL ENG GENERATOR ACTIVE:2,bool) } els{ 0 (&gt;A:GENERAL ENG GENERATOR ACTIVE:2,bool) }

(A:EXIT OPEN:0,percent) 0 != if{ 1 (&gt;L:DoorOpen,bool) } els{ 0 (&gt;L:DoorOpen,bool) }
(A:EXIT OPEN:1,percent) 0 != if{ 1 (&gt;L:Door2Open,bool) } els{ 0 (&gt;L:Door2Open,bool) }
</Script>
</Update>
It is not work!
I write code like this:
(L:Battery1Switch,bool) (&gt;A:ELECTRICAL MASTER BATTERY,bool) }
(L:Eng1_GeneratorSwitch,bool) (&gt;A:GENERAL ENG GENERATOR ACTIVE:1,bool) }
(L:Eng1_FuelCutOffSwitch,bool) (&gt;A:GENERAL ENG GENERATOR ACTIVE:2,bool) }
It is still not work!
Is a "Settable" A:vars real "Settable" in xml gauges?
How to set a "Settable" A:vars in xml gauges?
 
A:variables are not "settable" at all directly. Some of them may be "set" via a SimConnect (C code) module, but not all of them.
I try to set a A:vars like :"execute_calculator_code(" 1 (>A:GENERAL ENG GENERATOR ACTIVE:3,bool)", NULL, NULL, NULL);", but it not work!
Is it need to use SimConnect_MapClientEventToSimEvent and SimConnect_TransmitClientEvent?
 
Yes. Creating a SimConnect client is the only way this may be done, and then only for those A:Vars that are specifically marked as "settable" in the SDK.
 
Did you read the documentation for XMLTools?
I have read the document for XMLTools, it used like this:
<Update/Value/etc>
(A:Turb Eng N1:1,percent) (>C:SIMVARS:Turb Eng N1:1,percent)
<Update/Value/etc>
But my aim is to do this:
<Update/Value/etc>
(C:SIMVARS:Turb Eng N1:1,percent) (>A:Turb Eng N1:1,percent)
<Update/Value/etc>

I found that this is not easy to achieve.
 
That's what XMLTools is doing for you. You write to C:SIMVARS:whatever, and XMLTools passes that on to the appropriate A:Var.
 
That's what XMLTools is doing for you. You write to C:SIMVARS:whatever, and XMLTools passes that on to the appropriate A:Var.
"XMLTools passes that on to the appropriate A:Var."
How to do that?
<Update/Value/etc>
(A:Turb Eng N1:1,percent) (>C:SIMVARS:Turb Eng N1:1,percent)
<Update/Value/etc>
C:SIMVARS:Variable_Name A:Variable_Name
Whether directly with the same "Variable_Name" I could achieve this goal?
 
If you are writing to C:SIMVARS:Turb Eng N1:1,percent, you are writing to the A var, which is exactly what you want to do. So use the C:SIMVARS: for writing and A: for reading.
 
For a quick example, with the engine off and parked on the ramp, send this command:
Code:
30 (>C:SIMVARS:Turb Eng N1:1,percent)
You should now see the needle for the Turb Eng N1:1 pointing to 30%...

...of course, that's pretty useless, but it illustrates the point being made; you are "setting" the A:variable to your own custom value.
 
For a quick example, with the engine off and parked on the ramp, send this command:
Code:
30 (>C:SIMVARS:Turb Eng N1:1,percent)
You should now see the needle for the Turb Eng N1:1 pointing to 30%...

...of course, that's pretty useless, but it illustrates the point being made; you are "setting" the A:variable to your own custom value.
I do this:
(L:Battery1Switch,bool) (>C:SIMVARS:ELECTRICAL MASTER BATTERY,bool)
"ELECTRICAL MASTER BATTERY" is a "A:VARS" : "A:ELECTRICAL MASTER BATTERY,bool".
It is still not work.
I use execute_calculator_code("(L:Battery1Switch,bool)" to read L:vars and use simconnect to write A:vars,and resolved it.
 
Last edited:
Back
Top