Index       Keyboard

trap_Key_IsDown

Description

In the Q3 source it is used twice - once on level load and in G_Spawn where it is called whenever an entity is created.

Prototype

    qboolean trap_Key_IsDown(
        int keynum
    );

Parameters

Remarks

The values of keynum range from 0 to 255, inclusive.
For the most part, a key's keynum corresponds to its character's ASCII value (e.g. the 'A' key is 65).
I have a list of keynames used by the bind command with their keynums which I may append at a later date.
In the meantime, if you want to know them now, you can do this:

Create a keynums.cfg with a pattern like:
bind 0x00 Key 0x00
bind 0x01 Key 0x01
...
bind 0xfe Key 0xfe
bind 0xff Key 0xff

(case matters for the hex values, and a scripting language to automate this really helps)

Back up your q3config.cfg, run Q3, "/exec keynums.cfg; bindlist; condump keynums.txt; quit"

In the file "keynums.txt" you should now have lines like:
UPARROW "Key 0x84"

There's your keynum list.

Return value

Returns qtrue if the indicated key is held down, qfalse if not held down (released).

See also

Author(s)

PhaethonH


QuakeIII trap calls reference