- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
Difference between revisions of "Interface.txt"
LethosorBot (talk | contribs) (Tagging v50 page (2289/4888)) |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | {{Quality| | + | {{migrated article}} |
+ | {{Quality|Unrated}} | ||
{{av}} | {{av}} | ||
{{file|DF/data/init/interface.txt}} | {{file|DF/data/init/interface.txt}} | ||
: ''See [[Controls]] for the default key binds.'' | : ''See [[Controls]] for the default key binds.'' | ||
− | The game key bindings are stored in '''interface.txt''' | + | '''Key bindings''' determine how the game responds to the user (you) pressing different keys on their keyboard, numberpad, laptop, whatever. |
+ | |||
+ | The game key bindings are stored in '''interface.txt'''. They can be configured in the {{DFtext|Key Bindings}} section of the in-game options screen or by editing this file directly. | ||
+ | |||
+ | Each action can be bound to any number of keys, either by keyboard location or letter. They can also be given a repeat style which specified what happens when any of the bound keys are held: | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Repeat Style | ||
+ | ! Behavior | ||
+ | |- | ||
+ | | Don't repeat | ||
+ | | The action does not repeat at all; pressing the key performs the action exactly once, no matter how long it is held. | ||
+ | |- | ||
+ | | Delayed repeat | ||
+ | | The action repeats after a delay of [[DF2014:Technical_tricks#Keyboard|<code>KEY_HOLD_MS</code>]] milliseconds. | ||
+ | |- | ||
+ | | Immediate repeat | ||
+ | | The action repeats immediately. | ||
+ | |} | ||
− | + | == Changing key bindings in-game== | |
+ | When in-game, press {{k|Esc}} to open the options screen and select {{DFtext|Key Bindings}}. This shows the various game mode/screen categories (and [[Macros]]). | ||
− | + | Selecting one shows all of the bindable game commands in that category. On the left is a list of bindable commands and on the right are options to add bindings and change the action's repeat style. Use the left and right selection keys to move between them. | |
− | |||
− | + | Use {{k|Backspace}} on a binding to remove it. | |
− | For example if you wanted to add {{k|9}} to "Select" command(odd, but your choice) you would then select the General category, press right on the first command(Select) and hit {{k|Enter}} on the "Add binding" option to open a key registration prompt and then press {{k|9}} and select whether you want to bind [[#Differences_between_KEY_and_SYM|by position or by key]] and hit {{k|Enter}} or if you hit the wrong button {{k|Esc}}(or whatever you have set to "Main menu" or "Leave screen" keys) to abort | + | For example if you wanted to add {{k|9}} to "Select" command (odd, but your choice) you would then select the General category, press right on the first command(Select) and hit {{k|Enter}} on the "Add binding" option to open a key registration prompt and then press {{k|9}} and select whether you want to bind [[#Differences_between_KEY_and_SYM|by position or by key]] and hit {{k|Enter}} or if you hit the wrong button {{k|Esc}} (or whatever you have set to "Main menu" or "Leave screen" keys) to abort. |
− | + | Adding bindings does not remove any other binding that also uses this key. This is almost never what you want, so you'd then have to find any command that is also bound to your added key, or you'll be sending both commands every time. | |
− | == | + | == Useful custom bindings == |
− | + | ===Scrolling without keypad=== | |
− | + | If you're on a laptop or using a restricted keyboard, using {{k|+}} and {{k|*}} to scroll on some menus is inconvenient since it requires the Shift key. To scroll with <code>-=[]</code> instead of <code>-+/*</code>, add: | |
− | + | {| class="wikitable" | |
− | + | |- | |
+ | ! Category !! Command !! Key | ||
+ | |- | ||
+ | | General || Move secondary selector down || {{k|<nowiki>=</nowiki>}} | ||
+ | |- | ||
+ | | General || Page secondary selector up || {{k|[}} | ||
+ | |- | ||
+ | | General || Page secondary selector down || {{k|]}} | ||
+ | |} | ||
− | + | ===Change z-level without shift=== | |
− | + | You can use the comma {{k|,}} and period {{k|.}}, rather than {{k|<}} and {{k|>}} (the same keys + {{k|Shift}}) for up/down [[z-level]]s, thus avoiding the need to use two hands/keys for this common action. | |
− | + | Add the following: | |
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Category !! Command !! Key | ||
+ | |- | ||
+ | | General || Move view/cursor up (z) || {{k|,}} | ||
+ | |- | ||
+ | | General || Move view/cursor down (z) || {{k|.}} | ||
+ | |} | ||
− | + | Then remove the following to avoid clashing: | |
− | = | + | {| class="wikitable" |
− | + | |- | |
+ | ! Category !! Command !! Key | ||
+ | |- | ||
+ | | Dwarf mode || Main: One-Step || {{k|.}} | ||
+ | |} | ||
== interface.txt == | == interface.txt == | ||
Line 68: | Line 108: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
+ | ! String | ||
! Repeat Style | ! Repeat Style | ||
− | |||
|- | |- | ||
| <code>REPEAT_NOT</code> | | <code>REPEAT_NOT</code> | ||
− | | | + | | Don't repeat |
|- | |- | ||
| <code>REPEAT_SLOW</code> | | <code>REPEAT_SLOW</code> | ||
− | | | + | | Delayed repeat |
|- | |- | ||
| <code>REPEAT_FAST</code> | | <code>REPEAT_FAST</code> | ||
− | | | + | | Immediate repeat |
|} | |} | ||
It is not possible to specify key bindings with different repeat styles for the same action; if more than one <code>BIND</code> exists for the same action, the repeat style of the last <code>BIND</code> is used for all bound keys. | It is not possible to specify key bindings with different repeat styles for the same action; if more than one <code>BIND</code> exists for the same action, the repeat style of the last <code>BIND</code> is used for all bound keys. | ||
Line 128: | Line 168: | ||
* Characters like {{k|å}} aren't recognized when typed as {{k|alt}}-{{k|a}}. | * Characters like {{k|å}} aren't recognized when typed as {{k|alt}}-{{k|a}}. | ||
* The {{k|Command}} key is unrecognized by DF and can't be used as a modifier. | * The {{k|Command}} key is unrecognized by DF and can't be used as a modifier. | ||
− | |||
{{files}} | {{files}} | ||
{{Category|Mods}} | {{Category|Mods}} | ||
{{Category|Interface}} | {{Category|Interface}} |
Latest revision as of 00:34, 21 December 2022
This article was migrated from DF2014:Interface.txt and may be inaccurate for the current version of DF (v50.14). See this page for more information. |
v50.14 · v0.47.05 This article is about the current version of DF.Note that some content may still need to be updated. |
- See Controls for the default key binds.
Key bindings determine how the game responds to the user (you) pressing different keys on their keyboard, numberpad, laptop, whatever.
The game key bindings are stored in interface.txt. They can be configured in the Key Bindings section of the in-game options screen or by editing this file directly.
Each action can be bound to any number of keys, either by keyboard location or letter. They can also be given a repeat style which specified what happens when any of the bound keys are held:
Repeat Style | Behavior |
---|---|
Don't repeat | The action does not repeat at all; pressing the key performs the action exactly once, no matter how long it is held. |
Delayed repeat | The action repeats after a delay of KEY_HOLD_MS milliseconds.
|
Immediate repeat | The action repeats immediately. |
Changing key bindings in-game[edit]
When in-game, press Esc to open the options screen and select Key Bindings. This shows the various game mode/screen categories (and Macros).
Selecting one shows all of the bindable game commands in that category. On the left is a list of bindable commands and on the right are options to add bindings and change the action's repeat style. Use the left and right selection keys to move between them.
Use Backspace on a binding to remove it.
For example if you wanted to add 9 to "Select" command (odd, but your choice) you would then select the General category, press right on the first command(Select) and hit Enter on the "Add binding" option to open a key registration prompt and then press 9 and select whether you want to bind by position or by key and hit Enter or if you hit the wrong button Esc (or whatever you have set to "Main menu" or "Leave screen" keys) to abort.
Adding bindings does not remove any other binding that also uses this key. This is almost never what you want, so you'd then have to find any command that is also bound to your added key, or you'll be sending both commands every time.
Useful custom bindings[edit]
Scrolling without keypad[edit]
If you're on a laptop or using a restricted keyboard, using + and
* to scroll on some menus is inconvenient since it requires the Shift key. To scroll with -=[]
instead of -+/*
, add:
Category | Command | Key |
---|---|---|
General | Move secondary selector down | = |
General | Page secondary selector up | [ |
General | Page secondary selector down | ] |
Change z-level without shift[edit]
You can use the comma , and period ., rather than < and > (the same keys + Shift) for up/down z-levels, thus avoiding the need to use two hands/keys for this common action.
Add the following:
Category | Command | Key |
---|---|---|
General | Move view/cursor up (z) | , |
General | Move view/cursor down (z) | . |
Then remove the following to avoid clashing:
Category | Command | Key |
---|---|---|
Dwarf mode | Main: One-Step | . |
interface.txt[edit]
The file can be found in Dwarf Fortress\data\init\interface.txt
Default settings[edit]
Key syntax[edit]
A key bindings block has this structure:
[BIND:Action:Repeat_Style] [SYM:Modifiers:Key] [KEY:Key]
It is made of two parts:
- The
BIND
part, which defines what the key does, - And the
SYM/KEY
part, which defines which key the action is mapped to.
BIND[edit]
BIND
begins a block of key bindings for a specified action in the Key Bindings menu.
Syntax:
[BIND:Action:Repeat_Style]
Each BIND
is followed by a block of one or more key bindings (SYM
or KEY
; see below) terminated either by the next BIND
or by the end of file.
The repeat style is given as one of the following:
String | Repeat Style |
---|---|
REPEAT_NOT
|
Don't repeat |
REPEAT_SLOW
|
Delayed repeat |
REPEAT_FAST
|
Immediate repeat |
It is not possible to specify key bindings with different repeat styles for the same action; if more than one BIND
exists for the same action, the repeat style of the last BIND
is used for all bound keys.
Vanilla interface.txt already includes BIND
entries for all valid actions. It is possible to remove all key bindings for a given action by removing all SYM
and KEY
entries after the action's BIND
, and (optionally) removing the BIND
itself. This, however, can result in frequent warnings output to the terminal if the game wants to display a key binding for the action (e.g. ;: Movies in the Dwarf Mode side bar; one can mitigate this by closing the side bar with Tab).
SYM[edit]
SYM
is used for keys listed as By position in the Key Bindings menu.
Syntax:
[SYM:Modifiers:Key]
The modifiers are represented as the sum of their codes listed below:
Modifier | Value |
---|---|
Shift | 1 |
Ctrl | 2 |
Alt | 4 |
For example, [SYM:0:A]
represents a, [SYM:1:Enter]
represents Shift-Enter, and [SYM:6:Left]
represents Ctrl-Alt-←.
The key can be any letter or number, or can be listed by name. This is useful when typing the actual symbol would cause a syntax error (for example, [SYM:0:]]
and [SYM:0::]
cause errors instead of representing ] and :), or when the symbol isn't type-able (it's hard to insert a backspace character in a basic text editor without deleting something).
KEY[edit]
KEY
is a simpler version of SYM
, only allowing plain keys (no modifiers). These are listed as By letter in the Key Bindings menu.
Syntax:
[KEY:Key]
For example, [KEY:a]
represents the a key.
Unlike the above, the key must be given as an actual symbol. Entries such as [KEY:]]
and [KEY::]
work as one might expect, i.e., representing ] and :, respectively.
Differences between KEY
and SYM
[edit]
KEY
does allow special characters if they are able to be typed. For example, [KEY:%]
is equivalent to [SYM:1:5]
. Note that SYM
requires the key on the keyboard, while KEY
requires the letter generated.
Mac-specific[edit]
- Some keys unavailable on the keyboard (such as PgDown) can be generated with the fn key. Dwarf fortress sees these as independent keys; the fn key is essentially invisible to DF. There is no modifier code for fn.
- Characters like å aren't recognized when typed as alt-a.
- The Command key is unrecognized by DF and can't be used as a modifier.
Settings | |
---|---|
Gameplay settings | |
Log files | |
Other |