Quote:
Originally Posted by Gambet
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.
|
Eh, I was more providing the values he could use(0-3) rather than implying he should loop... which he should.
As for arrows vs directional... probably, but it should always be applied to the customization of the player. If the player chooses to use WASD as their directional keys, this should also apply to whatever GUI's the player is using, so really directional translates into arrow as the player customizes them to basically be such(even if they're regular keys instead of the arrow keys). Developers need to keep that in mind.