2022-07-18 11:58:35 -06:00
|
|
|
keybinding
|
2022-07-20 00:01:25 -06:00
|
|
|
==========
|
2022-07-18 11:58:35 -06:00
|
|
|
|
2022-08-09 23:37:24 -06:00
|
|
|
.. dfhack-tool::
|
|
|
|
:summary: Create hotkeys that will run DFHack commands.
|
2022-08-12 00:34:37 -06:00
|
|
|
:tags: dfhack
|
2022-08-09 23:37:24 -06:00
|
|
|
|
|
|
|
Like any other command, it can be used at any time from the console, but
|
|
|
|
bindings are not remembered between runs of the game unless re-created in
|
|
|
|
`dfhack.init`.
|
2022-07-18 11:58:35 -06:00
|
|
|
|
|
|
|
Hotkeys can be any combinations of Ctrl/Alt/Shift with A-Z, 0-9, F1-F12, or
|
2022-07-22 00:21:56 -06:00
|
|
|
``\``` (the key below the ``Esc`` key.
|
2022-07-18 11:58:35 -06:00
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
2022-07-23 17:03:40 -06:00
|
|
|
``keybinding``
|
2022-07-18 12:16:05 -06:00
|
|
|
Show some useful information, including the current game context.
|
2022-07-23 17:03:40 -06:00
|
|
|
``keybinding list <key>``
|
2022-07-18 12:16:05 -06:00
|
|
|
List bindings active for the key combination.
|
2022-07-23 17:03:40 -06:00
|
|
|
``keybinding clear <key> [<key>...]``
|
2022-07-18 12:16:05 -06:00
|
|
|
Remove bindings for the specified keys.
|
2022-07-23 17:03:40 -06:00
|
|
|
``keybinding add <key> "cmdline" ["cmdline"...]``
|
2022-07-18 12:16:05 -06:00
|
|
|
Add bindings for the specified key.
|
2022-07-23 17:03:40 -06:00
|
|
|
``keybinding set <key> "cmdline" ["cmdline"...]``
|
2022-07-18 12:16:05 -06:00
|
|
|
Clear, and then add bindings for the specified key.
|
2022-07-18 11:58:35 -06:00
|
|
|
|
|
|
|
The ``<key>`` parameter above has the following **case-sensitive** syntax::
|
|
|
|
|
|
|
|
[Ctrl-][Alt-][Shift-]KEY[@context[|context...]]
|
|
|
|
|
|
|
|
where the ``KEY`` part can be any recognized key and [] denote optional parts.
|
|
|
|
|
|
|
|
When multiple commands are bound to the same key combination, DFHack selects
|
|
|
|
the first applicable one. Later ``add`` commands, and earlier entries within one
|
|
|
|
``add`` command have priority. Commands that are not specifically intended for
|
|
|
|
use as a hotkey are always considered applicable.
|
|
|
|
|
|
|
|
The ``context`` part in the key specifier above can be used to explicitly
|
|
|
|
restrict the UI state where the binding would be applicable.
|
|
|
|
|
|
|
|
Only bindings with a ``context`` tag that either matches the current context
|
|
|
|
fully, or is a prefix ending at a ``/`` boundary would be considered for
|
|
|
|
execution, i.e. when in context ``foo/bar/baz``, keybindings restricted to any
|
|
|
|
of ``@foo/bar/baz``, ``@foo/bar``, ``@foo``, or none will be active.
|
|
|
|
|
|
|
|
Multiple contexts can be specified by separating them with a pipe (``|``) - for
|
|
|
|
example, ``@foo|bar|baz/foo`` would match anything under ``@foo``, ``@bar``, or
|
|
|
|
``@baz/foo``.
|
|
|
|
|
|
|
|
Interactive commands like `liquids` cannot be used as hotkeys.
|
|
|
|
|
2022-07-20 00:01:25 -06:00
|
|
|
Examples
|
|
|
|
--------
|
2022-07-18 11:58:35 -06:00
|
|
|
|
2022-07-23 17:03:40 -06:00
|
|
|
``keybinding add Alt-F1 hotkeys``
|
2022-07-18 12:16:05 -06:00
|
|
|
Bind Alt-F1 to run the `hotkeys` command on any screen at any time.
|
2022-07-23 17:03:40 -06:00
|
|
|
``keybinding add Alt-F@dwarfmode gui/quickfort``
|
2022-07-18 12:16:05 -06:00
|
|
|
Bind Alt-F to run `gui/quickfort`, but only when on a screen that shows the
|
|
|
|
main map.
|