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 / Running a DBP program... in a DBP program

Author
Message
Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 10th Nov 2005 01:08
I have a long piece of code where it checks what place on a grid the person is on, and then makes a switch move. But I don't want this in my main code... I think... would it be faster to make it in a seperate DBPro program and then run it inside of the main program? If so... how would I do that... I know that it is possible.

Am I dead yet?
Heckno
20
Years of Service
User Offline
Joined: 8th Sep 2004
Location: Palm Coast, FL
Posted: 10th Nov 2005 18:53
you could call it using a gosub....

and you need to point the dbpro file to find it...You can either use the files command on the right side of the project window or type in the location of the .dba file yourself...

but remember you only have the one main dbpro file the rest of the included codes are source files...

a great example of using this would be to build your movement code as an independate source and just call it each time you write a program that would need that type of movement (I.E. you could have rpg type, FPS type, RTS type) and as you build different types of games you wouldn't have to retype or cut and paste the movement code....
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 12th Nov 2005 17:27
What you could do is have that long piece of code in a seperate .dba file.

Then use the #include command which looks like this


I wouldn't do that if it was just code you would run in a loop. However, this is useful if you have a .dba with a bunch of functions you would want to use.

If it was a bunch of code put it under a label like this


then put a return at the end of the code so it would all look like this



Then in the loop do this:



It will then run all the code and return back to the loop.

Heckno
20
Years of Service
User Offline
Joined: 8th Sep 2004
Location: Palm Coast, FL
Posted: 13th Nov 2005 05:33
Quote: "Then use the #include command which looks like this"


I could be wrong but I don't think the #include command works in DBP....?
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 13th Nov 2005 16:21
yeah it does

I use it all the time if I have a .dba file with functions i like.

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Nov 2005 02:16 Edited at: 16th Nov 2005 02:18
I think you might be talking about the Execute File command which would let you have "a seperate DBPro program and then run it inside of the main program".

But, running two DB programs at the same time might cause problems with DirectX, not to mention the fact that DB programs running on their own are big resource guzzlers as it is.

Maybe you are talking about #Include files though...

TDK_Man

Heckno
20
Years of Service
User Offline
Joined: 8th Sep 2004
Location: Palm Coast, FL
Posted: 16th Nov 2005 05:03
yup #include command does work....

Just hadn't used it before because of the project panel...

Is one way better than the other (#include command or project panel) or is it just personal preference??
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Nov 2005 14:33
Heckno

It doesn't matter - they both do exactly the same thing: include an external dba file in the compilation process.

So, as you say, it's a matter of which you prefer.

TDK_Man

Login to post a reply

Server time is: 2024-09-24 09:33:23
Your offset time is: 2024-09-24 09:33:23