Reading from a file
Blitz3D Forums/Blitz3D Programming/Reading from a file
| ||
I have been looking at the CSP Game engine plus a few others and like the idea of reading from a file to place objects in the 3d world on startup. is it easy to read a file into blitz like this. |
| ||
yesfilein = readfile("goat.txt") repeat a$ = readline(filein) ; do stuff with a$ until eof(filein) closefile(filein) |
| ||
okay so; I create a text file called test.txt with one line in in it model1.b3d call it in blitz as above I want for example a$ to be a global variable which is a model called "model1.b3d" I cant get it to work. Am I asking too much ? |
| ||
okay I think I figured it. call the file using separate string variables global v1=a$ v1=loadmesh(etc) Sort of works need some tweeking |
| ||
Well, you txt file would contain say: "models\gun.b3d" "models\player.b3d" "models\crate.b3d" and you would load them into strings: a$ = readline() ; what ever the stream name is (a$ would = "models\gun.b3d") temp = loadmesh(a$) Something like that. Just basically make sure the code you use to load your file, is laided out the same way as the code so save it. |