Hello,
Is it possible to set string values with RPN and execute_calculator_code()
?
I have tried various syntax combinations. Basically the only one that doesn’t produce errors in the MSFS console is wrapping the string value in single quotes, eg:
'ABC123' (>A:ATC ID, string)
But this doesn’t actually do anything either, eg. the ATC ID doesn’t change.
Setting the same variable with SimConnect (SetDataOnSimObject(...)
) or JS API (SimVar.SetSimVarValue(...)
) does work (as expected).
I’ve tried double quotes, escaped quoted, wrapping the string in various brackets, “formatting” a string first (eg. using %
notation and with F:Format
), using ... (>F:VarA)
notation in various ways, and some other silly stuff.
Is there a magic sauce, or does this simply not work for some (undocumented) reason?
FWIW, reading a string value with, eg. execute_calculator_code("(A:ATC ID, string)", ...)
works fine.
Here’s a 2 yo post I found on the subject over at the main forums, showing some things Hans had tried as well (but no responses):
https://forums.flightsimulator.com/t/how-can-i-set-string-values-with-execute-calculator-code/503755/1
Granted there’s no specific example in any docs of setting a string value this way, that I can find. But what is one supposed to do, then?
For “A” Sim Vars I guess SimConnect could be used instead.
What about “GPS” variables (they’re settable/usable via JS API, but not via SimConnect that I can figure out).
Or “Z” vars (if those can even be strings)? Not sure there are any other settable types which can be strings.
Thanks!
-Max