v50 Steam/Premium information for editors
  • 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.
This notice may be cached—the current version can be found here.

Difference between revisions of "Interface.txt"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(Undo revision 263627 by 216.46.157.49 (talk))
Tag: Undo
Line 128: Line 128:
 
* 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}}

Revision as of 02:06, 18 October 2022

This article is about the current version of DF.
Note that some content may still need to be updated.

File

Folder-orange.svg Dwarf Fortress

Folder.svg data

Folder.svg init

Text-x-generic.svg interface.txt

See Controls for the default key binds.

The game key bindings are stored in interface.txt, they can be configured in the 'Key Bindings' section of the game settings or by editing this file directly.

Key bindings determine how the game responds to the user (you) pressing different keys on their keyboard, numberpad, laptop, whatever.

Changing Key bindings

To change the key bindings through the in-game interface. Start the game, then hit Esc - using the up/down arrows, highlight "Key Bindings" and hit Enter. This then shows the various game mode/screen categories (and Macros) selecting one shows all of the bindable game commands in that category.

On the left you see you see list of bindable commands and on the right side you see "Add binding" option the "Don't repeat", "Delayed repeat" and "Immediate repeat" after that refer to what happens when you hold down the key, the one in red is selected and finally the ones starting with "By position: " and "By letter: " are the currently set binds of the command.

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. However, you'd then have to find any action that also is controlled by 9, or you'll be sending both commands every time you hit that key. Changes should be planned carefully with that last in mind. To remove the command you added select the "By letter: 9" or "By position: 9" or "By position: Numpad 9" on the select command with arrow keys and press backspace (your "String: Backspace" key) to delete the keybind.

Additional commands can be viewed by scrolling using the up/down arrows, or by screen using the page up/page down keys (unless you've changed those).

Additional Up/Down Z-Level Keys

One of the more common key binding changes, is to 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.

You'll need to add the following in the general category.

Move view/cursor up (z)                By position/letter: ,
Move view/cursor down (z)              By position/letter: .

Then, also be sure remove the following entry from the dwarf mode,

Main: One-Step                          By letter: .

This avoids advancing the game one step each time you move the game view "down" one z-level, since both would be controlled by the . key. But advancing one step would become unbound so you could use < or > or any other unused key for that.


Some players may feel more comfortable by switching the PgDn/PgUp keys to control moving between z-levels, though this is not recommended should you use the numpad for movement.

Laptop Bindings

40d version required some editing to use non-numpad versions of keys but this is no longer necessary so there are no longer any changes possible that could make laptop keyboards easier to use for playing DF.

interface.txt

The file can be found in Dwarf Fortress\data\init\interface.txt

Default settings

Key syntax

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

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:

Repeat Style Behavior
REPEAT_NOT The action does not repeat at all; pressing the key performs the action exactly once, no matter how long it is held.
REPEAT_SLOW The action repeats after a delay of KEY_HOLD_MS milliseconds.
REPEAT_FAST The action repeats immediately.

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

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

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

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

  • 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