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 / including .DBA's into the main module?

Author
Message
alanuk
22
Years of Service
User Offline
Joined: 25th Mar 2003
Location: United Kingdom
Posted: 20th May 2003 18:15
I was hoping that #include might be the answer but it seems that's only for functions.

I don't really want to have a single program that's thousands of lines long. I would like to make it up as modules or separate dba files and join/include them at compilation.

Anybody got any ideas please.?

Alan
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 20th May 2003 18:18
you can compile multiple parts of your game... there's some command (of which I don't remember the correct syntax) which can execute an executable

variables can be passed by using a file in which you write them (for example by using the SAVE ARRAY and LOAD ARRAY commands)
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 20th May 2003 18:19
maybe you can also pass variables by adding something to the command line (although I'm not sure you can execute a program with parameters from within a darkbasic program)
and then you can read those parameters with the CL$() command
alanuk
22
Years of Service
User Offline
Joined: 25th Mar 2003
Location: United Kingdom
Posted: 21st May 2003 16:47
Thanks for your comments, freak. Duly noted.

Anybody know if the compiler has options that can be altered.
I notice in DarkEdit there are some set. Wonder if they can be changed. And also what they mean.

I am still trying to find a way to compile separate DBA sources into one exe file.

regards Alan
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 21st May 2003 16:59
you can make a dba file this way:

this is how you make the file and prepare it to add the source code:


then you can write your source code into this file using tis function:


you write something like this:
write("text$="hello world" : print text$")


anyway, you can only include functions, but if you want you can put a whole game between function tags (but I think you can't use any other functions than)

[href]www.bernardfrancois.com[/href]
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 21st May 2003 18:36
anyway, you can only include functions, but if you want you can put a whole game between function tags (but I think you can't use any other functions than)

Yeah, you can call other funtions from within a function. Only problem (also true for a simple main-to-function call) is the lack of variables you can pass back. File writing works, but is very slow. If you pass back a string, you can use the string like an array to hold values for multiple variables, though this can be slow also. A good thing is that media-type variables are global (ie: object positions, image numbers)... it's kludgey, but you could use the global variables of invisible objects (ie: use object position y() to determine how much ammo you have left).

sicjoshsic
22
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 21st May 2003 18:40
file writing isn't THAT slow, you barely notice it if it's all laid out right

Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 21st May 2003 19:15
Arrays defined in the main code are global.

cuRant PRogekt: a three-de map editer
Why the hell'd you ask me for crying out loud!?!
Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 21st May 2003 21:00
Oh... Cool!

alanuk
22
Years of Service
User Offline
Joined: 25th Mar 2003
Location: United Kingdom
Posted: 21st May 2003 21:45
Interesting comments above.

I have sort of solved it.

The include module I define as a function then in the main module I use #include "filename.dba" then call the function immediately below that. It works. But I don't know yet if I am going to run into problems doing it this way.

at least I can break up into small chunks what will be a very large program.

regards Alan

Login to post a reply

Server time is: 2025-05-18 04:38:31
Your offset time is: 2025-05-18 04:38:31