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 / [LOCKED] Can a code be confused?

Author
Message
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 18th Jan 2007 01:24
Im writing a game with around 25 levels. so far, im on level 4. and im already using over 1000 lines with multiple commands on each line. I am using a level code system, and for some reason, when ever i try to put in lvl4, you CANT go to lvl's 1,2,and 3. i pretty much have somthing that looks like this


that isnt my exact code, but it is close. no matter what code i use, i always endup at lvl 4. even when i take out the goto in lvl4, it STILL brings me there. is it possible that my code is confused? (stupid i know) but can the # of lines affect the outcome of code reconistion?


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroup.be/
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 18th Jan 2007 01:55
if lvl2pass=1;goto lvl2;endif
if lvl3pass=1;goto lvl3;endif
if lvl4pass=1;goto lvl4;endif

whats with the ;'s ?
command separator is :
goto is all kinds of evil, you've been warned

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 18th Jan 2007 03:00
Code cant be confused... you can though .

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Jan 2007 09:00 Edited at: 18th Jan 2007 09:01
This isn't the complete answer to your problem, there are some bigger issues. But this is an example of neater, more understandable coding. Once you code neat, finding problems becomes infinitely more easy.





flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 20th Jan 2007 00:58
hmm, i see what your saying... so would the lvl2 function be all of lvl2's code???

and what i so bad with goto's, i dont get it.

AND, : might be the real code divider, but ; works just as well, pus its easier.


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroup.be/
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 20th Jan 2007 01:26
Quote: "and what i so bad with goto's, i dont get it."


This subject is being debated in a number of threads already. Just take our advice and try to avoid using it if you can. If you can't, learn how to!

Quote: "AND, : might be the real code divider, but ; works just as well, pus its easier."


So how can you be sure that the next bug you can't fix won't be down to the fact that you've decided to be the one person in the world who wants to change the syntax universally used in BASIC for the last three decades or more...

It's BASIC - not Pascal!

TDK_Man

flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 20th Jan 2007 22:04
te he, what ever man. I think its just a lot easier, ill start a trend.


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroup.be/
Black Mesa
18
Years of Service
User Offline
Joined: 25th Mar 2006
Location:
Posted: 21st Jan 2007 00:29
Hate to tell you but, Poor Programming practices is already a trend.

Seriously though, hitting shift while hitting the ";" key is not really all that much more work and it ensures a bug-free program in regards to that command.

Your mod has been erased by a signature
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Jan 2007 00:41
like I said, warned.

Login to post a reply

Server time is: 2024-09-25 15:23:10
Your offset time is: 2024-09-25 15:23:10