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 / What can and can't included files do?

Author
Message
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 11th Oct 2002 06:07
heyas ^_^ I was just wondering, whats the deal with included source? I had this nice orgonised layout setup.. My main project file wasnt going to do anything apart from call functions needed for whatever task was due to happen. The menu system was to be written in a menu.dba, all the types (like a player type, entity types) were to be defined in a types.dba and the main game engine was going to be written in engine.dba
I created these files by using the project manager and saying add new. Then in my main project i typed the statment #include "whatever.dba".
But dbp really doesnt seem to like this kind of setup -_- It started complaining about things. Like:

In my types.dba i had this kind of type def:
Type Ball
x as float
y as float
z as float
model_num as integer
size as integer
endtype

and then in my engine.dba i had a function called init() which did this:

global player as ball
player.x = 0.0
player.y = 0.0
player.z = 0.0
player.size = 25
player.model_num = 1

and that worked fine. Then just below it i had:
make object sphere player.model_num,player.size

This raised an error something like (cant remember exactally): Parameters do not match Make Object Sphere object number,size in engine.dba (disapointed to note it didnt tell me what line that was on, but i only had one make object so i knew what it was on about).

i then changed my code to: make object sphere 1,25. Same error. I then commented it out. I had another function in my engine.dba for camera control, i tested it previously and it works fine. But when i commented out the make object sphere line it gave the same error but about position camera x,y,z!

Frustrated and unable to find the error in my code I closed it and started work on a map editor to take my mind of things. I was going to use the same kind of layout, one main project file which just calls functions from included source files. I made my project and then added gui.dba. I started work on my gui, writing a few 2d drawing routines for dialogs and buttons. I then told it to write using the text command (for button lables). I compiled. To my horror i got that error back again, Pameters not matching for text x,y.
Then just as a test I copied all my gui functions out of gui.dba and into the main file and then deleted gui.dba. I compiled, it worked perfectly! I didnt change any of the gui code, just moved it.

Can anyone tell me where i've gone wrong? It appears my idea of what #include should be used for is wrong. I presumed i could write functions for certain things in different files to form libararys.. am i wrong? Wassup with this? ^^

Im sorry if this is too long.. but i thought a good explination might help people to understand the exact problem ^_^

-Seph
Seph
22
Years of Service
User Offline
Joined: 3rd Oct 2002
Location:
Posted: 11th Oct 2002 06:46
I'm interested in include functions as well... Imposter. XP

Bangla
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: Sweden
Posted: 11th Oct 2002 14:54
I notices that when I included my functions with the browse-option in the project-manager, I get the same error.

I solved this by taking it out (just delet it) from the project-manager and add the .dba-files with the #include-command instead. (#include "filename.dba") Then the functions returns to normal and and all commands can be used as normally.

Downside is that then it can't be accessed fast for editing. It disapears from the dropdown. You haveto open the file by hand and edit it. =/

400 Mhz, 120 Meg, TNT2 - and then some...
Milamber
22
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 12th Oct 2002 13:52
Include them in one place or the other, not both. The reason for this is that when you make a project, it makes some initialisation code, eg screen resolution, include statements, etc. that you manipulate in the menus. This ends up in the file [projectname].dbpro as standard DB commands. If you have include statements in both places, it adds the file twice, but can't tell that the two are exactly the same, so when you go to use any of the stuff, it gets confused about which of the two exactly identical things to look at, and crashes.

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 12th Oct 2002 21:09
Oh I see, thanks Milamber! You've saved be alot of hastle ^_^ Cheers!

Milamber
22
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 12th Oct 2002 21:28
No prob. Some of these issues are also raised on the normal forums, so don't just watch here.

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM

Login to post a reply

Server time is: 2024-11-23 16:20:50
Your offset time is: 2024-11-23 16:20:50