Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: bx83 on Mon 05/06/2017 13:43:13

Title: I cannot exit the game clicking the exit icon - why?
Post by: bx83 on Mon 05/06/2017 13:43:13
Hi,

I have a GUI with the icon bar in it; the bExit button runs a script, which, from the other buttons, I assume is bExit_Click:


...
function btnIconSave_Click(GUIControl *control, MouseButton button)
{
  show_save_game_dialog();
}

function btnIconLoad_Click(GUIControl *control, MouseButton button)
{
  show_restore_game_dialog();
}

function bExit_Click(GUIControl *control, MouseButton button)
{
  QuitGame(1);
}
...


This is all in globalscript.

This is the *only* button that doesn't work - clicking it just make the iconbar invisible.
All other *exactly the same buttons* work.

I've tried using breakpoints next to the 'QuitGame(1)', and it never reaches it.

What do I do?

Title: Re: I cannot exit the game clicking the exit icon - why?
Post by: arj0n on Mon 05/06/2017 13:47:00
Maybe the OnClick event in the GUI properties is empty or pointing wrong?
Title: Re: I cannot exit the game clicking the exit icon - why?
Post by: bx83 on Wed 07/06/2017 03:18:54
Nope, tried renaming it, deleting the original function, etc. :/
Title: Re: I cannot exit the game clicking the exit icon - why?
Post by: Mandle on Wed 07/06/2017 03:58:46
Perhaps check through all the properties of the button? Is it set as "unclickable" or is it's Z-order hiding it behind another control? I don't remember off the top of my head all the properties, but maybe there's a conflict in there?
Title: Re: I cannot exit the game clicking the exit icon - why?
Post by: Slasher on Wed 07/06/2017 04:43:56
If you are using the default IconBar then the Exit button is named btnIconExit.

The properties for this button should be: RunScript..

Click it's Events button and add (if not already):

Code (ags) Select

function btnIconExit_Click(GUIControl *control, MouseButton button) {
QuitGame(1); // Will bring up the Quit Yes/No.
QuitGame(0); // Will quit immediately.
}