function loadtexts()
{
var i = 0; //Temp loop var
var maxentries = 0; //This is the number of dialogue entries to be read.
filehandle = file_open_read("dialogue.txt"); // opens the file dialogue to read
wait (100);
maxentries = file_var_read(filehandle); //how many entries are there in this file?
// //Time for a loop
while (i < maxentries)
{
// First allocate the memory needed.
speechbank[i] = (DIALOGUE*)malloc(sizeof(DIALOGUE));
printf("Ok so far");
speechbank[i].textstr = str_create("#128");
// Then you can read the data and store it in the array.
printf("Ok so far");
speechbank[i].opcode = file_var_read(filehandle);
printf("Ok so far");
speechbank[i].actor = file_var_read(filehandle);
printf("Ok so far");
file_str_read(filehandle,speechbank[i].textstr);
printf("Ok so far kk");
i++;
}
file_close(filehandle); // closes the file
return(1);
}