Posted By: Inestical
Easy keymapping - 03/12/08 09:06
People nowdays need to be able to modify the key mapping, so using key_w, key_s, etc. will not be tolerated. That's why one should use strings or other method for checking which key was pressed.
No credits required, but note that this was also partially Kiyaku's idea.
For this I made this simple script:
Code:
usage
Code:
Key mapping can be found in the manual. Look for function "key_for_str" for complete list of accepted strings. AFAIK it's just key_blaa without the "key_".
Edit: This should work on mouse, but I'm not completely sure.
No credits required, but note that this was also partially Kiyaku's idea.
For this I made this simple script:
Code:
// Key mapping
string keyForward = "w";
string keyBackward = "s";
string keyStrafeLeft = "a";
string keyStrafeRight = "d";
string keyRun = "shiftl";
string keyJump = "space";
string keyStrafe = "ctrll";
function getKey(key)
{
return (key_pressed(key_for_str(key)));
}
usage
Code:
if(getKey(keyForward))
{
//Do Stuff
}
// returns true/1/on wether button associated to forward movement is pressed
Key mapping can be found in the manual. Look for function "key_for_str" for complete list of accepted strings. AFAIK it's just key_blaa without the "key_".
Edit: This should work on mouse, but I'm not completely sure.