For keyboard usage see [[guides:playing_crossfire#Movement]] and for keybinding the [[:player_commands#bind]] command and topic [[keybinding]] . ====== Keys Configuration File ====== This page is about the **keys** file inside the user's HOME directory **.**[[crossfire]] . ===== Creation of the Keys file == When the [[:client]] starts the first time, then there will be no "keys" file, \\ and **if** the user never would use the bind and [[:player_commands#unbind]] commands, \\ then would that file likely never exist there. The file gets created when the first key-binding is committed. \\ Even if it is just one command(line), a whole bunch of key bindings \\ will be printed to the **keys** file. This keys file consists of lines as |KeyName or KeySym|| keynro(0)((# will typically be the keycode for that key. While \\ # keysyms are defined to work across different OS X-servers, keycodes are \\ # X-server/machine specific. Keycodes are only needed because some keyboards \\ # (sun's type 5 for one) have keys with no corresponding keysym.)) || String of FLAGS || Command-Line | The keynro '0' will be always a '0' (( keys.c:get_key_info() if (save_mode) { \\ if(key->keysym == NoSymbol) { \\ snprintf(buf, sizeof(buf), "(null) %i %s %s", 0,buff, key->command); \\ } \\ else { \\ snprintf(buf, sizeof(buf), "%s %i %s %s", gdk_keyval_name(key->keysym), 0, buff, key->command); \\ } \\ } )) \\ - likely because some GTK+ functions probably need some value there, \\ never tried to set this '0' manually to something else - \\ and the **FLAGS** are == Older == |#define KEYF_NORMAL |0x01^N|// Used in normal mode //| |#define KEYF_FIRE |0x02^F|// Used in fire mode //| |#define KEYF_RUN |0x04^R|// Used in run mode //| |#define KEYF_MODIFIERS |0x07((includes 01,02,04))^A|// Mask for actual keyboard modifiers, not action modifiers //| |#define KEYF_EDIT |0x08^E|// Line editor //| |#define KEYF_STANDARD |0x10^S|// For standard (built in) key definitions //| == Newer == |#define KEYF_NORMAL |0x01^N|//Used in normal mode //| |#define KEYF_FIRE |0x02^F|//Used in fire mode //| |#define KEYF_RUN |0x04^R|//Used in run mode //| |#define KEYF_EDIT |0x08^E|//Line editor //| |#define KEYF_STANDARD |0x10^S|//For standard/built-in keybinds //| |#define KEYF_ALT |0x20^L|//For ALT key modifier //| |#define KEYF_META |0x40^M|//For Meta key modifier //| |#define KEYF_MODIFIERS |0x67((includes 01,02,04,20,40))^A|// 'A' Mask for actual keyboard modifiers, not action modifiers //| ---- ==== Special Keybinding Line == Special key bound lines start with an exclamation mark **!** as very first char of the line. \\ The special commands are : * altkey0 ( newer clients ) * altkey1 ( newer clients ) * commandkey - default bound to Quote **'** * completekey - :?: what does it do :?: * firekey0 * firekey1 * metakey0 ( newer clients ) * metakey1 ( newer clients ) * nextkey * prevkey * runkey0 * runkey1 ( [While [[#parsing of the keys file]]((keys.c:parse_keybind_line() )) , lines beginning with a number sign '#' and starting with a new-line are ignored ) ---- ==== Example Keys File == In this example using a GTK-1 client v1.11.0 , \\ the small letter [[#w]]((which is not member of the default keys)) is bound to \\ ''apply -u rod of create earth wall; apply -a rod of create earth wall'' \\ to forcibly apply and ready that item, \\ and the newly created keys file looks as this, \\ including all the Standard Keys to be found in //client/common/def-keys.h// : Tab 0 NS rotatespells 1 Tab 0 FRS rotatespells -1 quotedbl 0 AES say plus 0 NFS rotateshoottype comma 0 AS take minus 0 NS rotateshoottype -1 period 0 NS stay fire question 0 AS help at 0 AS pickup A 0 NS apply inventory A 0 FRS apply B 0 AS southwest E 0 NS examine inventory E 0 FRS examine H 0 AS west J 0 AS south K 0 AS north L 0 AS east N 0 AS southeast Left 0 AS west Left 0 AS west S 0 AS brace Up 0 AS north Up 0 AS north U 0 AS northeast Right 0 AS east Right 0 AS east Down 0 AS south Down 0 AS south Y 0 AS northwest a 0 NS apply a 0 FRS apply b 0 AS southwest d 0 NS disarm e 0 NS examine inventory e 0 FRS examine h 0 AS west j 0 AS south k 0 AS north l 0 AS east n 0 AS southeast s 0 AS search t 0 AS ready_skill throw u 0 AS northeast == w == w 0 A apply -u rod of create earth wall; apply -a rod of create earth wall x 0 NFS show y 0 AS northwest KP_Home 0 AS northwest KP_Left 0 AS west KP_Up 0 AS north KP_Right 0 AS east KP_Down 0 AS south KP_Prior 0 AS northeast KP_Next 0 AS southeast KP_End 0 AS southwest KP_Add 0 AS rotateshoottype KP_Subtract 0 AS rotateshoottype - KP_1 0 AS southwest KP_2 0 AS south KP_3 0 AS southeast KP_4 0 AS west KP_5 0 AS stay KP_6 0 AS east KP_7 0 AS northwest KP_8 0 AS north KP_9 0 AS northeast F27 0 AS northwest F28 0 AS north F29 0 AS northeast F30 0 AS west F31 0 AS stay F32 0 AS east F33 0 AS southwest F34 0 AS south F35 0 AS southeast ---- ===== Parsing of the Keys file == When the client starts, it checks for environmental variables \\ CFCLIENT_LIBDIR and CF_DATADIR . \\ :!: These variabes are not named "understandable" \\ like CF_CLIENT_LIBDIR and CF_CLIENT_DATADIR :!: While the CF_DATADIR is used for theme and glade files, \\ the **CFCLIENT_LIBDIR** is only used to look for a file named **def-keys** , \\ which is included in the source code, but probably not in pre-packaged \\ binary archives of OS distributions; since make install in the source code \\ does not automatically install some {prefix}/lib/crossfire-client/def-keys file. \\ :!: When [[client_compiling|compiling the client]] , a #define CLIENT_LIBDIR may be available to set a default //client_libdir// . While parsing((keys.c:parse_keybind_line() )) the keys file, lines beginning with the number sign **#** and starting with a **new-line** are ignored.