Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: x_traveler_x on Wed 09/02/2005 06:52:41

Title: Problems scripting custom Save & Restore GUI [SOLVED]
Post by: x_traveler_x on Wed 09/02/2005 06:52:41
*GROAN*

Okay, I almost have my custom save window and restore windows completely done, but they just won't work right.  The problem is the list of saved games doesn't appear in the GUI's list when i restart the game.  I don't know how else I can describe it.

Global:

// ##### SAVEWINDOW #####

  if (interface==7) {
    SetMouseCursor (6);
    if (button==0) {
      index=ListBoxGetNumItems(8,2);
      if (index<20) {
         GetTextBoxText(7,3,text);
         GUIOff (7);
         SaveGameSlot(index,text);
         GUIOn(1);         
      }
      else {
        index=ListBoxGetSelected(7,2);
        GetTextBoxText(7,3,text);
         
        SaveGameSlot(savegameindex[index],text);
      }
    ListBoxSaveGameList (7,2);
    ListBoxSaveGameList (8,2);
    }
    if (button==1) {
       GUIOff (7);
       GUIOn(1);
    }
  }

// ##### RESTOREWINDOW #####

  if (interface==8){
    SetMouseCursor (6);
    if (button == 0) {
      index = ListBoxGetSelected(8,2);
      RestoreGameSlot(savegameindex[index]);
      SetCursorMode(6);
      GUIOff(8);
      GUIOn(1);
    }
    else if (button == 1) {
      GUIOff(8);
      GUIOn(1);
    }
  }


Any thoughts?  Thanks!
Title: Re: Problems scripting custom Save & Restore GUI
Post by: Radiant on Wed 09/02/2005 08:00:16
In the code where you turn on the save or restore GUI (i.e. GUIOn()), you should put the command that initializes the save game list. Check your manual for its exact syntax, I don't know it by hard.
Title: Re: Problems scripting custom Save & Restore GUI
Post by: x_traveler_x on Wed 09/02/2005 08:19:37
I believe you're refering to ListBoxSaveGameList, which is in my global script as shown in my post above.  Do I need to put this somewhere else?
Title: Re: Problems scripting custom Save & Restore GUI
Post by: Radiant on Wed 09/02/2005 10:29:22
Yes. You need to put it in the exact space where you turn on your save/load GUI.
Title: Re: Problems scripting custom Save & Restore GUI
Post by: x_traveler_x on Thu 10/02/2005 03:30:51
Thanks, that worked! 

I think I'll be able to handle the rest.  These, so far, are the single most difficult commands to use, in my opinion.

I would honestly suggest that the next version's manual include a more in-depth walkthrough on custom Save and Load GUIs, instead of just the Quit GUI.
Title: Re: Problems scripting custom Save & Restore GUI
Post by: on Thu 10/02/2005 16:38:50
Well the problem with your code was that you weren't initializing the list box until interface_click was called, which isn't called until an interface (a GUI) is clicked on.  So it wouldn't have initialized till you clicked on the GUI.
Title: Re: Problems scripting custom Save & Restore GUI
Post by: WarGolem on Thu 10/02/2005 17:06:47
Hello,

I've been working on the same problem. Traveler, could you possible post the finished code?

Thanks

EDIT: Bah, After I read this thread a couple times it finally sank in, and I got it. Thanks for the info guys, I've been struggling with this one for a while now.