Game Development Community

File cache?

by CodingChris · in Torque Game Engine Advanced · 01/13/2008 (10:51 am) · 11 replies

Hi,
I copied a mission file with Torque Script using PathCopy. Works fine, the problem is, that the new mission is only visible in the mission gui after I restarted TGEA... What's the solution for this problem?

#1
01/13/2008 (12:06 pm)
Rebuild the entries of your GuiTextListCtrl.

for(%file = findFirstFile(%fileSpec); %file !$= ""; %file = findNextFile(%fileSpec))
   SL_savegamesList.addRow(...);
#2
01/13/2008 (12:14 pm)
Might be a silly question but where to insert the code? Is there a on setContent function or something like that...
#3
01/13/2008 (12:20 pm)
Just create a "update function" yourself and call it in your mission gui's onWake() function.
#4
01/13/2008 (12:21 pm)
But the code is already in the onWake function isn't it?
#5
01/13/2008 (12:28 pm)
Not sure if I understand your last question.

You can either put the rebuild code in a separate function (something like UpdateMyWhateverList()) and call this function in the onWake() function of your gui

or

put the rebuild code directly in the onWake() function of your gui.
#6
01/13/2008 (12:30 pm)
This is the common onWake function:
function startMissionGui::onWake()
{
   SM_missionList.clear();
   %i = 0;
   for(%file = findFirstFile($Server::MissionFileSpec); %file !$= ""; %file = findNextFile($Server::MissionFileSpec))  
      if (strStr(%file, "/CVS/") == -1)
         SM_missionList.addRow(%i++, getMissionDisplayName(%file) @ "\t" @ %file );
   SM_missionList.sort(0);
   SM_missionList.setSelectedRow(0);
   SM_missionList.scrollVisible(0);
}
and in this function the list should be already rebuilt or not?
#7
01/13/2008 (12:57 pm)
Yes, looks good. But it seems not to be executed if you don't get an updated list.
#8
01/13/2008 (12:58 pm)
It's executed. It's filling the StartMissionGUI the first time.
#9
01/13/2008 (2:37 pm)
I played around a bit and now it works. Thanks for your help.
#10
01/14/2008 (5:22 am)
How did you solve it (just in case someone else runs into this problem)?
#11
01/14/2008 (6:22 am)
I changed something in my PathCopy function, it was not always working.