Confirmation dialog "quit game" problem

Started by Cookie_Wood, Fri 19/10/2018 14:45:59

Previous topic - Next topic

Cookie_Wood

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: ags
function Button3_OnClick(GUIControl *control, MouseButton button)
{
QuitGame(0);
}


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: ags
function Button3_OnClick(GUIControl *control, MouseButton button)
{
QuitGame(1);
}


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 :)

VampireWombat

#1
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.

Cookie_Wood

#2
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 ?

VampireWombat

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.

Cookie_Wood

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

Monsieur OUXX

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)
 

SMF spam blocked by CleanTalk