putting comments in text file

Blitz3D Forums/Blitz3D Beginners Area/putting comments in text file

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Personally, I use "datablocks" in my textfiles.

A textfile from my game:
; This datablock containes all data about "Station01"
[Station]
Name              = Station01
FileName          = Station01.b3d
Texture           = Station01.bmp
PositionX         = -1000
PositionY         = 0
PositionZ         = -1000

; This datablock containes all data about "Jumpgate01"
[Jumpgate]
Name              = Sol system -> Wolf 359
FileName          = Jumpgate.b3d
Texture           = Jumpgate.bmp
PositionX         = 2500
PositionY         = 0
PositionZ         = 2500
TargetSector      = Wolf 359
TargetJumpgate    = Wolf 359 -> Sol system



Identifying datablocks isn't difficult.
Also splitting up lines in the textfile (the part before and after the "="-sign).

You can get my sample code here (for the above textfile):
http://users.pandora.be/vge/Blitz/ReadingTextFiles.bb

NOTE: This file only containes the required functions for reading the file.
The custom types do not exist in there.

Also, the function "ReadTextFile" automatically skips non-recognized lines (so also comments and other useless junk, you don't even need the ";") within the file, as it only scans for "known" datablocks: [Jumpgate] and [Station]

The Jumpgate-type-instance is a global one in my game, with all fields set as in the function ReadDataBlock_Jumpgate.