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
Dark Dragon DX
17
Years of Service
User Offline
Joined: 31st Jul 2007
Location: United States
Posted: 3rd Jul 2008 21:14
Everytime I try to make my own custom function, I compile it, and it works fine..but when I execute my program (Checks For Graphics), it only tells me the program ran into a function declaration...

Dark Dragon DX
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 3rd Jul 2008 21:16
Please post your code.


TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Jul 2008 21:21
you have to call your function at the start. I suspect your function looks like this:



If it looks like that, then you get that error. So, you have to call the function at the start:



TheComet

Oooooops!!! I accidentally formated drive c.
Sinani201
18
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 3rd Jul 2008 21:51
Really? You can put functions on the top? I didn't know that. (I WASN'T being sarcastic there.)


TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Jul 2008 22:43
That`s why you have forums:You always learn something new!

Oooooops!!! I accidentally formated drive c.
Dark Dragon
17
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 3rd Jul 2008 23:08
HEY! you stole my name.

AM I UGLY OR WHAT??!!
What? It's My Sig!!...
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 4th Jul 2008 01:07
Almost! Dark Dragon is NOT the same as Dark Dragon DX !

Oooooops!!! I accidentally formated drive c.
Dark Dragon
17
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 4th Jul 2008 01:14
True.....
Degeneation X!!

AM I UGLY OR WHAT??!!
What? It's My Sig!!...
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 4th Jul 2008 02:20
Quote: "You can put functions on the top"

You can't "put" them at the top, that is, you cannot declare or make them at the top of the program. You can "call" them at the top like TheComet said. To "call" them is to use the function as if it is a command.

Quote: "Everytime I try to make my own custom function, I compile it, and it works fine..but when I execute my program (Checks For Graphics), it only tells me the program ran into a function declaration"

As TheComet demonstrated, when you design (declare) a function:



the declaration cannot be where the code of your program is running or else you will get the error "the program ran into a function declaration..." I believe this is just an error check so the function isn't declared over and over if it was accidentally put in a loop during the execution of regular code. Therefore the function must be declared outside of any running code.

It's best to put all of the function declarations at the bottom of your program right after the END command:

program code...
.
.
End

Function add(a,b)
etc.
endfunction

function dothis(string$)
etc.
endfunction

etc.

Enjoy your day.
Dark Dragon DX
17
Years of Service
User Offline
Joined: 31st Jul 2007
Location: United States
Posted: 5th Jul 2008 20:34 Edited at: 5th Jul 2008 21:13
Nevermind again, it just doesn't take folder locations.. I.E: "DLL/DLL.dll" And the DLL's were for DBPro.

Dark Dragon DX
master programmer
20
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 7th Jul 2008 17:31
eh? What do you mean? You were using DLL files and calling a function for them? Knowing that brings a whole new light to this problem. I know you can use folders, but I'm guessing there is a syntax error in the DLL code or when you call the function. Copy and paste some codes please

Login to post a reply

Server time is: 2025-06-06 00:17:06
Your offset time is: 2025-06-06 00:17:06