Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: td on Mon 28/08/2006 16:14:09

Title: Keyboard disable...
Post by: td on Mon 28/08/2006 16:14:09
I can't find answer on my question in AGS help and forum themes... I use gui with "POPup Modal" and if i press key SPACE - gui is visible, if i press SPACE again - gui is invisible. So in title screen i wanna disable this gui, but "Hide gui" function is not work with POPup modai i guess. How can i disable key press???

P.S. I use module :


function on_key_press(int keycode) {
if (keycode==32) {
  if (gui[1].Visible==true) {
    gui[1].Visible=false;
    return; } //"return" stops running any more functions
  else {
    gui[1].Visible=true;
    return; }
}
}
Title: Re: Keyboard disable...
Post by: Ubel on Mon 28/08/2006 16:48:51
function on_key_press(int keycode) {

if (player.Room == TITLE_SCREEN_ROOM_NUMBER) keycode = 0;

if (keycode==32) {
Ã,  if (gui[1].Visible==true) {
Ã,  Ã,  gui[1].Visible=false;
Ã,  Ã,  return; } //"return" stops running any more functions
Ã,  else {
Ã,  Ã,  gui[1].Visible=true;
Ã,  Ã,  return; }
}
}

I think adding that line will help. Just change TITLE_SCREEN_ROOM_NUMBER to the number of the room that you are using as a title screen.
Title: Re: Keyboard disable...
Post by: td on Mon 28/08/2006 18:34:24
Seems work!
REspect Pablo! :)