Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Gemmalah on Tue 02/12/2003 21:58:11

Title: creating my own save/load gui
Post by: Gemmalah on Tue 02/12/2003 21:58:11
I am making custom save/load menus.
I have been reading through the manual and cannot work out how to make the game save muliple times or how to load it back again.

I have used GetTextBoxText to get a name for the file.
SaveGameSlot needs this input so i am using that but it also asks for a slot to save it to.
Does this mean that i have to do this multiple times each with a different slot number? perhaps using boxes to represent different slot (like playstaion memory cards)
Also the RestoreGameSlot asks for a single integer, do I have to do this multiple times also?

I hope to have this all triggered by pressing a Save or Load button on the gui like in proffesional games.

If it helps this is what i have so far
if (interface == SAVE)
{
 if (button == 0){
   SetTextBoxText (SAVE, 3, 1,"");
   GUIOff (3);}
 else if (button == 1){
   string input
   GetTextBoxText (SAVE, 1, input);

also a Text box and a list box (is this what is required?
thanks alot Gem
Title: Re:creating my own save/load gui
Post by: Proskrito on Tue 02/12/2003 22:20:39
Look at this tutorial about Save/Load GUIs in the GAC page:

http://atticwindow.adventuredevelopers.com/tutorials.php?id=1

Hope it helps :)
Title: Re:creating my own save/load gui still stuck
Post by: Gemmalah on Wed 03/12/2003 16:58:08
Thanks that helped a bit (is there a page where tutorials are stored?)
i'm still stuck. my save gui won't save and load gui won't cancel. heres the script.

if (interface == SAVE)
{
 if (button == 0){
   SetTextBoxText (SAVE, 1,"");
   GUIOff (3);}
 else if (button == 1){
   string text;
   int index;
   SetTextBoxText (3,1,"");
   ListBoxSaveGameList (3,1); //Count how many save games there Are
   index=ListBoxGetNumItems (3,1);
   if (index>4){
     Display ("You have too many save files, you must overwrite a previous saved game");
     index=ListBoxGetSelected (3,1);
     SaveGameSlot (savegameindex[index],text);
     }
   else if (index<5){
     GetTextBoxText (3,1,text);
     SaveGameSlot (index+1,text);
     Display ("Your game has been saved.");}
}

if (interface == LOAD)
{
 if (button == 1){
   GUIOff (4);}
 else if (button == 0){
   char index;
   index=ListBoxGetSelected(4,2);
   RestoreGameSlot (savegameindex[index]);}
 }
}
see i've done that script i had done to the others to turn the gui off., by the way 0 is cancel button and 1 is save/load button.
Title: Re:creating my own save/load gui
Post by: Scorpiorus on Wed 03/12/2003 17:59:36
Hmm, are you sure the buttons left click option is set to Run Script?

Quoteby the way 0 is cancel button and 1 is save/load button.
Looking at the load code it is the button number 0 that triggers the load process. Be sure it is supposed to.

~Cheers
Title: Re:creating my own save/load gui
Post by: Gemmalah on Tue 09/12/2003 09:01:33
oh how silly of me, anyway i've sorted out the numbers and is still funny.

It displays your game has been saved but when i try to load it i cannot see it.
what command makes them appear in the list box?
is there another command to make one game delete so i can overwright when i run out of space.?
Title: Re:creating my own save/load gui
Post by: Scorpiorus on Tue 09/12/2003 10:56:12
QuoteIt displays your game has been saved but when i try to load it i cannot see it.
what command makes them appear in the list box?
It's the ListBoxSaveGameList ():

when displaying the LOAD GUI:
ListBoxSaveGameList (LOAD, 2); // fill listbox with saved games
GUIOn(LOAD); // display LOAD gui

Quoteis there another command to make one game delete so i can overwright when i run out of space.?
Yep, DeleteSaveSlot(). You can have a button to delete the selected slot:

if (interface == SAVE) {
....
if (button == _DELETE_SAVE_BUTTON) {

int del_slot = ListBoxGetSelected (SAVE,1);
DeleteSaveSlot(del_slot);

}

....
}


~Cheers
Title: Re:creating my own save/load gui
Post by: Gemmalah on Fri 12/12/2003 09:56:27
Oh i'm having another problem, sorry guys, thanks scorpious

I got my list box to come up with a scrolling bar, i think this means it is on, i can now select different items but they are invisable, the writing does not show up.

It tells me i have too many save games when i try to save but i cannot load them.

Oh and

if (button == 1) //cancil button
GuiOff (3); // my load gui

for some reason doesn't turn off my load gui
Title: Re:creating my own save/load gui
Post by: Scorpiorus on Fri 12/12/2003 15:06:37
QuoteI got my list box to come up with a scrolling bar, i think this means it is on, i can now select different items but they are invisable, the writing does not show up.

ListBoxSaveGameList (LOAD, 2); //fill the listbox with saved games
GUIOn(LOAD); //showing the load GUI

have you done it?

if you have, are you able to load a saved game (with that blank description)?

EDIT:

if (interface == SAVE)
{
if (button == 0){
SetTextBoxText (SAVE, 1,"");
GUIOff (3);}
else if (button == 1){
string text;
int index;
//SetTextBoxText (3,1,""); // <-- comment that out
ListBoxSaveGameList (3,1); //Count how many save games there Are
index=ListBoxGetNumItems (3,1);
if (index>4){
Display ("You have too many save files, you must overwrite a previous saved game");
index=ListBoxGetSelected (3,1);
SaveGameSlot (savegameindex[index],text);
}
else if (index<5){
GetTextBoxText (3,1,text);
SaveGameSlot (index+1,text);
Display ("Your game has been saved.");}
}

Quote
Oh and

if (button == 1) //cancil button
GuiOff (3); // my load gui

for some reason doesn't turn off my load gui
Check whether button's action is set to Run Script.

~Cheers
Title: Re:creating my own save/load gui
Post by: Gemmalah on Fri 12/12/2003 20:43:14
Thank you, so much !

Just the loading and the cancil button to go.

The cancil button is set to the right one (button ==cancil), thats done, the button on click function is set to run script the gui i've set  to turn off is the right one. I've chacked a dozen times, i can't see anything wrong with it. Oh and it is under the correct if gui == load thingy.

I'll work on the loading and try again later.
Title: Re:creating my own save/load gui
Post by: Scorpiorus on Fri 12/12/2003 21:00:19
Try putting a Display("blah blah"); command just before the GUIOff. Thereby you'll know whether your gui-off script is running at all.
Title: Re:creating my own save/load gui
Post by: Gemmalah on Fri 12/12/2003 21:18:55
I tried that and found that it is not working at all, how odd.

if (interface == LOAD){
{
 if (button == 0){
   Display ("something");
   GUIOff (4);}
 else if (button == 1){
   index=ListBoxGetSelected(4,2);
   RestoreGameSlot (savegameindex[index]);}

heres my scrpt for the load gui
Title: Re:creating my own save/load gui
Post by: Scorpiorus on Fri 12/12/2003 21:40:56
Please post the whole interface_click function :P