Hi
I am trying to disable the keyboard for every room.
The below code in each room works but does not stop Alt + x, though it does disable Esc, F save, F Load etc.
In each Room I have:
function on_key_press(eKeyCode k) {
// kill all keyboard functionality
ClaimEvent();
}
Even tried this Top of Global:
bool kb_on = true;
and with this in Global:
function on_key_press(eKeyCode keycode)
{
if (!kb_on) // and with if (kb_on)
{
ClaimEvent();
return;
Can you help?
Cheers
You can't disable Alt-X. It's built into the engine as a failsafe so that it's always possible to quit in case your game locks up.
QuoteThe keycode for Abort Game, which allows the you to quit even if your script is stuck. Default 324 (Alt+X).
So if you disable it then if you game gets stuck, people have to use alt ctrl delete or some other way.
Apart from pointing that, your code seems to work, though just keeping all the stuff on a global script or a module script and having only one instance of the
on_key_press function is definitely the way I would go. Just a global boolean variable and on instance of keypress.
function on_key_press(eKeyCode keycode)
{
if (kb_on)
{
//rest of script ecc inside the if
}
}
Or
if (!kb_on) return; // exit the function
You can disable Alt-X by changing the value of game.abort_key.
If you do that though, please mention it when you publish the game so people know not to download it.
For maximum troll points, set game.abort_key to -1, completely disabling it.
Hi
thanks for your answers guys.
It was more of a quest to find an answer than to actually use it so no total Troll points monkey ;D
It is fine as it is with alt + x to quit.
I do have a visual Quit option available during the game.
Thanks again.
The benefit of the abort key is that it is still functional even when other interface items (such as keypresses and button clicks) may not be. You can change the abort key if you want, but document it clearly if you do so. Disabling it completely is just stupid (unless it's an Oceanspirit Dennis game).
I'm aware you said already that you're not planning to disable it, but Khris' comment may have come across the wrong way, so I wanted to clarify that as long as you make it known what the abort key is you should still be fine (even if you do choose to change it for some reason).
Yeah, I just wanted to express how stupid I find it to take away the only failsafe for a hanging game. This is were I think the line between design choices and being a control freak is crossed.
I briefly considered to post something along the lines of "if you don't know how to disable it, you probably shouldn't do it in the first place".
Khris:
It was a thought I had, but opted out for fail-safe reasons as mentioned (after consideration).
I overlooked Abort because I was looking at 407(Alt) + X.
In game design you do need an exit, period. I do have an exit sign visible and of course good old Alt + X is available as well.
I appreciate your words of wisdom for future reference.
Monkey:
Likewise as with Khris, thanks.
OSP: How to script crap in the best possible way.
Don't steal any crap ideas from us minor urchins :D
Thanks guys
Quote from: Khris on Sat 26/11/2011 21:59:20
Yeah, I just wanted to express how stupid I find it to take away the only failsafe for a hanging game.
Shouldn't Ctrl-Alt-End always work? It doesn't help if the player is not familiar with AGS or didn't read the game's documents even if it's mentioned.