How do you create a Restore and Save Game Dialog

Started by Edwin Xie, Fri 08/10/2004 05:49:37

Previous topic - Next topic

Edwin Xie

If it works fine for you.........there is a bad script in the global script.......I will need someone else to read the whole script for any error because I couldn't find any errors.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Edwin Xie

Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scorpiorus

#22
Try delete all saved games from your game\compiled\ folder and see if it helps.



If it still doesn't work then I can invite you to try the following save/load dialog:
http://www.geocities.com/scorpiorus82/saveloadgui_v1_1.zip (copy and paste) [edit: replaced with v1.1]

Feel free to ask, if you have any questions regarding its functionality.

Edwin Xie

#23
What do I have to do if I wanted the save and load slots to be 100 (or 99) rather than 20? And what if I wanted to have both of them be separate GUIs?
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Edwin Xie

Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scummbuddy

#25
edwin, JEEZ! you've been here long enough to understand the rules. no bumping a thread unless its falling off the first page. we all live in different time zones, plus we dont all hang out here 24 hours a day. we have lives too.

you have to set up your array to handle the amount of save slots you want. you can't edit the already made save/load system.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Scorpiorus

QuoteWhat do I have to do if I wanted the save and load slots to be 100 (or 99) rather than 20?
Yeah, as Scummbuddy pointed out, you then have to script the whole thing and have an array to store the correct order of slots. Otherwise, it wouldn't know which slot must be listed first, which - second, etc. AGS handles this with savegameindex[20] array which has a limit of 20 slots.


QuoteAnd what if I wanted to have both of them be separate GUIs?
The script can easily be adjusted to handle different GUIs for save and load as well.

Here is another version of the script:

Save/load script (version 1.1):
http://www.geocities.com/scorpiorus82/saveloadgui_v1_1.zip [18kb] (Copy & paste)

Edwin Xie

#27
Now, is savegameindex[20] hardcoded? And which codes in your script are unnecessary for separate GUIs?
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scorpiorus

Quote from: Edwin Xie on Tue 19/10/2004 06:19:58Now, is savegameindex[20] hardcoded?
Yes, kind of. But it is the array that is used by AGS to inform us about the correct order of save slots, i.e. when you display save slots on a listbox with ListBoxSaveGameList they are arranged starting from the most recent one.
I'll think about the implementation with a custom savegameindex-like array so that a twenty slots limit can be increased.

QuoteAnd which codes in your script are unnecessary for separate GUIs?
The whole script is essential as it implemets basic functionality such as save, load and delete. In fact, to add separate GUIs for save and load I just wrote two extra simple functions:

Code: ags
function OpenSaveDialog() {
//=---------------------------------------------------------------------=
//Ã,  Opens the *save* dialog:
//=---------------------------------------------------------------------=

Ã,  Ã,  //Ã,  Setting up the GUI (pass -1 if the GUI object is unused!):
Ã,  Ã,  //Ã,  ------------------------GUI---tbox--lbox--save--load--del--cancel
Ã,  Ã,  PrepareSaveLoadDialog(Ã,  Ã,  GUISAVE,Ã,  0,Ã,  Ã,  1,Ã,  Ã,  2,Ã,  Ã, -1,Ã,  Ã, 3,Ã,  Ã,  4Ã,  );
Ã,  Ã,  
Ã,  Ã,  //Ã,  Open GUI:
Ã,  Ã,  OpenDialogGUI();

}


Code: ags
function OpenLoadDialog() {
//=---------------------------------------------------------------------=
//Ã,  Opens the *load* dialog:
//=---------------------------------------------------------------------=

Ã,  Ã,  //Ã,  Setting up the GUI (pass -1 if the GUI object is unused!):
Ã,  Ã,  //Ã,  ------------------------GUI---tbox--lbox--save--load--del--cancel
Ã,  Ã,  PrepareSaveLoadDialog(Ã,  Ã,  GUILOAD, -1,Ã,  Ã,  0,Ã,  Ã, -1,Ã,  Ã,  1,Ã,  -1,Ã,  Ã,  2Ã,  );
Ã,  Ã,  
Ã,  Ã,  //Ã,  Open GUI:
Ã,  Ã,  OpenDialogGUI();
}

jetlag

savegameindex[20] isn't writen bold. So it cna be changed, right? I never had the nerve to do it.

Scorpiorus

Yep, it is possible to write into savegameindex but the issue here is that this array is, instead, used as an output parameter to provide us with the necessary information about  the arrangement of save slots.

Edwin Xie

The problem is, that I think PrepareSaveLoadDialog does nothing, is that the case?
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scorpiorus

On the contrary, it initializes the dialog by setting GUI and GUI objects numbers. It is important to tell the script what dialog (save or load) we want to appear.

Edwin Xie

I do not mean that, I meant, that there isn't really a script I can find that can save or load, it's pretty complicated to find a script that does not refer to the Save/Load GUI.....maybe I can create a Save/Load GUI but block that one from any access.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scummbuddy

- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Edwin Xie

Uh, I downloaded that but there was this listbox error.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scorpiorus

#36
Quote from: Edwin Xie on Thu 21/10/2004 05:27:13I do not mean that, I meant, that there isn't really a script I can find that can save or load, it's pretty complicated to find a script that does not refer to the Save/Load GUI.....maybe I can create a Save/Load GUI but block that one from any access.
So, do you just want to save/load without a dialog? You can then use SaveGameSlot and RestoreGameSlot, for example:

SaveGameSlot (100, "autosave"); // save a game to slot 100;

RestoreGameSlot (100); // restore a game from slot 100;

Edwin Xie

I just want a script for separate save and load GUIs.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Scorpiorus

The script I posted a link to has OpenSaveDialog() to open a save GUI and OpenLoadDialog() to open a load GUI. You don't have to use the GUISAVELOAD gui - you can delete this GUI as well as the OpenSaveLoadDialog() function from the global script. The SAVE and LOAD GUIs do use the same function to operate but that's more practical since their functionality is rather similar. For instance, both have a listbox to list existent slots, a cancel button and may optionally share the delete button as well.

Edwin Xie

#39
The only problem I am having is that clicking any button will do nothing.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

SMF spam blocked by CleanTalk