GUI not working

Started by Oz, Thu 16/09/2004 16:55:56

Previous topic - Next topic

Oz

Okay,

On the main (title) screen, I want a little bar with three buttons:

[load game] - [quit game] - [new game]

I've created a GUI for this in the GUI editor with three buttons each linked to the script ("run script").

On the main screen, I call the GUI using GUIOn(3); and it appears correctly. I've created a script for the quit button which is as follows:

    if (interface == 3) { //the custom GUI
    if (button == 2) { //the quit button
    QuitGame(0); //quit game
      }
    }

I've added this to the "#sectionstart interface_click" section in the global script, so it runs under the function "interface_click(int interface, int button)".

The problem is that when I click the quit button, nothing happens. The GUI is apparently active because the rollover images for the buttons work.

Any ideas as to what might be wrong?
Diversity is divine!

Oz

Conchie helped me out with this one. The solution was to put the script for the quit button at the top of the "interface_click" section (instead of at the bottom). I don't quite understand why the positioning of the code matters. Can someone explain this?

Thanks Conchie!
Diversity is divine!

SSH

Now you're being silly. Conchie was just my imaginary friend!
12

Oz

Quote from: SSH on Thu 16/09/2004 17:37:34
Now you're being silly. Conchie was just my imaginary friend!

Oh! :)
Diversity is divine!

Albert Cuandero

#4
QuoteÃ,  I don't quite understand why the positioning of the code matters

Maybe just to make sure you didn't place this interface script within another interface script unintentionaly?

Why not ask Conchie himself? Or would that upset Mumsie?
int do_you_like_me;
if (do_you_like_me == 1) Display ("You can call me Al");
else {}

Mr Flibble

Is it possible you had an irregular assortment of these fella's  }?
Cos if you had too many } then the code you added at the end you would be skipped. I know because it happened to me.
Ah! There is no emoticon for what I'm feeling!

SMF spam blocked by CleanTalk