Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: T.Hi on Wed 14/03/2012 22:28:59

Title: Revisiting Quit Game Scripting
Post by: T.Hi on Wed 14/03/2012 22:28:59
I've been searching the boards for the last hour or so and still don't have the answer to my question, as alot of the information is for older versions than the 3.2 version I have...

I HAVE figured out how to create a Quit GUI with buttons and - presumably - I have the buttons linked to the correct scripts ("QuitGame(0);" to quit and "gQuit.Visible = false;" to continue, right?), but I can't get the GUI to come up! When I test the game, it keeps bringing up the default one. So I copied the script  instructions for the default quit and renamed it, changing "btnQuit_OnClick" to "btnQuitYN_OnClick" and then I pointed the Quit instruction on the Panel to run btnQuitYN. Now when I try to test the game, I get the following error:
"GlobalScript.asc(200): Error (line 200): Undefined token 'buttons'" and I'm afraid to go messing around with that line lest I really make matters worse!

Please help, as I'm totally new and have just been stumbling my way up to this point; I HAVE tried to learn scripting but this so-called "simple language" is unimagineably above my head.   :'(
Title: Re: Revisiting Quit Game Scripting
Post by: NickyNyce on Wed 14/03/2012 22:39:27
I found this stashed in my notes, I had the same question.

Create a new custom quit GUI.
Then Go to the global script and look for this line:
  if (keycode == eKeyCtrlQ)  QuitGame(1);   // Ctrl-Q

Change the action part (QuitGame(1)) in to showing the new GUI.
Something like this:
  if (keycode == eKeyCtrlQ)  g<newguinamehere>.Visible=true;   // Ctrl-Q
(where <newguinamehere> is the name of your new GUI.)

Now, when pressing CTRL-Q ingame, the new GUI is shown in stead of the standard dialog.

Hope this helps
Title: Re: Revisiting Quit Game Scripting
Post by: T.Hi on Wed 14/03/2012 22:44:13
A-aaaaaaaaaah. Got it. Thanks so much, I'll do that.   :)