User Tools

Site Tools

Command disabled: register

client:keys

For keyboard usage see Movement and for keybinding the 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 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)1) String of FLAGS Command-Line

The keynro '0' will be always a '0' 2)
- 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 0x01N Used in normal mode
#define KEYF_FIRE 0x02F Used in fire mode
#define KEYF_RUN 0x04R Used in run mode
#define KEYF_MODIFIERS 0x073)A Mask for actual keyboard modifiers, not action modifiers
#define KEYF_EDIT 0x08E Line editor
#define KEYF_STANDARD 0x10S For standard (built in) key definitions
Newer
#define KEYF_NORMAL 0x01NUsed in normal mode
#define KEYF_FIRE 0x02FUsed in fire mode
#define KEYF_RUN 0x04RUsed in run mode
#define KEYF_EDIT 0x08ELine editor
#define KEYF_STANDARD 0x10SFor standard/built-in keybinds
#define KEYF_ALT 0x20LFor ALT key modifier
#define KEYF_META 0x40MFor Meta key modifier
#define KEYF_MODIFIERS 0x674)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

( [While parsing of the keys file5) , 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 w6) 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 compiling the client , a #define CLIENT_LIBDIR may be available to set a default client_libdir .

While parsing7) the keys file, lines beginning with the number sign # and starting with a new-line are ignored.

1) # <keynro> 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.
2) 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);
}
}
3) includes 01,02,04
4) includes 01,02,04,20,40
5) , 7) keys.c:parse_keybind_line()
6) which is not member of the default keys
client/keys.txt · Last modified: 2018/04/01 10:14 by karl