Difference between revisions of "Keybind file"
HistidineBot (talk | contribs) (Ported from ZK wiki by DotNetWikiBot) |
(Spelling fix "Contolling" -> "Controlling") |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | ZK uses a Lua configuration file to store keybinds. It can be found at | |
− | ZK uses a | ||
<code> | <code> | ||
− | < | + | <ZK folder>\LuaUI\Configs\zk_keys.lua |
</code> | </code> | ||
Line 21: | Line 20: | ||
This will bind three key combos to the attack command. A, Q and ctrl+W. | This will bind three key combos to the attack command. A, Q and ctrl+W. | ||
− | ===(2) | + | ===(2) Controlling Order of Multiple Actions That Use The Same Keybind=== |
You can use the ingame menu to bind the same keycombo to different actions, but you cannot control the order in which they are active. For example you may want to bind "attack" and "fight" both to "A" but you want to make sure the fight command is always active on the first time you hit A, and attack second. Edit the file like the following example: | You can use the ingame menu to bind the same keycombo to different actions, but you cannot control the order in which they are active. For example you may want to bind "attack" and "fight" both to "A" but you want to make sure the fight command is always active on the first time you hit A, and attack second. Edit the file like the following example: | ||
Line 30: | Line 29: | ||
==Level 3 - uikeys.txt Migration== | ==Level 3 - uikeys.txt Migration== | ||
− | If you've set up a lot of keybinds in the engine's uikeys.txt and you don't wish to use the ingame menu to rebind them, you can migrate your keybinds using a text editor. As an example, the following search/replace string pair (in Komodo Edit) does a decent job of converting keybindings from uikeys that you can paste into the keybind file: | + | If you've set up a lot of keybinds in the Spring engine's uikeys.txt and you don't wish to use the ingame menu to rebind them, you can migrate your keybinds using a text editor. As an example, the following search/replace string pair (in Komodo Edit) does a decent job of converting keybindings from uikeys that you can paste into the keybind file: |
− | < | + | <pre> |
bind\s'''(\S''')\s'''(.''') | bind\s'''(\S''')\s'''(.''') | ||
{ "\2", "\1" }, | { "\2", "\1" }, | ||
− | </ | + | </pre> |
Once you've pasted this new text, you'll likely need to refer back to Level 2 for the scenarios where you'll need to further modify the file. For example, two separate lines with the same action won't work, you'll need to combine them into one line. | Once you've pasted this new text, you'll likely need to refer back to Level 2 for the scenarios where you'll need to further modify the file. For example, two separate lines with the same action won't work, you'll need to combine them into one line. | ||
Line 50: | Line 49: | ||
=== Modifiers === | === Modifiers === | ||
− | + | * Any (`*`) | |
* Alt (A) | * Alt (A) | ||
* Ctrl (C) | * Ctrl (C) |
Latest revision as of 08:52, 10 February 2019
ZK uses a Lua configuration file to store keybinds. It can be found at
<ZK folder>\LuaUI\Configs\zk_keys.lua
Contents
Details
Level 1 - Basic Usage
You don't need to edit this file. You can simply use the ingame menu to set hotkeys to commands and they will be saved to this file on exit. You may wish to occasionally save this file to a secure place in case you anticipate reinstalling the game.
Level 2 - Advanced Usage
Some people might want a little more control over the keybinds. There are two scenarios where you'd need to edit the file. Only edit the file when you're not running the game, otherwise your changes will get lost.
(1) Binding Multiple Keybinds to a Single Action
You might want to bind 2 or more key combos to a single action, which cannot be done in the game. Edit the file like the following example:
{ "attack", {"a","q","c+w"} },
This will bind three key combos to the attack command. A, Q and ctrl+W.
(2) Controlling Order of Multiple Actions That Use The Same Keybind
You can use the ingame menu to bind the same keycombo to different actions, but you cannot control the order in which they are active. For example you may want to bind "attack" and "fight" both to "A" but you want to make sure the fight command is always active on the first time you hit A, and attack second. Edit the file like the following example:
{ "fight", "a", },
{ "attack", "a", },
Level 3 - uikeys.txt Migration
If you've set up a lot of keybinds in the Spring engine's uikeys.txt and you don't wish to use the ingame menu to rebind them, you can migrate your keybinds using a text editor. As an example, the following search/replace string pair (in Komodo Edit) does a decent job of converting keybindings from uikeys that you can paste into the keybind file:
bind\s'''(\S''')\s'''(.''') { "\2", "\1" },
Once you've pasted this new text, you'll likely need to refer back to Level 2 for the scenarios where you'll need to further modify the file. For example, two separate lines with the same action won't work, you'll need to combine them into one line.
Disregard any "unbind" commands; They no longer apply.
Level 4 - uikeys.txt Purists
If you absolutely refuse to use the new system and you wish to continue using the engine's uikeys.txt file, you can configure the game to use it. This is not recommended, as you lose the ability to bind keys in the menu and have them save over to future games. Apply the following changes:
- Enable: Settings > Show Advanced Options
- Enable: Settings > Misc > Use uikeys.txt.
- Restart spring once.
Modifiers
- Any (`*`)
- Alt (A)
- Ctrl (C)
- Meta (M)
- Shift (S)
The special 'Any' modifier makes it so that the keyset matches regardless of the current state of the real modifiers.