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 / something wrong with code?

Author
Message
Captain America
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Here
Posted: 30th Aug 2006 10:04
Is there something wrong with this code?



I think it should work, mabye they just cant be close to eachother?

Sixty Squares I read your tut on functions, and when I ran your example it said same error, which was: "Program ran into Function Declaration"?

I have no idea what this means, as I have used the function command before and I have never had this problem before.

Its probably just a small thing though, and I will feel stupid after heard the answer, but I just cant figure this out.
(But i havent tried very hard either, im too busy @ work!)

Thanks guys!

Cap'n


Cheers,
Capt. America
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 30th Aug 2006 13:14
Hi Cap'

Not sure how to explain it, but in DBC a FUNCTION command can't be executed in the sequence of the program. It seems to always have to be called indirectly. If FUNCTION is run into in the sequence of commands, it will return an error.

In the following code, your function works fine because I never let the program "run" into it. I execute it indirectly:




This bit of code will also work:



Enjoy your day.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 30th Aug 2006 18:01 Edited at: 30th Aug 2006 18:06
Which example was it?

EDIT: OH, you probably ran one of those things in bold. Yeah those aren't really examples, but little snippets that help explain what I am doing. For full examples take a look at the bottom of the post. I have some examples there that you can try. The red box one (probably what you were looking at) is at the bottom as well.

Captain America
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Here
Posted: 30th Aug 2006 21:42
So I just cant let the program see the code,
I gotta make it skip it!

OK ive got it now!

thanks guys!

cap'n


Cheers,
Capt. America
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 1st Sep 2006 12:59
Just make sure to put all your function declarations at the very end of your code, its also good practise to put an end command between the two, like so;



Your signature has been erased by a mod because it's larger than 600x120...
Captain America
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Here
Posted: 2nd Sep 2006 03:31
ok! thanks!


Cheers,
Capt. America

Login to post a reply

Server time is: 2025-05-25 22:53:49
Your offset time is: 2025-05-25 22:53:49