OblivionSkull21
Member
I'm currently working on key bindings for the controls in my game.
It works fine, and I allow the player to bind most keys, but there's some keys I don't want to be binded (windows key, scroll lock, etc.)
I have a huge list of what each key's keycode translates to, which is stored in an array. Here's a short snippet:
I want to add an extra check before a key can be binded that makes sure the array with that keycode exists, and if it doesn't, then to deny the player that key binding. So lets say the keycode for some key is 41, but there's no t_key[41] anywhere... I would want the script to check for that. I tried using is_undefined:
But this isn't working, I just get an error saying the array is out of range. Is there any way to check if an array/variable has been set/exists?
It works fine, and I allow the player to bind most keys, but there's some keys I don't want to be binded (windows key, scroll lock, etc.)
I have a huge list of what each key's keycode translates to, which is stored in an array. Here's a short snippet:
Code:
t_key[37] = "LEFT"
t_key[38] = "UP"
t_key[39] = "RIGHT"
t_key[40] = "DOWN"
Code:
if !is_undefined(t_key[keyboard_lastkey]){
//insert key binding code here
}