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 / Function ERROR!!!

Author
Message
Uncle Bosse
21
Years of Service
User Offline
Joined: 18th Dec 2003
Location: Sweden
Posted: 20th Mar 2004 02:38
My program has gone crazy!!!
I have icluded two files, one is a magicworld file with the magicload function in it. The other one is my own file "enemy.dba".
when i start the program it says "Runtime Error at line 971. Program ran into a function declaration at line 971". I ONLY HAVE 617 LINES OF CODE IN MY MAIN PROGRAM!!!
I have one function in my own file and The whole program worked the last time i had DB open, but since i saved and exited it and the reopend DB it Crashes every single time!
I cant understand why, its really enoying, please help
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 20th Mar 2004 06:31
we would need to see the code of the function or look around your code for function usage thats incorrect syntax.


BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 20th Mar 2004 06:36 Edited at: 20th Mar 2004 06:36
First, make sure all your file directory locations are correct. THey probably are, but it's always good to check .

The reason why it says you have an error at line 971, even when you have a total of only 617 lines total, is because of loops. The DB debugger is kinda screwy in that it doesn't remember precise line numbers. Until I can see your code, your best bet is to insert a BREAK or two around where you think the problematic area is, or use DarkEdit's step-through option which inserts breaks after every line of code. Then DB will give you an accurate line number.

Crazy Donut Productions
Current Project: KillZone
Uncle Bosse
21
Years of Service
User Offline
Joined: 18th Dec 2003
Location: Sweden
Posted: 20th Mar 2004 13:17
my program starts off as follows:


before when started the progam i got the "Program ran into a function declaration" error, now i copied most of my code to test it in another file and now it doesn't either understand the "MagicLoad("bana",700,1,700)" command.
WHAT THE SHMUCK!!!

I dont know if this helped you locate my problem, but please help, I've been working with it for quite some time and I really need it to work!
Uncle Bosse
21
Years of Service
User Offline
Joined: 18th Dec 2003
Location: Sweden
Posted: 20th Mar 2004 19:38
I've been spending my day trying to figure out whats wrong with my shi**y program whith no luck, i have noticed that when i change the order of my #include files the problem changes from: "Program ran into a function declaration at line 971" to something that makes my program end like with a common end. Does this help? if not, I guess i'll have to post my whole code, though id rather not cuz' my programming skills aren't that good.
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 20th Mar 2004 20:36
If your code works fine except for the error "Program ran into a function declaration at line 971", be sure to put an END command at the end of your loop and everthing else in that area. DBC doesn't like it when it's running through a program and it sees a function declaration, kind of confuses it so it just says ERROR!

Crazy Donut Productions
Current Project: KillZone
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 20th Mar 2004 21:18
return:

Thats your problem. Just take off the : at the end.


We need help! Email us! [email protected]
Cybermind
Valued Member
22
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 20th Mar 2004 22:13
If none of this has helped you, I might know what is wrong.
I made mine like this:

Mainfile.dba:
Sync on
Sync rate 60
bla bla bla
FUNCTION thisfunction(1)
commands bla bla bla
ENDFUNCTION

THE ABOVE WILL NOT WORK, DB will tell you that it ran in to a function declaretion. try it this way (every function in its own file) like this:

Uncle Bosse
21
Years of Service
User Offline
Joined: 18th Dec 2003
Location: Sweden
Posted: 22nd Mar 2004 09:24
Thanks for the help, but i managed to get rid of the problem by taking an older version of my program and reinserted the code again and it worked, but i'll remember this if it occurs again.
LReM8888
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: The Land of the Fairies
Posted: 22nd Mar 2004 22:07
The reason it says you've got 917 when you've got 617 or whatever, it's because when Compile-ing or Run-ning it automatically squashes the #INCLUDE'd files into the top of your program *IN THE ORDER YOU PUT THE INCLUDEs IN*

Login to post a reply

Server time is: 2025-05-31 17:41:35
Your offset time is: 2025-05-31 17:41:35