Problems scripting custom Save & Restore GUI [SOLVED]

Started by x_traveler_x, Wed 09/02/2005 06:52:41

Previous topic - Next topic

x_traveler_x

*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!
~~- - -. . .finding a cure for mundanity. . . - - -~~

Radiant

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.

x_traveler_x

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?
~~- - -. . .finding a cure for mundanity. . . - - -~~

Radiant

Yes. You need to put it in the exact space where you turn on your save/load GUI.

x_traveler_x

#4
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.
~~- - -. . .finding a cure for mundanity. . . - - -~~

monkey0506

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.

WarGolem

#6
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.

SMF spam blocked by CleanTalk