GUI pop up at ESC

Started by HillBilly, Sun 08/02/2004 18:59:24

Previous topic - Next topic

HillBilly

Right, I've been using the last HOUR on trying to figure out something that should be a easy code. I want that GUI 3 (MENU) to show up when you press ESC. I've tried
Code: ags
if (keycode=27) GUIOn(3);
,
Code: ags
if (keycode == 27) { GUIOn(3);
,
Code: ags
on_key_press (int keycode 27) GUIOn(3);
,
Code: ags
on_key_press (int 27) GUIOn(3);
,
Code: ags
on_key_press (27) GUIOn(3);
and I tried to combine these in all kinds of various way, but everything i try to test the game, it comes error messages. Usally something like
QuoteExpected ;
,
Quote*somethings wrong* keycode
and so on. Anybody know this code correctly?

God, I feel so stupid.  

Barcik

Have you tried the following.

on_key_press (int keycode) {
if (keycode == 27) GUIOn(3);}
Currently Working On: Monkey Island 1.5

Ishmael

I'd just add to the original on_key_press:

if (keycode==27) {
if (IsGUIOn(3)==0) GUIOn(3);
else GUIOff(3);
}

to make it toggleable with ESC
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

HillBilly

Quote from: TK on Sun 08/02/2004 19:26:07
I'd just add to the original on_key_press:

if (keycode==27) {
if (IsGUIOn(3)==0) GUIOn(3);
else GUIOff(3);
}

to make it toggleable with ESC

When i do that, i get the error I've got all night:

QuoteError (line 102): undefined symbol 'keycode'

Dorcan

function on_key_press(int keycode) {

  if (keycode==27) {
    if (IsGUIOn(3)==0) GUIOn(3);
    else GUIOff(3);
  }

}

If it still doesn't work, you must have made a syntax mistake somewhere else

HillBilly

Ah, there we go. Problem was i was inserting the code at the wrong place. I had to open "Global script" to edit it, not "edit script" in the GUI.

SMF spam blocked by CleanTalk