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 / Reading functions from other files in darkbasic - possible?

Author
Message
Chiark
21
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 17th Dec 2002 22:58
Is it possible to read functions from other files in darkbasic?

I am reasonably new to darkbasic and have a game going right now, but the code is starting to get a bit untidy with all the functions at the bottom. Is there any way that you could read the functions in from another file, similar to reading data from arrays in from other files?

All help much appreciated, thanks.
Chiark
21
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 17th Dec 2002 23:04
Just to clarify what I mean by that - I mean have the function definitions themselves in other files, so that I can simply call the functions in the main program.

empty
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 18th Dec 2002 00:27
The #include directive does exactly that.
Syntax: #include "libname.dba"

Ogres have layers.
Chiark
21
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 18th Dec 2002 01:53
Nice one, thanks alot.

Chiark
21
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 18th Dec 2002 02:09
Sorry to be a pain, but is there any chance you could elaborate a bit more on that?

I tried simply pasting the functions into a new file and then saving it, and including it, but Im guessing its not as simple as that, as it wouldnt run

What else needs to be done?

Chiark
21
Years of Service
User Offline
Joined: 14th Nov 2002
Location:
Posted: 18th Dec 2002 02:11
Sorry my mistake, forgot to remove the functions at the bottom of the program hehe.

Thanks again.

Login to post a reply

Server time is: 2024-03-02 17:44:36
Your offset time is: 2024-03-02 17:44:36