# Sending and Receiving Events

You'll send a lot of events, which will trigger various actions within the simulator and the HPG aircraft. You won't receive as many events, receiving events as a special case when the system needs to let you know something happened.

# Sending Events

There are two main types of events, K: events and H: events. K: (for keyboard) events are essentially the same control bindings which you may bind in the MSFS preferences. H: (for HTML) events are events which are defined by the developer, which means the list is the HPG Aircraft SDK.

Event Prefix List Provider
K: (Keyboard) Simulation Events IDs (opens new window) Microsoft
H: (Html) HPG H145 SDK Events HPG

Examples:

{"trigger": "K:TOGGLE_NAV_LIGHTS"}

{"trigger": "H:H145_SDK_OH_PITOT_1_TOGGLE"}

If you need to set the value of a K: event, use set instead.

# Notable received events

This is a list of common events (not exhaustive) which you may respond to:

Event Name Description
ON_MISSION_ABORTING Called just before unloading the mission. You should do critical work here only.
H145_SDK_CARGO_COUPLE_FAILED Called when the cargo couple button was pressed but no object could be coupled or uncoupled.
H145_SDK_CARGO_COUPLE_ACTIVATED Called when the cargo couple button was pressed and an object was subsequently coupled successfully.
H145_SDK_CARGO_DECOUPLE_ACTIVATED Called when the cargo couple button was pressed and an object was subsequently uncoupled successfully.
H145_SDK_HELITOCH_IGNITE_ACTIVATED Called when the Heli-Torch is requesting to create a new fire immediately. (This will be repeated but at the correct rate for you to create fires)
H145_SDK_BAMBI_BUCKET_FILL_ACTIVATED Called when the Bambi bucket begins filling.
H145_SDK_BAMBI_BUCKET_DUMP_ACTIVATED Called when the Bambi bucket valve opens.
H145_SDK_BAMBI_BUCKET_VALVE_CLOSED Called when the Bambi bucket valve closes.

# Receiving events

You can be advised of H: events by creating an event handler. You can also define the handler up front in the events table. Note that you may not have more than one event handler for a given event, and the last writer will win when setting the second time.

Example:

{"create_event_handler": "H145_SDK_BAMBI_BUCKET_DUMP_ACTIVATED", "commands":[
  {"set_message":{"text":"bambi dumped!"}}
]}

Note: Working in the cockpit (flipping switches) will actually NOT generate the 'expected' SDK event for most controls.