reading text files

Game Editor comments and discussion.

reading text files

Postby Just4Fun » Fri Apr 30, 2004 6:59 pm

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....
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby makslane » Sun May 02, 2004 1:17 pm

This can be made with some global scripts, but is not easy
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Just4Fun » Sun May 02, 2004 4:51 pm

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
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby makslane » Sun May 02, 2004 8:35 pm

Use a text actor and copy the text with strcpy function:

strcpy(youractor.text, yourtext);
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron