Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: JudasFm on Tue 10/02/2004 09:34:37

Title: Saving the game before quitting
Post by: JudasFm on Tue 10/02/2004 09:34:37
I want to add something to my game that prompts the player to save when the quit button is pressed, something like "Do you want to save your game?" and relevant buttons (yes/no) If they say yes, they're taken to the save screen, then when they've saved, the game quits, if no the game quits immediately.  I've tried a few times on my own but no luck.  Can someone please tell me the script I need and whereabouts it should go?
Thanks! :)
JudasFm
Title: Re:Saving the game before quitting
Post by: Phemar on Tue 10/02/2004 18:46:33

Create new gui. Name it PROMPTUSER
make it popup modal and set all buttons to run script

Add label Make it say "Do you first want to save game?"

Make 2 buttons "yes""no"

For yes button type:

SaveGameDialog ();
QuitGame (0);
}

For No button type:

QuitGame (1);

Hope this helps.

P.S. I'm assuming you know how to make a basic gui.

::Zor
Title: Re:Saving the game before quitting
Post by: JudasFm on Tue 10/02/2004 19:37:04
Thanks...I think that kind of worked.  I've got the script in place for the buttons but I still can't get the GUI to appear whenever the player clicks on Quit ???
Title: Re:Saving the game before quitting
Post by: Ishmael on Tue 10/02/2004 20:29:44
Set teh quit button to:

GUIOff(GUI); // if any needed
GUIOn(QUIT); // if the quit QUI is called "QUIT"
SetCursorMode(6): // set to the arrow pointer
Wait(1); // so that the screen gets to update
Title: Re:Saving the game before quitting
Post by: JudasFm on Tue 10/02/2004 21:53:15
Oh boy, it REALLY didn't like that one ??? Thanks anyway though; I think I'll have to go back to the drawing board (ie, a warning in the manual  ;))
Title: Re:Saving the game before quitting
Post by: Ishmael on Wed 11/02/2004 14:10:39
What do you mean it didn't like it?
Title: Re:Saving the game before quitting
Post by: JudasFm on Wed 11/02/2004 14:29:45
I mean it kept giving me error messages about the script when I tried saving it *is puzzled* Oh well...it's not too important; it's probably something I missed in the script/GUI.  Thanks for your help though; I'll keep playing around with it :)
Title: Re:Saving the game before quitting
Post by: AJA on Wed 11/02/2004 15:35:10
TK,
SetCursorMode(6);

;)
Title: Re:Saving the game before quitting
Post by: Ishmael on Wed 11/02/2004 20:53:39
Ooops... sorry... that happens to me all the time...