Chopepo wrote:How do I use the INCLUDE command?
I tried to use the include but when I compile I get an error.
As for the other questions, I can't help you. But I'll give a try for this one; include basically includes, adds the insides of another textfile (like a .cb file) to your current program. This way you can easily chop your code to smaller bits and therefore help reading and creating it.
For instance, you could have a sourcecode in
functions.CB file looking like this:
- Code: Select all
Function MyFunction( txt$ )
MakeError "This is MY function!"+Chr(10)+Chr(13)+txt$
EndFunction
and then you could have your actual sourcecode and mainloop in
game.CB file looking like this:
- Code: Select all
Include "functions.CB"
Repeat
If KeyHit(cbKeyReturn) Then MyFunction( "Return pressed!" )
Text 0, 0, "Press RETURN"
DrawScreen
Forever
Can you see the first line? It adds the functions.CB file to the code that goes to CoolBasic Compiler which creates the final EXE file. So basically it's the same as if you would write it all to one file, looking like this:
- Code: Select all
Function MyFunction( txt$ )
MakeError "This is MY function!"+Chr(10)+Chr(13)+txt$
EndFunction
Repeat
If KeyHit(cbKeyReturn) Then MyFunction( "Return pressed!" )
Text 0, 0, "Press RETURN"
DrawScreen
Forever
After you get hundreds of lines of code, chopping up the code to smaller pieces to different files will help you a lot. And that's what the INCLUDE command is for

I hope this clears things up for you

Later!