This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
client:keys [2018/04/01 05:23] karl created |
client:keys [2024/12/25 18:36] (current) saru added link to bind command |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | For keyboard usage see :?: and for keybinding the [[:player_commands#bind]] command and topic [[keybinding]] . | + | For keyboard usage see [[guides:playing_crossfire#Movement]] and for keybinding the [[:player_commands#bind]] command and topic [[keybinding]] . |
- | ====== Keys Configuartion File ====== | + | ====== Keys Configuration File ====== |
This page is about the **keys** file inside the user's HOME directory **.**[[crossfire]] . | 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, \\ | 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, \\ | + | and **if** the user never would use the [[:player_commands#bind]] and [[:player_commands#unbind]] commands, \\ |
then would that file likely never exist there. | then would that file likely never exist there. | ||
Line 14: | Line 16: | ||
This keys file consists of lines as | This keys file consists of lines as | ||
- | |KeyName or KeySym|| 0 || String of FLAGS || Command-Line | | + | |KeyName or KeySym|| keynro(0)((# <keynro> will typically be the keycode for that key. While \\ |
- | Where the '0' will be always a '0' \\ | + | # 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, \\ | - likely because some GTK+ functions probably need some value there, \\ | ||
never tried to set this '0' manually to something else - \\ | never tried to set this '0' manually to something else - \\ | ||
and the **FLAGS** are | and the **FLAGS** are | ||
- | |#define KEYF_NORMAL |0x01|// 'N' Used in normal mode //| | + | == Older == |
- | |#define KEYF_FIRE |0x02|// 'F' Used in fire mode //| | + | |#define KEYF_NORMAL |0x01^N|// Used in normal mode //| |
- | |#define KEYF_RUN |0x04|// 'R' Used in run mode //| | + | |#define KEYF_FIRE |0x02^F|// Used in [[:firekey|fire mode]] //| |
- | |#define KEYF_EDIT |0x08|// 'E' Line editor //| | + | |#define KEYF_RUN |0x04^R|// Used in [[:runkey|run mode]] //| |
- | |#define KEYF_STANDARD |0x10|// 'S' For standard/built-in keybinds //| | + | |#define KEYF_MODIFIERS |0x07((includes 01,02,04))^A|// Mask for actual keyboard modifiers, not action modifiers //| |
- | |#define KEYF_ALT |0x20|// 'L' For ALT key modifier //| | + | |#define KEYF_EDIT |0x08^E|// Line editor //| |
- | |#define KEYF_META |0x40|// 'M' For Meta key modifier //| | + | |#define KEYF_STANDARD |0x10^S|// For standard (built in) key definitions //| |
- | |#define KEYF_MODIFIERS |0x67|// 'A' Mask for actual keyboard modifiers, not action modifiers //| | + | |
+ | == 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 <hi>**!**</hi> 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 | ||
+ | <WRAP lo>( [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 )</WRAP> | ||
+ | |||
+ | ---- | ||
+ | ==== Example Keys File == | ||
In this example using a GTK-1 client v1.11.0 , \\ | In this example using a GTK-1 client v1.11.0 , \\ | ||
- | the small letter [[#w]] is bound to \\ | + | 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'' \\ | ''apply -u rod of create earth wall; apply -a rod of create earth wall'' \\ | ||
- | to forcibly apply and ready that item \\ | + | to forcibly apply and ready that item, \\ |
- | and the newly created keys file looks as this : | + | and the newly created keys file looks as this, \\ |
+ | including all the Standard Keys to be found in //client/common/def-keys.h// : | ||
<code conf> | <code conf> | ||
Line 117: | Line 162: | ||
</code> | </code> | ||
+ | ---- | ||
+ | |||
+ | ===== 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. |