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
if (keycode=27) GUIOn(3);
,
if (keycode == 27) { GUIOn(3);
,
on_key_press (int keycode 27) GUIOn(3);
,
on_key_press (int 27) GUIOn(3);
,
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.
Have you tried the following.
on_key_press (int keycode) {
if (keycode == 27) GUIOn(3);}
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
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'
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
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.