Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: piraatlife4me on Wed 18/02/2004 05:39:53

Title: Trouble with custom restore gui
Post by: piraatlife4me on Wed 18/02/2004 05:39:53
Hey ags forums!
I am in need of a little help! I am having a little trouble getting my custome restore gui to work. I was wondering if any one could look at my script and see if they see anything with this that might be the cause of it not working? I have tried everything I can think of but I am still comming up short of a solution here.This is what I have in my global script:

if (interface==SAVEGAME) {
SetMouseCursor(8);
if (button==2) {
 // if save is pressed
// Count saved games
index=ListBoxGetNumItems(7,4); // Count saved games
if (index<20) {
GetTextBoxText(7,1,text); // Get the typed text
InterfaceOff(7); // Close interface
SaveGameSlot(index+1,text); } // Save game (text as description)
else { // if saved games are 20
index=ListBoxGetSelected(7,4); // Get the selected save game
GetTextBoxText(7,1,text); // Get the typed text
InterfaceOff(7); // Close the interface
SaveGameSlot(savegameindex
[index],text); } // Overwrite the selected game
}
if (button==3)
SetDefaultCursor();
InterfaceOff(7);
game.text_shadow_color = 4;

}

For my restore gui I have this:

if (interface == RESTOREGAME) {
 if (button == 2) {
   index=ListBoxGetSelected(8,0);
RestoreGameSlot(savegameindex[index]);
 SetCursorMode(0);
GUIOff(8);
   game.text_shadow_color = 4;
   }
 else if (button == 3) {
   SetCursorMode(0);
    GUIOff(8);
   }
 }
Anyone out there see anything wrong with this?
Or know of anything I might be leaving out? I keep getting a error message saying it's unable to load file.
Thanks.
Daniel
Winebarger
Title: Re:Trouble with custom restore gui
Post by: a-v-o on Wed 18/02/2004 09:15:50
I can't see where you build the savegameindex. Maybe there's something wrong there.
Title: Re:Trouble with custom restore gui
Post by: Scorpiorus on Thu 19/02/2004 21:12:58
hmm, first erase all the saved files from the game\compiled folder, next try the following SAVE script:

if (interface==SAVEGAME) {
   SetMouseCursor(8);
   if (button==2) {
      // if save is pressed
      // Count saved games
      index=ListBoxGetNumItems(7,4); // Count saved games
      if (index<20) {
         GetTextBoxText(7,1,text); // Get the typed text
         InterfaceOff(7); // Close interface
         SaveGameSlot(index,text); // Save game (text as description)
      }
      else { // if saved games are 20
         index=ListBoxGetSelected(7,4); // Get the selected save game
         GetTextBoxText(7,1,text); // Get the typed text
         InterfaceOff(7); // Close the interface
         SaveGameSlot(savegameindex[index],text); // Overwrite the selected game
      }
   }

   if (button==3) {
      SetDefaultCursor();
      InterfaceOff(7);
      game.text_shadow_color = 4;
   }

}

Any changes? :P
Title: Re:Trouble with custom restore gui
Post by: piraatlife4me on Thu 19/02/2004 22:26:33
Hey Scorpiorus!
That fixed it, again you saved me! The problem I was having was  forgetting to put in ListBoxSaveGameList(8,0); before opening up the restore gui. It works now!
Thanks buddy, I definitely owe you one!
Daniel
Winebarger

Title: Re:Trouble with custom restore gui
Post by: Scorpiorus on Thu 19/02/2004 23:25:42
Ah, that was related. Anyway I'm glad it's sorted out.

~Cheers