File Problems

Blitz3D Forums/Blitz3D Programming/File Problems

wizzlefish(Posted 2005) [#1]
I have a file called lvl0.op and it looks like this:
Loophole
0
../../data/media/levels/articbase2.b3d

createobject
car
jeep2
../../data/media/models/vehicles/jeep2.3ds
0
0
0
0
1
0
0
0
0
.7
.7
.7
103
195
90

The only problem is with the file names (the lines with all the slashes). My file system will load the meshes perfectly if I make those filepaths:
C:\Documents and Settings\Steven\Mine! Mine!\Games\Written Programs\Operation 600\Operation 600 - version 2\data\media\levels\articbase2.b3d

And
C:\Documents and Settings\Steven\Mine! Mine!\Games\Written Programs\Operation 600\Operation 600 - version 2\data\media\models\vehicles\jeep2.3ds

But if I just have the relative file path, it doesn't work. What do you suppose I do? I've tried switching the slashes around, changing the relative file path, everything.


fall_x(Posted 2005) [#2]
It has to be relative to your blitz basic program (exe or main bb file), not the text file. Maybe that's what you're doing wrong?

Edit :

Just try :
data/media/levels/articbase2.b3d

instead of :
../../data/media/levels/articbase2.b3d


SoggyP(Posted 2005) [#3]
Greetings Puppies,

Have you tried setting a variable with the path name and appending the filename to that?

Just a thought.

Peace,

Jes


wizzlefish(Posted 2005) [#4]
Haven't thought of that, SoggyP.


wizzlefish(Posted 2005) [#5]
OK, fall_x - thanks. I was writing the path relative to the level FILE, not the .bb FILE. Thanks alot, now it works!


wizzlefish(Posted 2005) [#6]
I have another problem.

I changed the level file to this:
Loophole
0
data/media/levels/articbase2.b3d
33
23
38

createobject
crate
crate1
data/media/models/objects/crate/Crate.3ds
0
0
0
0
1
0
0
0
0
.1
.1
.1
0
0
0


But it still loads the jeep, and not the crate.


fall_x(Posted 2005) [#7]
Without the code I can't tell you much, you probably have a variable that's being used instead of the content of this file or something similar.


wizzlefish(Posted 2005) [#8]
Here is the code:
;loads level
Function LoadLevel(filepath$)
	
	lvl.level = New level
	file = OpenFile(filepath$)
	lvl\title$ = ReadLine(file)
	lvl\id = ReadLine(file)
	lvl\mesh = LoadMesh(ReadLine(file))
	ScaleEntity lvl\mesh, 2, 2, 2
	EntityType lvl\mesh, LEVEL_COL
	camerax = ReadLine(file)
	cameray = ReadLine(file)
	cameraz = ReadLine(file)
	PositionEntity camera, camerax, cameray, cameraz
	
	Repeat
		If Lower(ReadLine$(file))="createobject"
			obj_type$ = ReadLine$(file)
			name$ = ReadLine$(file)
			obj_mesh$ = ReadLine$(file)
			el_dest = ReadLine(file)
			x = ReadLine(file)
			y = ReadLine(file)
			z = ReadLine(file)
			alpha = ReadLine(file)
			shine = ReadLine(file)
			xv = ReadLine(file)
			yv = ReadLine(file)
			zv = ReadLine(file)
			sx = ReadLine(file)
			sy = ReadLine(file)
			sz = ReadLine(file)
			rx = ReadLine(file)
			ry = ReadLine(file)
			rz = ReadLine(file)
			CreateObject(obj_type$, name$, obj_mesh$, el_dest, x, y, z, alpha, shine, xv, yv, zv, sx, sy, sz, rx, ry, rz)
		EndIf
	Until Eof(file)
	CloseFile file
	
	
End Function 



SoggyP(Posted 2005) [#9]
Greetings Puppies,

What happens if you replace the crate data with the data for the jeep - do you get two instances of the jeep? You could tell then if it's a problem with the data or the program.

Peace,

Jes


wizzlefish(Posted 2005) [#10]
But I don't load the jeep anywhere in the program!


wizzlefish(Posted 2005) [#11]
I'll try that, though.


wizzlefish(Posted 2005) [#12]
I'ma such an idiot! I WAS loading it in the program! :P


Damien Sturdy(Posted 2005) [#13]
The edit button is your friend......


wizzlefish(Posted 2005) [#14]
Yep.....


Damien Sturdy(Posted 2005) [#15]
On topic though, i usually find it useful to keep a fileversion with the file so that if you upgrade after making a ton of levels, it can still read the old ones :)
if fileversion>1.01 then ;New features since this version
;Do/read the new stuff here
endif



wizzlefish(Posted 2005) [#16]
Yeah.

OK, I got it to load the crate, but when I scaled it, as it was too big, it disappeared. I am sure I didn't scale it too much, it's a problem with the file.

Here's the *.op file:
createobject
crate
crate1
data\media\models\objects\crate\Crate.3ds
0
9
1
31
1
0
0
0
0
.07
.07
.07
0
0
0
createobject
crate
crate2
data\media\models\objects\crate\Crate.3ds
0
12
1
31
1
0
0
0
0
.07
.07
.07
0
30
0
createobject
crate
crate3
data\media\models\objects\crate\Crate.3ds
0
10
3.1
31
1
0
0
0
0
.07
.07
.07
0
-30
0

And the parser is same as above.


wizzlefish(Posted 2005) [#17]
But there are collisions between the camera and object. ??


fall_x(Posted 2005) [#18]
Did you scale it negatively?


wizzlefish(Posted 2005) [#19]
Nope.

I scaled it .07 x, y, and z.


Damien Sturdy(Posted 2005) [#20]
if collisions are happening or you have collisions enableed before positioning an entity, try using resetentity after positioning the entity :)


wizzlefish(Posted 2005) [#21]
Collisions are enabled afterwards.