Trouble with custom restore gui

Started by piraatlife4me, Wed 18/02/2004 05:39:53

Previous topic - Next topic

piraatlife4me

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

a-v-o

I can't see where you build the savegameindex. Maybe there's something wrong there.

Scorpiorus

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

piraatlife4me

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


Scorpiorus

Ah, that was related. Anyway I'm glad it's sorted out.

~Cheers

SMF spam blocked by CleanTalk