get\name entity from file?

Blitz3D Forums/Blitz3D Programming/get\name entity from file?

Caton(Posted 2015) [#1]
filein = ReadFile(filename$)
If Not filein Then RuntimeError "Couldn't Load Execute App!"
If filein Then
NofCommands = ReadInt( filein );Number Of Commands
For cmd=0 To NofCommands -1
CommandType = ReadInt( filein );Command Type
Select CommandType
Case 1;CreateCamera
CameraEntity% = ReadString( filein )
CameraEntity% = CreateCamera()
End Select
Next
CloseFile( filein )


Matty(Posted 2015) [#2]
And your question is?

(Code looks fine at a glance)


steve_ancell(Posted 2015) [#3]
From what I can figure out it seems like you're after a way of loading, parsing and then performing actions on what is parsed. I've done it in Monkey-X which was quite easy. I load directives from a text file, split each word or number into an array in order to tokenise it; I then parse the token array to a function that acts on the indexable information.

What I said above isn't as straight forward in Blitz3D as it is in Monkey-X, as I discovered when I did the Blitz version of Mutant Monty.