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 / function declaration help

Author
Message
VaderJ
21
Years of Service
User Offline
Joined: 20th Oct 2003
Location:
Posted: 21st Oct 2003 03:38
in my game I use several functions. the program compiles fine, but when I run the program I keep getting runtime errors for all of my functions...something like: runtime error...on line 99 ran into function declaration. I comment out that function and it does the same thing for every function. I commented out the function command and turned it into a subroutine and the program ran fine. I am pretty sure I have the code right. Sorry...don't have it with me right now. maybe tommorrow I can post it. Can anyone give me ideas as to what might be wrong?? what does that error mean? thanks in advance for your help.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Oct 2003 03:55
are you ending your functions with EndFunction command?

-RUST-
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 21st Oct 2003 05:00
Are your functions (not the function call, but the actual code for the functions) some how inside of your main loop? That would be bad.
--
TAZ
VaderJ
21
Years of Service
User Offline
Joined: 20th Oct 2003
Location:
Posted: 22nd Oct 2003 05:26
i'm not sure what the problem is...I moved the function to the bottom of everything else and that function worked, but the others didn't, so I tried to move them around, but after moving a few more aroun I got the same error for the first one I had moved...basically...I was back to square on. So I tried something else. I tried writing a small separate program just to test a function and I still had the same runtime error...at line so and so...program ran into function declaration. Here it is...see what you think. Please help me.
VaderJ
21
Years of Service
User Offline
Joined: 20th Oct 2003
Location:
Posted: 22nd Oct 2003 07:05
sorry....code didn't load in...here it is...

input word$
print
printword(word$)

function printword(x$)
print x$
endfunction


that's all it was and I still got the runtime error with the function declaration...any ideas?????
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 22nd Oct 2003 15:39
works fine here. I added a wait key to see the results...

input word$
print
printword(word$)
wait key

function printword(x$)
print x$
endfunction


no errors.

-RUST-
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 22nd Oct 2003 19:47 Edited at: 22nd Oct 2003 19:48
While in DBpro functions are ignored in the program flow, DBClassic gives an error. So since you seem to work with DBClassic, just insert the command "end".

input word$
print
printword(word$)
end

function printword(x$)
print x$
endfunction

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 22nd Oct 2003 19:49
ahh, I was thinking that but I didn't think it necessary in dbp, but dbc-ahhh different story.

should work now

-RUST-
VaderJ
21
Years of Service
User Offline
Joined: 20th Oct 2003
Location:
Posted: 24th Oct 2003 05:29
hey thanks....I tried the putting the "end" in there and it worked fine. thank you...now I will be able to move forward....yeeaaaaaaahhhhh
p.s. I am using dbclassic.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Oct 2003 07:33
DBC has a bug with that. I would get that error on a perfectly working program. The only way I could fix it was to cut all the text from that file, run it empty, then paste the code back in. Cleared out the bug, and the program ran fine afterwards with no changes to the code.

Login to post a reply

Server time is: 2024-11-25 14:56:17
Your offset time is: 2024-11-25 14:56:17