Hide GUI and show when key pressed [SOLVED]

Started by magintz, Wed 05/10/2005 19:45:34

Previous topic - Next topic

magintz

Has anyone got any pointers how I can hide the GUI and make it appear when a key is pressed. The only thing that comes to mind is if any key is pressed, that key is stored into a variable, the GUI turns on and then that variable is placed in the textbox. This would work, but how would I have an "if any key A-Z is pressed"?
When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

monkey0506

#1
Code: ags
// main global script
int timer = 0;

// on_key_press
if ((keycode >= 65) && (keycode <= 90)) {
  gParsergui.Visible = true;
  /* set text on GUI...something like
  Parsertextbox.Text = String.Format("%s%c", Parsertextbox.Text, keycode);
  perhaps? */
  timer = 10 * GetGameSpeed(); /* wait 10 seconds */
  }

// rep_ex
if (timer > 0) timer--;
else gParsergui.Visible = false;


I hope you will find this useful. ;)

Unlike my previous attempt, in which I made a complete fool outta myself. :=

magintz

When I was a little kid we had a sand box. It was a quicksand box. I was an only child... eventually.

SMF spam blocked by CleanTalk