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

G:Vars again

Messages
160
Thanks to all a while ago I got a grip on how G:Vars work.

I have a few follow up questions if that's OK.

1) Can I have a G:Var in one part block of code 'sent' values from another part block of code?
I.E.
If conditions for one animated part are right then do something in that block of code but set the value of a G:Var in another block of code for a separate part.
Hope that makes sense!

2) Assuming the above is OK, can I do multiple assigns...
I.E.
(A:VELOCITY BODY Z,knots) 25 < if{ 0 (>G:Var2) 0 (>G:Var3) 0 } els{ do something else }
So if 'speed' is 25kts or less then change the value G:Var2 (in this parts code) and G:Var3 (for another parts code) to 0 and return 0.

3) case operator syntax - 3 possible values
100 50 0 3 (G:Var3) case

Cheers
 
As far as I know, you can assign any numerical value to a G:Var. They are also shared between "blocks of code" as long as they're within the same gauge.

For transmitting information between gauges, use L: vars instead.
 
As far as I'm concerned, Gvars have only one purpose, and that is to keep other gauges from seeing them... :rolleyes:
 
Thanks for the replies, I should have added that this is for an AI aircraft.

Have tried L:Vars on them, and never could get them to work!!!


So assuming I have a thingummy part and a doohickie part.....

a) In the thingummy parts XML I can set the value of a G:Var used in the doohickies parts XML code?
I guess I am asking are the G:Vars local to the parts block of code they are used in, or global and available to all parts blocks of code.

b) Is this valid if{ 0 (>G:Var2) 0 (>G:Var3) 0 }
Set G:Var2 and G:Var3 to 0 and return 0, or is there a neater way of doing it?

c) The syntax for a case statement, only asking because as I found out with rng the actual example in the SDK isn't the correct syntax.
So a case statement, 3 possible values

100 0 50 3 (G:Var3) case

returns
50 when 0
0 when 1
100 when 2

Is this correct.

Thanks
 
Last edited:
Let's see:

a) Yes, providing both are defined in the same modeldef.xml file (which is treated by FS like a single "gauge").

b) Yes.

c) Yes.

Tom
 
Thanks Tom :)

Actually one other question if I may, can you put the value of Boolean into a gvar
eg

(A:LIGHT STROBE,bool) (>G:Var2)

Only thing I need the value to be number ( 0 or 1 ) not a true or false
 
Last edited:
Yes you can, actually (A:LIGHT STROBE,bool) only contains 0 or 1 as a matter of false or true meaning

Tom
 
Back
Top