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 / #include command

Author
Message
Robin
23
Years of Service
User Offline
Joined: 22nd Feb 2003
Location: United Kingdom
Posted: 11th Apr 2003 17:51
how do I use it...?
I'm currently working on 'Map Maker 3D' - see beta announcements
i have some code which loads the map into DB which has to be put at the beggining of the program you are making. Because there is a lot of code, I thought it would be neater to put it all into a funtion in a seperate file and so the user can then just put one or two commands at the beginning of his/her program and it will work - Does anyone know how I could do this? ie. how could I make the program run the function from the include file?
Thanks
Robin
http://www.thegameszone.has.it
[email protected]
Hell IVIonkey
23
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 11th Apr 2003 19:31
At the top of your main program, put "#include filename.dba". In the main program you may call function "GenericFunction(vars)". This function must exist in the file "filename.dba". This file you're including must ONLY have functions, marked by "function GenericFunction(vars)" and "endfunction".

Problem with functions is you can only return 1 variable to the main program per function. There are workarounds though, but in some cases, gosubs work much better.

Login to post a reply

Server time is: 2026-06-11 17:31:46
Your offset time is: 2026-06-11 17:31:46