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

D

Deleted member 1281

Guest
What do you want to do? Turn the battery ON/OFF? Nothing easier:

Code:
(>K:TOGGLE_MASTER_BATTERY)

You want to know if it is turned on? Readout the value of

Code:
(A:ELECTRICAL MASTER BATTERY, bool)

You want the current voltage? Readout

Code:
(A:Electrical battery voltage, volts)

You want to toggle battery on only after checking if it's OFF:

Code:
(A:ELECTRICAL MASTER BATTERY, bool) ! if{ (>K:TOGGLE_MASTER_BATTERY) }

Etc etc.

This is the way we all had to do it before XMLTOOLS came along.

Now read the SDK for a list of K:vars, A:vars, units, operators, and reverse Polish syntax, and the world your oyster is, bool ! (joke)
 
Messages
66
Country
china
What do you want to do? Turn the battery ON/OFF? Nothing easier:

Code:
(>K:TOGGLE_MASTER_BATTERY)

You want to know if it is turned on? Readout the value of

Code:
(A:ELECTRICAL MASTER BATTERY, bool)

You want the current voltage? Readout

Code:
(A:Electrical battery voltage, volts)

You want to toggle battery on only after checking if it's OFF:

Code:
(A:ELECTRICAL MASTER BATTERY, bool) ! if{ (>K:TOGGLE_MASTER_BATTERY) }

Etc etc.

This is the way we all had to do it before XMLTOOLS came along.

Now read the SDK for a list of K:vars, A:vars, units, operators, and reverse Polish syntax, and the world your oyster is, bool ! (joke)
Thank you!
I want to readout the value of
Code:
(L:Battery1Switch,bool)
and write that value to
Code:
(A:ELECTRICAL MASTER BATTERY, bool)

like this (L:Battery1Switch,bool) (>A:ELECTRICAL MASTER BATTERY, bool)
 
D

Deleted member 1281

Guest
"Like this" you can't do it, it would mean trying to write to a read-only variable. Only XMLTOOLS, a special addon, makes that possible, using a special notation (see previous posts). However, in standard FSX XML your problem is handled easily, too.

Your custom variable (L:Battery1Switch, bool) is either true or false. (A:ELECTRICAL MASTER BATTERY, bool) is also true or false. If you want the battery state to follow your L_variable then the following code would do it:
Code:
(L:Battery1Switch, bool) (A:ELECTRICAL MASTER BATTERY, bool) == if{ quit }
(>K:TOGGLE_MASTER_BATTERY)
To explain:
Line 1 tests if both values are the same already, and if so nothing needs to be done, otherwise
Line2 toggles master battery so that both (L:Battery1Switch, bool) and (A:ELECTRICAL MASTER BATTERY, bool) become identical. (Supposing that is the action you want to take place.)

And in proper handholding fashion here is the complete mouse click section, too:
Code:
<!-- Set Battery according to (L:Battery1Switch, bool)  -->
<Area  Left="xxx"  Top="yyy"  Width="xx"  Height="yy">
  <Cursor Type="Hand"/>
  <Tooltip>Battery Switch</Tooltip>
  <Click>
      (L:Battery1Switch, bool) (A:ELECTRICAL MASTER BATTERY, bool) == if{ quit }
      (>K:TOGGLE_MASTER_BATTERY)
  </Click>
</Area>
In the final analysis you need to RTFM, see my previous post.
 
Last edited by a moderator:
Messages
66
Country
china
"Like this" you can't do it, it would mean trying to write to a read-only variable. Only the XMLTOOLS, a special addon, makes that possible, using a special notation (see previous posts). However, in standard FSX XML your problem is handled easily.

Your custom variable (L:Battery1Switch, bool) is either true or false. (A:ELECTRICAL MASTER BATTERY, bool) is also true or false. You want them to have identical values? Then toggle the battery OFF when (L:Battery1Switch, bool) is false, and on, when true.

Hence, in a gauge's mouseclick section write
Code:
(L:Battery1Switch, bool) (A:ELECTRICAL MASTER BATTERY, bool) == quit
(>K:TOGGLE_MASTER_BATTERY)
To explain:
Line 1 tests if both values are the same already, and if so nothing needs to be done, otherwise
Line2 toggles master battery so that both (L:Battery1Switch, bool) and (A:ELECTRICAL MASTER BATTERY, bool) become identical. (Supposing that is the action you want to take place.)

And in proper handholding fashion here is the complete mouse click section, too:
Code:
<!-- Set Battery according to (L:Battery1Switch, bool)  -->
<Area  Left="xxx"  Top="yyy"  Width="xx"  Height="yy">
  <Cursor Type="Hand"/>
  <Tooltip>Battery Switch</Tooltip>
  <Click>
      (L:Battery1Switch, bool) (A:ELECTRICAL MASTER BATTERY, bool) == quit
      (>K:TOGGLE_MASTER_BATTERY)
  </Click>
</Area>
In the final analysis you need to RTFM, see my previous post.
HAHA:D,I I really need to RTFM first!
Thank you!
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
HAHA:D,I I really need to RTFM first!
Thank you!
In the SDK you will find two lists; one for "read variables" and another for "commands".

For every "read variable" (A:SomeVariable,unit) there is usually at least one "command" (>K:SomeCommand)...

Some "read variables" have multiple "commands" that are used for increasing/decreasing the value, or "setting" a specific value, and so forth.

NOTA BENE: I highlighted the red characters to emphasize that the ">" in the command is an absolutely required symbol. "K:" by itself is meaningless. The symbol ">" in this case can be though of as a "gozinta" (goes into) symbol, since the purpose is to take whatever proceeds the "command" and put it into whatever the "command's corresponding (A:variable) is.
 
Last edited:
Top