Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Sam. on Wed 30/06/2004 21:25:55

Title: All new custom save/load problems 2/7/04 SOLVED!
Post by: Sam. on Wed 30/06/2004 21:25:55
okay. I have my script which is working, to an extent. Both of my save and load boxes work fine, BUT:
MY restopre box works backwards. If you choose to load the first game, it loads the last. And if you choose to load the last game, it loads the first and so on. My script is below, any answers?

if (interface==6) {
Ã,  Ã, 
SetMouseCursor(0);
Ã,  Ã, if (button==2) {
Ã,  Ã,  Ã,  // if save is pressed
Ã,  Ã,  Ã,  // Count saved games
Ã,  Ã,  Ã,  index=ListBoxGetNumItems(6,3); // Count saved games
Ã,  Ã,  Ã,  if (index<20) {
Ã,  Ã,  Ã,  Ã,  Ã, GetTextBoxText(6,0,text); // Get the typed text
Ã,  Ã,  Ã,  Ã,  Ã, GUIOff (6);
Ã,  Ã,  Ã,  Ã,  Ã, SaveGameSlot(index,text); // Save game (text as description)
Ã,  Ã,  Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  else { // if saved games are 20
Ã,  Ã,  Ã,  Ã,  Ã, index=ListBoxGetSelected(6,3); // Get the selected save game
Ã,  Ã,  Ã,  Ã,  Ã, GetTextBoxText(6,0,text); // Get the typed text
Ã,  Ã,  Ã,  Ã,  Ã, 
Ã,  Ã,  Ã,  Ã,  Ã, SaveGameSlot(savegameindex[index],text); // Overwrite the selected game
Ã,  Ã,  Ã,  }
Ã,  Ã, }

Ã,  Ã, if (button==4) {
Ã,  Ã,  Ã,  SetMouseCursor(0);
Ã,  Ã,  Ã,  GUIOff (6);
Ã,  Ã,  Ã,  game.text_shadow_color = 4;
Ã,  Ã, }

}
if (interface == 7) {

if (button == 1) {
RestoreGameSlot(savegameindex[index]);
Ã,  SetCursorMode(0);
GUIOff(7);
Ã,  Ã,  game.text_shadow_color = 4;
Ã,  Ã,  }
Ã,  else if (button == 2) {
Ã,  Ã,  SetCursorMode(0);
Ã,  Ã,  Ã, GUIOff(7);
Ã,  Ã,  }
Ã,  }
Title: Re: custom save/load interfaces
Post by: Lazy Z on Wed 30/06/2004 22:09:05
You can find a tutorial at http://atticwindow.adventuredevelopers.com just go to the tutorials section.

That tutorial is missing some bits, so for help check these threads:

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=14684.0
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=11790.0
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=11515.0
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=10095.0

And there's another thread, which deals with the Save/Load GUI found in the BlueGUI, but I can't find it right now... BlueGUI can be found here: http://www.gaia-spa.com/blusoft/Download/download.html
Title: Re: custom save/load need help with script!
Post by: Sam. on Thu 01/07/2004 12:07:46
see first post
Title: Re: custom save/load need help with script!
Post by: Pumaman on Thu 01/07/2004 21:14:21
are you sure you're doing ListBoxSaveGameList when you turn the GUI on?
Title: Re: custom save/load need help with script!
Post by: Sam. on Thu 01/07/2004 21:53:47
where would I put that?
Title: Re: custom save/load need help with script!
Post by: Sam. on Fri 02/07/2004 18:43:52
okay. I have my script which is working, to an extent. Both of my save and load boxes work fine, BUT:
MY restopre box works backwards. If you choose to load the first game, it loads the last. And if you choose to load the last game, it loads the first and so on. My script is below, any answers?

if (interface==6) {
   
SetMouseCursor(0);
   if (button==2) {
      // if save is pressed
      // Count saved games
      index=ListBoxGetNumItems(6,3); // Count saved games
      if (index<20) {
         GetTextBoxText(6,0,text); // Get the typed text
         GUIOff (6);
         SaveGameSlot(index,text); // Save game (text as description)
         
      }
      else { // if saved games are 20
         index=ListBoxGetSelected(6,3); // Get the selected save game
         GetTextBoxText(6,0,text); // Get the typed text
         
         SaveGameSlot(savegameindex[index],text); // Overwrite the selected game
      }
   }

   if (button==4) {
      SetMouseCursor(0);
      GUIOff (6);
      game.text_shadow_color = 4;
   }

}
if (interface == 7) {

if (button == 1) {
RestoreGameSlot(savegameindex[index]);
  SetCursorMode(0);
GUIOff(7);
    game.text_shadow_color = 4;
    }
  else if (button == 2) {
    SetCursorMode(0);
     GUIOff(7);
    }
  }
Title: Re: All new custom save/load problems 2/7/04
Post by: Pumaman on Fri 02/07/2004 18:50:25
looks like you're missing:

index = ListBoxGetSelected(7, XXX);

before RestoreGameSlot (where XXX is the object number of the list control).
Title: Re: All new custom save/load problems 2/7/04 SOLVED!
Post by: Sam. on Fri 02/07/2004 21:06:18
Great CJ, all done now