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?
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!
Now you're being silly. Conchie was just my imaginary friend!
Quote from: SSH on Thu 16/09/2004 17:37:34
Now you're being silly. Conchie was just my imaginary friend!
Oh! :)
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?
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.