Developing own WASM module + SimConnect client - all kinds of questions

I have acquired some basic knowledge on SimConnect with the help of a post of @dragonlaird that you can find here. I seem now to be able to read and control SimVars using SimConnect.

Next step is reading and controlling LVars, which requires the use of a WASM module. With my first babysteps, I accomplished to read and write the FWB A32NX variable “A32NX_EFIS_L_OPTION” and show some results in the Console window (no communication with the outside world still).

In my WASM module, I subscribed to the EVENT_FRAME. In the DispatchProc I then read and write to the LVar “A32NX_EFIS_L_OPTION” every 60 ticks.

case SIMCONNECT_RECV_ID_EVENT_FRAME:
{
	if (counter == 0)
	{
		counter = 60;

		ID varID = check_named_variable("A32NX_EFIS_L_OPTION");

		if (varID == -1)
			fprintf(stderr, "WASM_HABI: A32NX_EFIS_L_OPTION does not exist");
		else
		{
			value = get_named_variable_value(varID);
			fprintf(stderr, "WASM_HABI: get_named_variable_value(A32NX_EFIS_L_OPTION) = %u", value);

			value = (value + 1) % 6;

			set_named_variable_value(varID, value);
			fprintf(stderr, "WASM_HABI: set_named_variable_value(A32NX_EFIS_L_OPTION) = %u", value);
		}
	}
	else
		counter--;

The result is a nice “lightshow” on the left EFIS panel :slight_smile: and the below result in the Console window:

image

Next step will be to build some interface using the SimConnect DataArea to allow me to set and get LVars from the outside world.

Some questions:

  1. I asked this already in other posts, and nobody could give a working solution, but if there are still people out there that know how to “restart” the WASM module while FS2020 is running, please let me know how. That would make developing a WASM module a lot less of a nightmare.
  2. Is it correct that these “gauge”-functions only work with double? What if I have to deal with strings? Is “execute_calculator_code” then the only option?
  3. Is there a way to “register” for LVars so that I’m only triggered when they change? Something like the flag SIMCONNECT_DATA_REQUEST_FLAG_CHANGED when used with SimConnect_RequestDataOnSimObject?