JS_LISTENER_KEYEVENT: Some events work, some don't

Running this code on any js page. I can get some events to work (e.g. AP_MASTER) but others don’t like INCREASE_THROTTLE or DECREASE_THROTTLE

Anything I should know that is special about those events?

(() => {
	RegisterViewListener('JS_LISTENER_KEYEVENT', () => {
		Coherent.call('INTERCEPT_KEY_EVENT', 'AP_MASTER', 1);
		Coherent.call('INTERCEPT_KEY_EVENT', 'INCREASE_THROTTLE', 1);
		Coherent.call('INTERCEPT_KEY_EVENT', 'DECREASE_THROTTLE', 1);

		Coherent.on('keyIntercepted', (key, value1, value0, value2) => {
			console.log('keyIntercepted', key, value1, value0, value2);
		});
	});
})();

Thank you!

1 Like

Hello @runshotgun

What aircraft are you testing this on?
Are you sure those events are the ones being used?

Regards,
Sylvain

Tested with the default Caravan.

The default Xbox controller assignment has those 2 events bound to the A and B buttons.

I have tried all the other throttle-related events as well and none of them fire when pressing either of those 2 buttons.

What’s interesting is that the Throttle Cut event does work correctly when both buttons are pressed.


I believe those are the _EX1 versions of the increase/decrease events that are bound in the menu. For maximum compatibility (because hardware and addons can use any of the events), you should intercept all throttle events eventually.

The list of events can be found here: Aircraft Engine Events

Thanks,
Matt

2 Likes

In the case of the Caravan, the ASOBO_ENGINE_Throttle_SubTemplate template is used so throttle increase goes through the ENGINE_Throttle_1_Inc input event (Engine_Inputs.xml).
This input event uses the THROTTLE1_SET key event.

As Matt mentioned, this really depends on implementation so you probably want to intercept all of them.

Regards,
Sylvain

THROTTLE1_SET does indeed work in the very specific case of the Caravan but doesn’t work on all aircraft (that doesn’t use that template)

Thank you for pointing me in the right direction guys!

After a lot of messing around and throwing noodles at the wall, those 2 undocumented events are working:

THROTTLE_INCR
THROTTLE_DECR

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.