Hullo.
I was wondering how you would go about disabling all key presses in certain rooms. For example, my menu (Room 0) shows the GUIs when I press the keyboard shortcuts, but I don't want them to. Then, I want to enable all of the shortcuts again when the player enters the first room (Room 1). Any suggestions?
Check out ClaimEvent in the manual.
Based off of your other thread (which you could've posted this question in, since it's the same topic) you should put a code something like this in your room script:
function on_key_press (eKeyCode keycode) {
if (keycode == eKeySpace) ClaimEvent();
}
(sorry there's not much of an explanation. I'll return later, or just wait for someone else to reply)
~Trent
Thank you very much, I've got it working fine. I thought about putting it in my original thread, but wasn't quite sure what to do so I made a new one. I'll try and stop over-posting the forums from now on :) Thanks!
EDIT: Is there any way to enter all the key codes in the same if function? Or do you have to type them all in separately like this?
In the global on_key_press, add this line at the top of the function:
if (player.Room == 5) return; // disable all key presses in room 5
Now I don't have to type out all of the keys. :) Thanks!