- Messages
- 75
- Country

I am working with WASM standalone sample from SDK. I am declaring and setting some LVARS, all of which work fine, except, one of them I would like to set to TRUE when my WASM app is active... sort of, declare "hey, I am running!". The purpose of this is to let other WASM apps know this one is running, so that certain tasks are (or aren't) performed.
The problem I have is that, if I set this LVAR in module_init block, just after I declare it:
This LVAR is NOT set to 1 (Later in the code, I check the value by requesting the LVAR and checking its contents, which comes back as 0)
In order to have it set to 1, I have to do the SimConnect_SetDataOnSimObject bit in the actual MyDispatchProc.
So my question is, what are the nuances of timing in there? Why are LVARS "settable" only when set inside the MyDispatchProc? Or, am I doing something wrong?
The problem I have is that, if I set this LVAR in module_init block, just after I declare it:
Code:
extern "C" MSFS_CALLBACK void module_init(void)
...
hr = SimConnect_AddToDataDefinition(hSimConnect, DEF_MYAPP_LVARS, "L:LVAR_MYAPP_IS_ACTIVE", "number", SIMCONNECT_DATATYPE_FLOAT64);
m_Def_MYAPP_LVARS.LVAR_MYAPP_IS_ACTIVE= 1.0f
hr = SimConnect_SetDataOnSimObject(hSimConnect, DEF_MYAPP_LVARS, SIMCONNECT_SIMOBJECT_TYPE_USER, 0, 0, sizeof(Def_MYAPP_LVARS), &m_Def_MYAPP_LVARS);
...
hr = SimConnect_CallDispatch(hSimConnect, MyDispatchProc, NULL);
...
}
In order to have it set to 1, I have to do the SimConnect_SetDataOnSimObject bit in the actual MyDispatchProc.
So my question is, what are the nuances of timing in there? Why are LVARS "settable" only when set inside the MyDispatchProc? Or, am I doing something wrong?

