Send B Events

I have searched through the forums and the SDK and still can’t figure this out.

How does one send B Events to the sim? I have a working WASM module for H:Events and they work perfectly fine.

Just need to know the process. Do I need to add them as data definition or anything like that?

Any help would be greatly appreciated.

Hi!

I just figured it out yesterday from SimConnect :smiley: B events are not sendable through SimConnect_TransmitClientEvent_EX1 as K events are.

To to that I first retrieve all the InputEvents loaded for the aircaft with SimConnect_EnumerateInputEvents and get the hash for the one that I want to trigger. Then I send * SimConnect_SetInputEvent* with the right value and I was able to emulate the click on the BAT 1 push button in the A320N that way, event ids way was not working since they are inhibited through the preset.

1 Like

Awesome, I will give this a go!

My other issue is how do you send the “Inc, Dec, or Set”?

I’m working with the Fenix which has some new B Events for the encoders.

For the set you have to use SimConnect_SetInputEvent. I guess there is no need for inc and dec since they are just a variation of the set.

Hello

We don’t expose the Inc, Dec or other custom events at the moment.
There’s a bug report you can follow for this if you want to be notified if there’s a change on this:
EnumerateInputEvents doesn’t return _INC, _DEC, _TOGGLE, _ON, and _OFF events - Bug Reports / SimConnect - MSFS DevSupport (flightsimulator.com)

Regards,
Sylvain

I see. So what’s the “trick” that is mentioned to use it?

Currently sending set 1 or -1 seems to work somewhat but is erratic.

Also getting information from the even yields a zero every time.

I have the same issue. I have no experience in C++ so this might be wrong but here is how I set the input event:

float value = 1.0f;
SimConnect_SetInputEvent(hSimConnect, input_events_hash[ELECTRICAL_BATTERY_1], sizeof(value), &value);

But in the debug tools I see this:

I guess this is why it’s erratic but I don’t know how to solve this. Plus, it seems it works less when the simulator just started (my code was mostly working yesterday but I’m unable to switch the battery on right now)

I think the value on SimCOnnect debug is normal since it’s a pointer but the following is clearly the reason of why it’s erractic:

Execution #2 loads a value that is not what I send. I send 1 every time but the param value is changing at each call. What could be the cause?

here’s a dumb question:

what’s the point of B events, if the user can’t set a keybind for those anyway?

I.e. why not just ‘set’ an L: var to 1 wherever you want to ‘trigger’ the event, and in the code that ‘handles’ the event you detect the non-zero L:var and the event handling code resets that L:var to zero ready for the next trigger. Super easy, works in every API subsystem.

The MSFS event-handling is a bit hit-and-miss between the different API subsystems, e.g. triggering a K: event in Javascript doesn’t get picked up by the Asobo_GIE event handling code in model XML but triggering the same event in a user controls keybind does get through to the XML.

What did I miss?

:slight_smile: There would be a benefit at least from a SimConnect perspective
They can be defined by the aircraft designer and you can call and/or observe them directly from SimConnect a bit like regular Key Events
LVars - yes you can read and write but conceptually a Var is not really an event and the LVar handling varies a lot, some expect a 1 to trigger, some expect N+1 to be sent etc. and one never knows…

However my experience is that some (many??) of those InputEvents (B-Events) are registered by aircrafts but then not monitored or they don’t execute as a complete event i.e. not triggering visuals - or only half (button remains pressed) or are just plainly ignored. Some just set an LVar behind scenes.

As with many of the various APIs there is no consistency which is then mostly trial and error when using them as 3rd party dev. (undocumented anyway)
And I don’t know if there is any motivation for acft devs to use, provide, and maintain them. Neither can they be mapped to the controllers attached.

Acft devs chime in and let us know what triggers your design choice to use B-Events (or not using them…)

Edit: DELETED (as there is no use case or guidance mentioned in the SDK docs.)
There is documentation available -
file:///E:/D/MS/MSFS2024_SDK/Documentation/html/5_Content_Configuration/Models/ModelBehaviors/Input_Event_XML_Properties.htm