Hello,
I have been attempting to change aum code from aum 70 to simply play data from an external file without reading it first. (The data is created in a different instance of the engine) I have been trying to adapt the code but I have found no way to determine how long the list of numbers in the file is, therefore I cannot set the loop counter fro the read instruction, can anyone help with this?
This is what I have so far...
function play(entity_number)
{
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
if (filehandle) // the file exists? Then open it for playback!
{
var temp = 0;
while (temp <= global_index) // read all the array values from the 1.txt... 50.txt files (if they exist)
{
recorded_position[temp][entity_number] = file_var_read(filehandle); // and put them inside the array
temp += 1;
}
file_close(filehandle); // close the file
while (global_counter < 70000)
{
my.x = recorded_position[global_counter][entity_number]; // restore the xyz
my.y = recorded_position[global_counter + 1][entity_number];
my.z = recorded_position[global_counter + 2][entity_number];
my.pan = recorded_position[global_counter + 3][entity_number]; // the angles
my.tilt = recorded_position[global_counter + 4][entity_number];
my.roll = recorded_position[global_counter + 5][entity_number];
my.frame = recorded_position[global_counter + 6][entity_number]; // and the frame number
wait(1);
global_counter +=1;
}
}
}
I believe it is the global_index variable which I need help determining how long the external text file is.
Thanks very much