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

MSFS Settable Simvars? Noob(ish) question

Messages
245
Country
germany
At the risk of coming off as a complete idiot, how do you set them?
I suppose it can't be done with RPN? FYI I know how to use key events. :cool:
 
I figure I should have worded my question better.
I'm not asking for a step by step guide on how to set Simvars, I just want to know which route to go, RPN, Simconnect you name it.
Thanks!
 
Last edited:
I figure I should have worded my question better.
I'm not asking for a step by step guide on how to set Simvars, I just want to know which route to go, RPN, Simconnect you name it.
Thanks!

Hi,

Although I just dabbled a little in it, setting SimVars in RPN is the most essential and basic thing. There are plenty of code examples on this site and many others. If you can't find any, let me know and I can dig up a simple one. In RPN, you use SimVars directly, either obtaining their value and doing something with it, or setting their value.

Same goes for SimConnect, but instead of RPN, it is all C/C++. I prefer that because it is more formal and I've been working with it since my school days. Same goes for SimConnect, plenty of examples provided in MS SDK. In SimConnect, it is a bit more involved to "get to" a simvar (you have to register through SimConnect and "request" and "set" them through client-server architecture).

However... if you never coded in your life, you have a bit of a learning curve to climb.
 
Hey Misho,
thanks for the response!
Well, I know how to manipulate simvars with key events and not really new to writing RPN code either (no experience with simconnect though, hence my question) but I have yet to see how one would set a simvar directly so I would indeed apprechiate seeing an RPN sample or two.

Cheers

Mathias
 
Hi! Can you say what simulator variable you want to set? A key event seems pretty direct to me, you flip a switch and the SimVar WINDSHIELD DEICE SWITCH changes from 0 to 1. How much more directly do you wish to control this SimVar?
 
Okay, I see I'm not very clear. Let me get a bit more specific.

With this code here....
XML:
<CALLBACKCODE>
                    (M:Event) 'LeftSingle' scmi 0 ==
                        if{ (&gt;K:TOGGLE_MASTER_BATTERY) 3 (&gt;K:ELECTRICAL_CIRCUIT_TOGGLE) }
                </CALLBACKCODE>

...I set the simvar "(A:ELECTRICAL MASTER BATTERY, bool)" on/off.

But how about GENERAL ENG COMBUSTION and GENERAL ENG COMBUSTION EX1?
Apparently there are no key events to go with those vars even though the SDK says there are settable?
 
Ok, I will observe there are no preconditions for the battery state, it exists in one of two states. Once all the preconditions are met, ignition, fuel, (&gt;K:TOGGLE_STARTER1) will change GENERAL ENG COMBUSTION:1 from 0 to1.
 
Yes, so far I know. There's however a difference between the two variables GENERAL ENG COMBUSTION and GENERAL ENG COMBUSTION EX1 which are supposed to do two slidely different things and they appear to be, well, settable, according to this devsupport post. Setting magnetos etc pp on or off doesn't distinguish between the two.
 
That thread is about going from state 1 to 0 specifically and the issue is the way the sim engine displays this state change. I am not arguing the point, just observing that that thread only establishes the possibility of the 1 to 0 direction.

Beyond that I am kind of with Raccoon, I think Lvars would solve this. Let me show you what I mean, I am too visual and not as clear to articulate.


This is all sleight of hand. there are two logs, one is always invisible. One appears at ground level and maintains the exact distance, the other appears when the grapple is engaged, which also hides the first log.

I do not know your exact situation. It seems like overall, the issue is when to get the propeller freewheeling. My solution would be to switch models, you see. One model is more of a windmill that looks like an engine. It could be that the propeller will not stop freewheeling, in which case an Lvar driven model swap of a fixed state propeller would still address the requirement.
 
Hmm, thanks, but that's not how I read that thread. They repeatedly talk the pros and cons of using L:Vars, magnetoes or said A:Vars directly.
There's also these below quoted differences in using the Simvars to consider. Obviously L:vars or K:Magnetoxxx don't care about the difference.

You can try with the Asobo TBM. Writing 0 to **GENERAL ENG COMBUSTION** will
instantly stop the propeller while writing 0 to **GENERAL ENG COMBUSTION EX1**
will have it decelerate smoothly.

...and this quote from the SDK:


GENERAL ENG COMBUSTION:indexSet the indexed engine (see note) combustion flag to TRUE or FALSE. Note that this will not only stop all combustion, but it will also set the engine RPM to 0, regardless of the actual state of the simulation.

NOTE: This is available in multiplayer to all far aircraft. See here for more information: Note On SimVars In Multiplayer.
Bool
GENERAL ENG COMBUSTION EX1:indexThis SimVar is similar to GENERAL ENG COMBUSTION, in that it can also be used to enable or disable engine combustion. However this SimVar will not interfere with the current state of ths simulation. For example, if the aircraft has a turbine engine with auto_ignition enabled or it's a propeller engine with magnetos, then in the subsequent simulation frames this SimVar may be set to 1 (TRUE) again as the engine restarts automatically.
 
Last edited:
Hmm, who would have thought that?
It's as easy as this:


XML:
                <CALLBACKCODE>
                    (M:Event) 'LeftSingle' scmi 0 == (A:GENERAL ENG COMBUSTION:1, bool) } and
                                    if{ 0 (&gt;A:GENERAL ENG COMBUSTION:1, bool) }
                </CALLBACKCODE>

So I was absolutely certain you couldn't set an A:Var without a key event but it actually works.
...and to answer the original question, you can set an A:Var in the same way you set an L:Var, asumed it's settable. :cool:
 
Last edited:
Back
Top