Adventure Game Studio | Forums

AGS Support => Beginners' Technical Questions => Topic started by: Cookie_Wood on 19 Oct 2018, 14:45

Title: Confirmation dialog "quit game" problem
Post by: Cookie_Wood on 19 Oct 2018, 14:45
Hi folks !

First of all, I apologize if I don't make myself totally clear. English is not my mother tongue.

I'm working on my very first game on AGS, so I'm what we might called "a big newbie". I'm using the LW BASS template which is great ! I only have one big problem with it that i'm not able to solved by myself...

I created some GUI's (save, load, pause etc...) on which there's some buttons including a "Quit Button".

When I script like this :

Code: Adventure Game Studio
  1. function Button3_OnClick(GUIControl *control, MouseButton button)
  2. {
  3. QuitGame(0);
  4. }

The game is just quitting without any confirmation dialog (Are you sure you want to quit? Yes, No")

Which is totally normal BUT, when I script like this :
Code: Adventure Game Studio
  1. function Button3_OnClick(GUIControl *control, MouseButton button)
  2. {
  3. QuitGame(1);
  4. }

There's a very ugly grey "by default" confirmation dialog that open and I really can't find anywhere on my project tree where I can custom that with my own background image and button...etc... Is that "hard-coded" or somethhing like this ?

Where can I set that default confirmation dialog ? Because I really don't want the game to close directly even if this would be solving my problem^^

Thanks :)
Title: Re: Confirmation dialog "quit game" problem
Post by: VampireWombat on 19 Oct 2018, 15:07
The "ugly gray" is hard coded in. As well as the default save and restore GUIs.

What you need to do is create a new Gui with 2 buttons. One to confirm quit and the other to cancel. Use QuitGame(0); for the confirm button and gQuit.visible=false (or whatever you name the gui) for the cancel. After that you can customize it however you want.
Title: Re: Confirmation dialog "quit game" problem
Post by: Cookie_Wood on 19 Oct 2018, 16:15
Hi VampireWombat :)

Thank you for your quick answer !

Actually, I did create my own "gConfirm" GUI with buttons, but they are both displaying at the same time when I try to Quit ! Mine and the hardcoded one... I just want mine to be displayed :'(
What I am missing ?
Title: Re: Confirmation dialog "quit game" problem
Post by: VampireWombat on 19 Oct 2018, 16:23
Sounds like you have QuitGame(1); in your code somewhere. Remove that and make sure that QuitGame(0); is only used when pushing the confirm button on your GUI.
Title: Re: Confirmation dialog "quit game" problem
Post by: Cookie_Wood on 19 Oct 2018, 17:19
Ok, thank you so much. :grin:

That was very dumb...I found out where was my problem.

Sorry for the disturbance, I will think a little bit more before asking something here... :-D
Title: Re: Confirmation dialog "quit game" problem
Post by: Monsieur OUXX on 22 Oct 2018, 14:08
We should really improve all the templates (BASS, etc.) to include custom, clean confirmation GUIs and fonts by default. The hard-coded stuff must go! (roll) (that's just my opinion)