#Sending local variable

1 messages · Page 1 of 1 (latest)

mellow fractal
#

I need to have mobiflight send L:Doors_Vis as 0 and 1 to remove the doors on a little helicopter in the sim.
I tried through changing the msfs2020 variable code of one but I can’t get it to work. Do I do it through mobiflight variables or changing an msfs variable code?

Would the toggle code be…
L:Doors_Vis, if($=0,1,0) to allow the single button I assign to toggle between 0/1?
Thanks in advance!

brittle spade
#

You need to change the Lvar value directly as input code

#

Try this code in the input config

(L:Doors_Vis, bool) ! (>L:Doors_Vis, bool)
obsidian nest
#

@mellow fractal the somewhat confusing part is that there are two different scripting code systems in MobiFlight. The "Transform" modifiers and Value fields use NCalc which is a bit like Excel spreadsheet formulas.

That is the if($=0,1,0) stuff.

Then there is the other method which is RPN or reverse polish notation - and this happens inside MSFS2020 and 2024 via the WASM module (essentially a simulator plug-in that talks to MobiFlight and allows us to see inside the simulator context.

#

RPN is the (L:Doors_Vis, bool) stuff, and you cannot mix those two, because they are not happening in the same place.

mellow fractal
obsidian nest
#

HubHop presets (which are also the MSFS Simconnect presets in MobiFlight Connector) are all RPN.

#

so if it is a simulator local variable it has to happen in RPN

#

if you want to make an event that toggles the l-variable,

#

so the link above explains the RPN in detail,

#

but basically, to read a variable, you do:

(X:VariableName, unit)

#

where X is usually either A or L

#

depends on the way the aircraft was done

#

did the code Jaime gave you above work?

#

you can add that to the "Custom code" field in an input configuration

#

what that code does:

(L:Doors_Vis, bool) ! (>L:Doors_Vis, bool)

is it reads the value, inverts it (the exclamation mark operand) and then writes the inverted value back to the same variable - writing has that angled bracket denoting that we put a value to the varialbe.

brittle spade
obsidian nest
#

and MobiFlight variables exist only linside MF Connector, not in the sim.

mellow fractal
brittle spade
#

RPN = Reverse Polish Notation

obsidian nest
#

you can create custom L-vars from inputs:

1 (>L:MyVariable, Number)

And you can read the same from an Output:

(L:MyVariable,Number)

#

this works of course in MSFS only

#

mobiflight variables work in all sims