Wow, thanks very much for the help. Let me just explain very briefly the structure of the program which I have hacked and slashed from george's aum 70 record/replay.
1. there are external .txt files with lists of numbers (you knew that already)
2. I have 2 files in my program, a main.c file and a play_me.c file(other than the default and scknex included files of course)
3. In the main.c file there is the action attached to models in the game in WED the action is
action entity_example()
{
// these 3 lines have to be added to every entity that needs to be recorded
max_ents += 1; // get a unique entity number
my.skill99 = max_ents; // and store it inside skill99
play(my.skill99); // put this line here
}
Thus each model added to the game and assigned this action will create its own identifying number stored in its my.skill99. Thats why I say that it is getting complex because therer can be several entitie reading several files. Each file is different and unique for each entity.
Now in the other program file, called play_me.c I will show you the function play_me():
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;
while(temp < 3500)
{
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();
}
As you can see in the above example I am just using an arbitrary number 3500 because I havent yet found a way to use a different counter for each entity dependent upon it's identifier.
So thank you EvilSOB I will now look at the file_seek method, thank you for explaining it to me. I think the reason I was having trouible reading concurrent files was because of the way I structured the while loop.
I admit that sometimes things get very confusing for me and I end up concentrating on something irrelevant or missing some small detail.
Anyway, thanks veru much for the help thus far.
