How can I set string values with execute_calculator_code

I’m working on an implementation using a WASM Module. In some cases, I make use of execute_calculator_code. If you are interested, I wrote a tutorial that explains how to use WASM in combination with SimConnect Client Area Data here.

All works perfect in combination with numeric values, such as:

execute_calculator_code("2 (>L:A32NX_EFIS_L_OPTION,enum)", nullptr, nullptr, nullptr);

This puts the value “2” in the LVar “A32NX_EFIS_L_OPTION”.

But how can I use a string as parameter? Below example seems not to work.

execute_calculator_code("ABC123 (>A:ATC FLIGHT NUMBER,string)", nullptr, nullptr, nullptr);

I tried with a lot of formats, but with no success:

execute_calculator_code(" 'ABC123' (>A:ATC FLIGHT NUMBER,string)", nullptr, nullptr, nullptr);
execute_calculator_code(" [ABC123] (>A:ATC FLIGHT NUMBER,string)", nullptr, nullptr, nullptr);
execute_calculator_code(" \"ABC123\" (>A:ATC FLIGHT NUMBER,string)", nullptr, nullptr, nullptr);

I wonder if it is possible after all?

Before you ask, I can set the variable directly from my SimConnect Client using SetDataOnSimObject, so I know the variable does work and is storing the value.

Hi Hans! :wave:

Did you ever get this to work?
(You know why I’m asking… :wink: and very amusingly this seems to be the only thread on the subject that I can find.)

Strangely, I have a number of saved examples here and there of the 'ABC123' (>A:ATC FLIGHT NUMBER,string) syntax (with the single quotes specifically)… like I’ve used them before. But now, nothing…

I get errors in the MSFS console is the RPN calc string is formatted any other way, eg. with double quotes or other delimiters around the string (or other syntax issues like missing unit or whatever). With the single quotes there’s no error… nothing happens at all :frowning:

Setting those string type vars with SimConnect API or the JS API does work (as you also observed).

:person_shrugging:

Cheers,
-Max

Hello Max,

I have given up by doing it via execute_calculator_code. It think that it simply doesn’t work.

But it doesn’t bother me too much. As you already discovered, there are only about 6 string-like A-vars:

ATC AIRLINE, ATC FLIGHT NUMBER, ATC ID,
GPS WP NEXT ID, GPS WP PREV ID, DROPPABLE OBJECTS TYPE

As a cockpit builder, I’m not so interested in most of them. Actually, as I’m using the A320, which has an MCDU, I can enter most of them via that way, which is also the only “real way” to do this.

I think that Asobo simply doesn’t seem to see the need to make it work for these few nerds over here :slight_smile:

Greetz,

Hans

1 Like