Scripting/Client/Functions/BindKey

Calls callback when the key goes down (BINDTYPE_DOWN) or up (BINDTYPE_UP). key is a KEY_* constant, a virtual-key integer, a one-character string ("H", "7") or a name ("SPACE", "F5", "CTRL"...). callback is a function name (string) or a function value; up to 4 extra arguments are passed to it. Several different handlers can share a key. Binds do not fire while the chat box is open.

Syntax

BindKey(key, type, callback [, arg1 .. arg4])

Arguments

Returns

bool (false on a bad key/arguments)

Example

function onScriptLoad()
{
	local result = BindKey( "X", 0, "myFunction" );
	MessagePlayer( "BindKey returned: " + result, player );
}

This sample was generated from the signature – adapt the values to your gamemode.

Section: Input

Categories: Client functions | Input