Thanks for your suggestions. It works now laugh (not ... see Edit ->)
I've used the method with the text object because I have to save the whole game but there are two global string arrays defined.
Here is my new code. I've watched the used memory and I think without the 'ptr_remove'-call there will be a memory leak !?
Code:
int i;

[...]

TEXT* txtStringSave = {
   strings=256;
}

[...]

function saveLevel()
{
   for(i=0;i<256;i++)   // save in text object
   {
      str_cpy((txtStringSave.pstring)[i],FileNames[i]);
      // FileNames[i] = NULL;  don't do this -> memory leak
      ptr_remove(FileNames[i]);   // instead   
   }
   int Save = game_save(str_create("test"),1,SV_ALL); // SV_VARS|SV_POINTERS|SV_STRINGS
   if(Save <= 0)
      printf("Error: saving");
   for(i=0;i<256;i++)   // restore array
   {
      FileNames[i] = str_create((txtStringSave.pstring)[i]);
      str_cpy((txtStringSave.pstring)[i],""); 
   }         
}

function loadLevel()
{
   iTest = 0;
        
   int Load = game_load(str_create("test"),1);
   if(Load <= 0)
      printf("Error: Loading");
      
   for(i=0;i<256;i++)   // restore string array
   {
      FileNames[i] = str_create((txtStringSave.pstring)[i]);
      str_cpy((txtStringSave.pstring)[i],""); 
   }
   
   printf("iTest: %i",iTest);  
   outpRandomString();         
}



grin

Edit: Oh, sry... it does not work yet. If I change this line:
Code:
for(i=0;i<256;i++)
   FileNames[i] = str_create("testName");


to this for example:
Code:
for(i=0;i<256;i++)
	   FileNames[i] = str_create("Name");


Then: Script crash in main frown
Any ideas ?
... it seems that it doesn't load the text object correctly.


Last edited by Nicros; 07/25/15 09:46.