Documentation: https://github.com/bvbohnen/x4-projects ... nctions.md
X4 Hotkey API
Adds support for capturing key presses in X4, to implement custom hotkeys.
An external Python server is used for the key capture and combo recognition, and interfaces with X4 using named pipes.
Requirements
- Named Pipes API
- https://github.com/bvbohnen/x4-named-pipes-api/releases
- Server should be running. - Optionally, if using the python pipe server, the pywin32 and pynput packages.
- Not needed when using the prebuilt server executable.
Extensions may define custom hotkey actions by registering a new action with the api, where an action has an id and callback cue. Actions are initially unbound to any input. Actions will appear in the standard controls menu for the player, under the General page. Each action may specify in which contexts it will be valid: when flying, when walking, in any menu, or in specifically named menus.
Example action registration:
Code: Select all
<signal_cue_instantly
cue="md.Hotkey_API.Register_Action"
param="table[
$id = 'kc_target_follow',
$cue = Target_Follow,
$name = 'Follow Target',
$description = 'Turns on autopilot to follow the target'
]"/>
Example direct key mapping:
Code: Select all
<cue name="Register_Keys" instantiate="true">
<conditions>
<event_cue_signalled cue="md.Hotkey_API.Reloaded" />
</conditions>
<actions>
<signal_cue_instantly
cue="md.Hotkey_API.Register_Key"
param="table[$key='shift a', $id='kc_target_follow']"/>
</actions>
</cue>
- The windows backend confuses numpad enter and numpad / with their non-numpad counterparts. If one of these keys is used, both the numpad and normal key will trigger the hotkey callback.
- Currently only supports keyboard inputs.