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 / saving code as a file to load

Author
Message
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 24th Mar 2003 00:33
i have made buildings out of primitive objects which is a long pieces of code can i some how save them to a file perhaps a text holding that code segment and load it in to the game so it doesnt take up so much space in the program window.
Kanzure
22
Years of Service
User Offline
Joined: 19th Feb 2003
Location:
Posted: 24th Mar 2003 00:48
I only know how to load code with PHP..I don't think its possible in DB or DBP..If it is..that is GREAT..Then we could have users submit AI that they coded, and add it to a game without a new release !

~Morph
Owner of MultiCode.NET and Multi2k.NET.
Nothing is something, and something is then nothing. Life is an illusion.
Brent_Seraphim
22
Years of Service
User Offline
Joined: 1st Dec 2002
Location: United States
Posted: 24th Mar 2003 01:03
Its entirely possible!! Also BTW I cant spell...hookd on pheonics werkd fer me..

Use the "Open File" and "Write String", "Write Byte" then use "Close File"

Also lots of discussion has alread taken place on this...look it the newcomers corner for some older discussion.

"Laugh to scorn the power of man..."
Dr DooMer
22
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 24th Mar 2003 04:40
You could also write your code into a function and then use the #include command. That's probably the best way to do it, I'd have thought.

"I am a living, thinking entity who was created in the sea of information."
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 24th Mar 2003 07:19
here below is the segment of code that i build this building which is long and i have others like it now to save alot of space can i not have it listed in my code but save it as a text file somewhere else and include# it in my game and how would i go about doing that thanks.

LLX
22
Years of Service
User Offline
Joined: 17th Feb 2003
Location:
Posted: 24th Mar 2003 07:38
make it a function

then put in

include "name.dba"

and call the function

koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 24th Mar 2003 08:42
below is the segment of code that i make this building i turned it into a function and saved it as a seperate file from the main one and named it building1.dba and saved it in the same file as my other documents so now im suppose to put in include# "building1.dba" and when i run the program the building will be there? im not sure if i set the function up correctly.

Dr DooMer
22
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 25th Mar 2003 01:38
That looks pretty much fine, except you can replace the (1) with a simple (). I'm not sure, but I think that you can even remove it altogether...

Anyway, this is what your main program would look like:

#include "building1.dba"
building()

That should work, at least for DBClassic. If not, just give another shout and I'll see what I can do.

"I am a living, thinking entity who was created in the sea of information."
koolaid
22
Years of Service
User Offline
Joined: 26th Jan 2003
Location: Cyberspace
Posted: 25th Mar 2003 02:13
yeah ive learned now how to do it i made functions for building the areas and saved it when i put #include "myfile.dba" i then call the functions.thanks for the help.

Login to post a reply

Server time is: 2025-05-17 06:16:38
Your offset time is: 2025-05-17 06:16:38