Scripting/Squirrel/Functions/BindKey
This wiki is using an old backup from 2020
Some information may be old/missing
Syntax
BindKey( bool:press, key, args..., args2...)
Arguments
bool:press This is the bool for the key function to be called once the key is 'pressed' or 'released'.
key The key you bind at, you can get key codes from Key Codes
args... You can have this 0.
args2... You can have this 0.
Example
The following example will bind the left-shift key for player and send him a message when a player press that key:
function onScriptLoad()
{
lshift <- BindKey(true, 0xA0, 0, 0);
}
function onKeyDown( player, key )
{
if( key == lshift )
{
MessagePlayer( ">> You pressed the left shift key", player );
}
}
Notes
Call onScriptLoad, onKeyDown were used in this example. More info about them in the corresponding pages.