Loading From File

Blitz3D Forums/Blitz3D Beginners Area/Loading From File

ok snag number 2

Function FNT_LoadFile()
	FNT_Clear()
	LoadFile = ReadFile("Level.txt")
	While Not Eof(loadfile)
		Level.LevelAssets = New LevelAssets
		Level\AssetType$=ReadString$( loadfile )  ; loads back Type of Mesh
			Level\xpos = ReadInt(loadfile)	;Loads back xpos data
			Level\zpos = ReadInt(loadfile)	;Loads back zpos data
			Level\Rotation = ReadInt(loadfile) ;loads back Rotational Data

			Level\BlockHandle = CopyMesh (Level\AssetType$) ;Inserts Mesh <---doesn't work
			EntityPickMode Level\BlockHandle,2 ; Changed pickmode to polygon
			PositionEntity Level\BlockHandle,Level\xpos,0,Level\zpos	;Applys position data
			RotateEntity Level\BlockHandle,0,0,Level\Rotation	;applys rotation data
	Wend
	CloseFile(LoadFile) ;Closes file
End Function


it will not copy the mesh into the level\blockandle based on the ifno in the level\assettype$ string.

I have traced the string and it has the correct string in it, and if i put a mesh name in directy it works. i think its trying to copy a mesh in the actual string rather than using the name in the string to find the mesh. the mesh handles are global.

any ideas?