Game Development Community

Problem with findNextFile

by Jason Barno · in Torque Game Engine · 08/01/2007 (2:03 pm) · 2 replies

I modified the startmissiongui to my own ends, so that I could load savegames. It works beautifully, but I seem to be having a major bug... Once you save a game, apparently you have to exit and then restart Torque to get it to show up in the list. The savegame works fine, the file is created immediately upon saving... But when I go to load it, apparently this "refresh" command only finds files created before the program is run, and I don't understand why. I tried never waking the LoadGui until after a new save, to check if perhaps it's only refreshing once on the first wake, that still doesn't work. It only finds files created before the program. Is there a fix or hack to take care of this? It's a major bug with my work.
Thanks in advance.

function refreshLoadGui()
{
   echo("\c8REFRESHING LOAD PANEL");
   savelist.clear();
   %file = "";
   %i = 0;
   for(%file = findFirstFile($Server::SaveDataSpec); %file !$= ""; %file = findNextFile($Server::SaveDataSpec))  
         savelist.addRow(%i++, getSaveDataName(%file));
   savelist.sort(0);
   savelist.setSelectedRow(0);
   savelist.scrollVisible(0);
}

~jace

#1
08/01/2007 (2:35 pm)
You'll need to add it to the Resource Manger after you created the save file.

setModPaths(getModPaths());

(or I think it was something like that)

Aun.

#2
08/01/2007 (6:20 pm)
Thanks so much, that fixed it right up as well as giving me the answer to another problem... So... thanks.
~jace