I send H:Event `A` but all instruments instead receive H:Event `B`

Version: 1.36.2 (recent regression)
Frequency: Always
Severity: High
Context: All aircraft using H:Events, in flight.
Bug description:

UPDATE
H:Events are confused when SimVar.GetRegisteredId is used across flight restart. See the second post in this thread for repro steps and investigation.

Hello. Multiple times now I have gone to debug a problem with my aircraft, and in the process of testing each part, I discover that one of my unique H:Events does not have the correct effect. Using an instrument which prints ‘interaction’ events to console.log, I find that while I send one event by name, a differently named event is immediately received, it is an entirely different unrelated event. I have only ever seen a single impacted H:Event at a time. The incorrect H:Event name is a valid string, in this most recent case it was an H:Event for something used in RPN when clicking a knob.

I’m sending events with an unmodified SimVar.SetSimVarValue and receiving events to BaseInstrument!onInteractionEvent. The erroneous event is received on all instruments, not just the instrument from which the event was sent. I am sending these using the Coherent console, which rules out any internal string confusion within my compiled js assets.

Repro steps:

UPDATE See my second post in this thread for repro steps

Unfortunately for this bug I don’t have the specific repro case, but I wanted to report this anyway because I am doubtful that I’m the only person to have seen this behavior. If there is some internal event confusion, then the actual root cause could explain many different behaviors that are inconsistently displayed across users. Restarting the sim causes the event to start working again, and for the issue to evaporate, evading further analysis.

I can’t think of what components in my aircraft could impact this, but I do use execute_calculator_code to dispatch H:Events from WASM since I don’t know of another approach. Notably though, the specific H:Events that I have observed with the faulting behavior aren’t touched via WASM.

Additionally, I didn’t have an empty Community folder, I had the GTN750 addon loaded. That is a pure JS avionics suite. I expect that means the same APIs I am working with above, so I don’t see how it could be a conflict of any kind. As I said when I reload the sim the bug is already gone.

Pierre discovered important information about the issue: H events become crazy after a flight restart

  1. This is new in SU14 and a very recent regression
  2. There is a 100% repro case
  3. The issue does seem to be the index relationship that powers setValueReg_Number vs setValue_Number is not fully cleared during flight restart.

Repro steps are:

  1. Load an aircraft (I used the JN4 for this test)
  2. Using the coherent console, open VCockpit01 (I think) context
  3. Register to see H:Events:
Coherent.on('OnInteractionEvent', (_, [name]) => {
  console.log("test event received: " + name);
});
  1. Send an event: SimVar.SetSimVarValue("H:TEST_EVENT_1","number",0);
  2. Observe test event received: TEST_EVENT_1
  3. Now go to the menu and Restart the flight. Wait for the flight to load and press Fly Now.
  4. (same as step 3) Register to see H:Events.
  5. (same as step 4) Send an event: SimVar.SetSimVarValue("H:TEST_EVENT_1","number",0);
  6. Observe that no event is received.

At this point you can observe that H:TEST_EVENT_2 (a not-previously-used event) is working fine.

You can also observe that Pierre’s fix works:

  1. Send these commands:
SimVar.g_bUseWatcher = false;
SimVar.SetSimVarValue("H:TEST_EVENT_1","number",0);
SimVar.g_bUseWatcher = true;
  1. Observe test event received: TEST_EVENT_1
2 Likes

Hello @davux3 @ScorpionFilm422 ,

Thank you for reporting this issue.
We were able to replicate the behavior you described and have created a ticket in our backlog.

Thank you for providing the reproduction steps. :slight_smile:

Regards,
Boris

3 Likes

Thank you Boris for your feedback.
Not sure to understand your answer.
You say that you were able to reproduce the issue but you ask for the reproduction steps.
The reproduction requires some specifc context (aircraft, mods) not easy for you to reproduce.
Anyway, when the issue is fixed, I could be able to test it in this specific context.

I was just saying thank you for the steps to reproduce this bug that @davux3 gave us above.
Also thanks to you for the workaround in your topic.

Regards,
Boris

1 Like

ah ok, sorry for the misunderstanding

Boris,
Something has changed around that in 1.37.4.0?
I have a weird behavior:
SimVar.GetSimVarValue(“AUTOPILOT AVAILABLE”, “Boolean”)
returns a number instead of a boolean
Tried with “Bool”, same result.

That breaks many things.

See this example in the attachments.


2024-02-23 12_36_01-NVIDIA GeForce Overlay DT

Hello @ScorpionFilm422

Please follow the guidelines and post a dedicated bug report in the SU15 flighting section so we can properly track the issue.

Regards,
Sylvain

Hello Sylvain (@FlyingRaccoon),

Until now, I saw your reply. I am going to post the dedicated bug report for the issue described by Pierre (@ScorpionFilm422), because I had the same issue. I deleted my previous post to follow the instruction given in your answer.

Thank you very much for your quick answer.

Regards,
Carlos Gonzalez
NextGen Simulations