Quote:
Originally Posted by DustyPorViva
PHP Code:
function onKeyPressed() {
if (keydown(0-3)) {
player.chat = "arrow key pressed";
}
}
keydown(int) can be used along with onKeyPressed() to detect default key configurations.
|
That's a bit vague for someone that might not be familiar with loops since they wouldn't realize that they would benefit from using one in this case:
PHP Code:
function onKeyPressed() {
for (temp.key = 0; temp.key < 4; temp.key++) {
if (keydown(key)) {
player.chat = "directional key pressed";
}
}
}
Stuff like this has been posted before, possibly in multiple threads, people should really use the search function, they would get answers to their questions much faster.
EDIT: It's probably better to say 'directional key pressed' instead of 'arrow key pressed' since that would imply that the script would only trigger when you press an arrow key, when in fact it would trigger whenever you pressed any of the directional keys that you have set in your F3 options.