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.

Newcomers DBPro Corner / Creating and using separates

Author
Message
Gwynnnn
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Lancashire, England
Posted: 9th Jul 2004 06:10
Does anyone know how to code and use separates in dark basic prof?
Is it possible?

I'll get it in the end - be patient
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Jul 2004 06:15 Edited at: 9th Jul 2004 06:17
do you mean separate code files (Includes, Modules) ?

If yes, then just create a new code file in the IDE, then in the project manager thingy window click on Files, then just include it there. When you compile the separate code file will be compiled into the exe


* DBP_NETLIB_v1.4.3 - July, 2004 * Click Logo
Gwynnnn
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Lancashire, England
Posted: 9th Jul 2004 06:18
Yes. Like in Ada and Pascal you can create separate parts of the whole program and then use a use command to include it into the compilation. A bit like the C include command.

I'll get it in the end - be patient
Gwynnnn
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Lancashire, England
Posted: 9th Jul 2004 06:19
It would be nice if it was possible to compile the separate parts separately but I will settle for separates that are included together just before compilation.

I'll get it in the end - be patient
Gwynnnn
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Lancashire, England
Posted: 9th Jul 2004 06:36
I'm sorry I didn't quite understand your instructions.

I have created a project file. I have a separate file too. How tdo I include the separate file to be included in the compilation?

I'll get it in the end - be patient
Gwynnnn
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Lancashire, England
Posted: 9th Jul 2004 06:39
Any possibility of leading me by the nose on this one? ie show me the two files and and the place where the include would go?

I'll get it in the end - be patient
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 9th Jul 2004 06:42
From my DBC experience, the book says to use the command of #include <file name> but it must appear near the top of the listing I'm told.

CattleRustler was pointing to the opion buttons on the editor/IDE you use for writing the code. (Like the optional Dark Edit for my DBC.) Poke around under the menus a bit and see if you can find it.

S.

Any truly great code should be indisguishable from magic.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Jul 2004 07:12
In DBP you shouldn't use the include directive, rather look in the IDE's program manager, there is a button called Files, click that then choose the files to include in the project - having them in the same folder isn't enough. Its like making a reference to an external module. I am assuming you are using the stock IDE?


* DBP_NETLIB_v1.4.3 - July, 2004 * Click Logo
Gwynnnn
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Lancashire, England
Posted: 9th Jul 2004 08:43
Thanks I'm getting somewhere now. However on returning from the sub program defined in the separate file the whole thing just ends.

any idea why it never prints 'goodbye world'?

I'll get it in the end - be patient
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Jul 2004 09:01
you need wait key

rem main file

#include S1.dba

Rem ***** Main Source File *****

print "hello world"
gosub print_second_message
wait 5000
print "goodbye World" rem it never prints this message
wait key


rem file defined in a separate file

rem S1.dba

print_second_message:
print "separate file running"

wait 5000
return


* DBP_NETLIB_v1.4.3 - July, 2004 * Click Logo
Gwynnnn
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Lancashire, England
Posted: 9th Jul 2004 09:11
Sorry. Just tried that and it just bombs out before printing 'goodbye world' still. Any ideas what I may be doing wrong?

I'll get it in the end - be patient
Gwynnnn
20
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Lancashire, England
Posted: 9th Jul 2004 09:19
Well that is odd. I closed it all down and started again and lo and behold it works as expected now. Must be something i did wrong.

Thanks for all the help

I'll get it in the end - be patient

Login to post a reply

Server time is: 2024-09-22 16:33:15
Your offset time is: 2024-09-22 16:33:15