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 / Like Gosub and Goto

Author
Message
Clacker
22
Years of Service
User Offline
Joined: 8th Nov 2002
Location:
Posted: 21st Jul 2003 09:39
Dose darkbasic have a command that lets you skip to a bit of code in your program like the goto and gosub commands but if not specifided the program will not read that bit of code. What I am finding is that when I create a bit of code and apply it to my game it uses that code even when I havent told it to do so i.e. If playermove =1
gosub playermove
endif
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 21st Jul 2003 11:20 Edited at: 21st Jul 2003 12:21
The problem is that playermove is defined as a variable and a function - the compiler should report an error during compilation (but probably doesn't).


Its better than a poke in the eye...
Clacker
22
Years of Service
User Offline
Joined: 8th Nov 2002
Location:
Posted: 21st Jul 2003 11:57
SO what should I do to fix the problem?
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 21st Jul 2003 12:21
Well, from my point of view (so you may have a different idea), is to give the function a different name or precede it with a _ character


Its better than a poke in the eye...
Bloodshot
22
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United Kingdom
Posted: 21st Jul 2003 15:35 Edited at: 21st Jul 2003 15:53
Clacker use the "End" command at the bottom of your Main program, and place Gosubs under that:


Login to post a reply

Server time is: 2025-05-19 17:17:20
Your offset time is: 2025-05-19 17:17:20