Page 1 of 1

reading text files

PostPosted: Fri Apr 30, 2004 6:59 pm
by Just4Fun
Will GE allow me to randomly search and retrieve through a text file :?:

1. I have a file that has several lines of text.
2. I would like to open the file.
3. I would like to randomly read a line of text from the file.
4. I would like the random line of text to appear on the game screen.
5. I would like to close the file.

What I know is that GE can load and save scores/lives(I've studied this code), but what sort of changes do I need to add to the previously posted code to accomplish the above? Can it be done in GE :?:

*pointers are giving me high blood pressure... (I feel another head banging incident rapidly approaching.) As always TIA....

PostPosted: Sun May 02, 2004 1:17 pm
by makslane
This can be made with some global scripts, but is not easy

PostPosted: Sun May 02, 2004 4:51 pm
by Just4Fun
Makslane,
Would standard 'C' code work or would it need to be change to GE specific code?

printf () function doesn't work in GE so when I read the text file contents, what function do I use to display the randomly chosen text?? TIA

PostPosted: Sun May 02, 2004 8:35 pm
by makslane
Use a text actor and copy the text with strcpy function:

strcpy(youractor.text, yourtext);