!ßrendan Member Posts: 21 From: Western Australia Registered: 07-04-2002 |
*.bb ------------------------- SeedRnd(MilliSecs()) number=Rnd(2) file=ReadFile("data.txt") SeekFile (file, number) Print ReadLine$( file ) Print number I've made some progress, so far this is my blitz basic code, and my data file. The problem I have is in this section of code. SeekFile (file, number) I want the random number to represent a line (e.g. 0=line1,1=line2,2=line3) eg. 012 0=line1 If you copy the code and create the data file you can get a better view of what I'm trying to say... I you can help it would be awesome! ------------------ |
|
Ty Member Posts: 45 From: England Registered: 05-15-2002 |
Hi, nice to see you around !ßrendan Personally, I wouldn't use the seekfile command, so here's how I'd do it :
I've just tried it, and it seems to work ok for me Hope that helps ------------------ |
|
!ßrendan Member Posts: 21 From: Western Australia Registered: 07-04-2002 |
Thanks Ty, your code worked well... I'm wondering if you would know how to wrap text when it gets to the edge of the window (and without breaking up the words) and/or how to use the code you posted to ready 3 lines with each random number... eg 1=1st 3 lines 2=line 4+5+6 so on. I guess it has something to do with this line of code. I'll keep trying to work it out for now. for i=1 to number -1 ------------------ |
|
Ty Member Posts: 45 From: England Registered: 05-15-2002 |
Hmmm, I did a word wrap code once, but I'll have to have a look in my code archive. Recieving 3 lines is easy, just read 3 lines after the line gets instead of reading 1 line. I'll post he code when I have time to write and check it. ------------------ |
|
!ßrendan Member Posts: 21 From: Western Australia Registered: 07-04-2002 |
I think I know what your saying (I'm new to coding form HTML starit to Blitz Basic) I'll try it out... Code to wrap text would be very handy, thanks for your help. ------------------ |