plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.

In the upcoming flighting, we've changed the behaviour of the content.xml file. If your addon uses this file, please read this article!

Please take a moment to read the platform’s guidelines before you get started!


question

SWS-AlexVletsas avatar image
SWS-AlexVletsas asked FlyingRaccoon answered

Persistent LocalVars in Systems.cfg

Per the SDK documentation there is a LocalVars section in systems.cfg that allows for storage of L:vars to be used in the next load of the aircraft, which are saved in states.cfg.

The syntax, per the SDK is this:

[LocalVars]
LocalVar.0 = my_custom_lvar
LocalVarDefault.0 = 666
LocalVar.1 = my_other_custom_lvar
LocalVarDefault.1 = 999

However, in the .FLT files and states.cfg, the format looks like this:

[LocalVars]
my_custom_lvar = 666
my_other_custom_lvar = 999

Are both syntaxes valid or should we use the first one?

aircraft
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image
FlyingRaccoon answered SWS-AlexVletsas commented

Hello @SWS-AlexVletsas

The first syntax is only for system.cfg as you are declaring the variables and defining their default values.

The second one is used in state.cfg (LocalVars) and .flt (LocalVars.N) as you just need to store their value.

I agree using the same section name for state.cfg makes it a bit confusing but under what circumstances do you need to know the format of that file as it's handled automatically by the game?

Regards,
Sylvain

1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

I was confused as to why two syntaxes were used, but apparently one is "read-only" and the other one is "read-write".


Also, a bug: LocalVar.0 seems to be ignored. I will re-test and let you know about this.

0 Likes 0 ·
Simbol avatar image
Simbol answered

Following..

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

MrTommymxr avatar image
MrTommymxr answered

Same observations here. Value number 0 is ignored.

Also experienced some inconsistencies with the setting of the default value, however I was using (and probably writing) the Lvar simultaneously.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image
FlyingRaccoon answered SWS-AlexVletsas commented

Hello @SWS-AlexVletsas @MrTommymxr

When you say that LocalVar.0 from .FLT are ignored, do we agree we are still talking about persistent local vars?

If so, this is the intended behavior and the content of the state.cfg takes priority over the one from a custom FLT file. Persistent local vars were designed so that user can save their "user configuration". Instrument brightness for example.

I'm not sure how you want to use these, can you tell us what you're trying to do?
I know some devs are using it for things like aircraft maintenance (saving the battery level for example) but this is not really what it's supposed to be used for.
In that case, you should rather create a set of dedicated local variables in the FLT.

Regards,
Sylvain

1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Correction: LocalVar.0 from systems.cfg seems to be ignored. The rest worked for my test.


The intention is to use special, persistent L:vars in systems.cfg for things like aircraft maintenance.

0 Likes 0 ·
FlyingRaccoon avatar image
FlyingRaccoon answered

Oh ok, I see what you mean.
The doc will be fixed, the index starts from 1 in that section, not 0.
Thank you for reporting it.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.