Hi EvilSOB,

I implemented your code as you can see below. This way of using file_find is nearly exactly how I did it after following Helghasts advice. However there seems to be a problem having that while loop occur before the second while loop.

The models dont follow the path they just go straight to the origin. So thats the problem I guess. It is definitely copunting the right number of words in the file, so that much is working correctly, but the subsequent while loop gets screwed up somehow as a result and I have no idea why.

Code:
function play(entity_number)
{
	my.emask |= ENABLE_ENTITY; 
  
   my.event = pause_event;
	STRING* rec_str = "       "; // stores the name of the recorded data file
	STRING* temp_str = "  "; // just a temporary string
	var filehandle;
   
	str_cpy(rec_str, str_for_num(temp_str, entity_number)); // create the name of the data file depending on entity's number
	str_cat(rec_str, ".txt"); // and then add it the ".txt" extension
	filehandle = file_open_read(rec_str); // now we can try to open the file

		var temp = 0;
	   VECTOR tempStore;
      VECTOR tempStorePan;
      VECTOR tempVector;
      
      var spaceFind;
      var totalSpaces=0;
      
		var count=0;
		//file=file_open_read(filename);
		//if(!file)			return(-1);		//ERROR, file not found
		while(file_find(filehandle, " ")>=0)	count++;
      globalTester = count;//to watch the variable
         	
         
		   while(temp < count)
		   {
		 	   tempStore.x=file_var_read(filehandle);
			  	tempStore.y=file_var_read(filehandle);
			   tempStore.z=file_var_read(filehandle);
			   tempStorePan.x=file_var_read(filehandle);
			   tempStorePan.y=file_var_read(filehandle);
			   tempStorePan.z=file_var_read(filehandle);
			   my.frame = file_var_read(filehandle); // and put them inside the array

			   // rotate towards target
				vec_set(tempVector, tempStore.x);
				vec_sub(tempVector, my.x);
				vec_to_angle(my.pan, tempVector);
				
				//move to it with collision
			   c_move(my, vector(5 * time_step, 0, 0), nullvector, IGNORE_PASSABLE | GLIDE);

			 temp +=1;
			 wait(1);
			  
	      }
	      
	
		file_close(filehandle); // close the file
		beep();
		
    	
	
}



Last edited by NITRO777; 06/15/10 16:00.