Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / still need help with loading files

Author
Message
Uncle Bosse
21
Years of Service
User Offline
Joined: 18th Dec 2003
Location: Sweden
Posted: 4th Mar 2004 16:40
The program is supposed to load my level1.dba, witch contains the matrix, objects and other level specified things.
When the program starts the variable level# = 1 and in the main loop i've written:
if level#=1 then #include "level1.dba" : level#=0
if level#=2 then #include "level2.dba" : level#=0

when you enter level 2 level#=2

is there anything special I need to put in the "level1.dba to make it work? Will this load the level into the main program
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 4th Mar 2004 17:32
thats impossible, #include copies the code from the file into your program. You cannot #include anymore when your program is run/compiled. You should try of another method

Quote: "
UPDATED

Amd 2800+ | 1024mb pc3200 | A7N8eluxe | Ati Radeon 9800PRO 256mb
"
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 5th Mar 2004 03:06
Also, unlike other languages, the #Include preprocessor only includes functions... so, what you want is inside level1.dba everything should be in a function, such as level_1() then you call that function later...

if level#=1 then level_1() : level#=0
if level#=2 then level_2() : level#=0

Etc...

And if you have the #Include command in, as it is a per-processor directive, it will include whatever's in the file before any code is executed...

Hope I Helped...
Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy

Login to post a reply

Server time is: 2025-05-23 08:34:26
Your offset time is: 2025-05-23 08:34:26