Code jump points

BlitzMax Forums/BlitzMax Beginners Area/Code jump points

Xerra(Posted 2010) [#1]
I've come back to blitz recently after a couple of years away from programming (blame World of Warcraft) and I'm getting my head round how to do things all over again. One thing I distinctly remember is being able to put lines in my source code that would appear on the right side bar to jump to various points in my code.

Needless to say I've forgotten how to do this now and my current project source file is getting a bit long so it's handy to jump about this way if i leave markers within the code. I thought I just needed to use a # symbol in front of a comment to make it show up so I could use something like:-

#MAIN_LOOP

for example but I'm getting this error message when i put in a line like that. Help please :)

"Labels must appear before a loop or Defdata statement"

Thanks, Tony.


Dreamora(Posted 2010) [#2]
spaghetti code mode has been killed with BM unless you don't use Strict in which case you could just as well use BlitzPlus.
this means there is no goto and you can not freeform define labels anymore.
That was and never will be clean maintainable code.
if you want to seperate code I would highly recommend to use functions or in cases like this one, potentially also just a repeat forever loop. Continue then will do the same but in a clearly defined way, not spaghetti jumpy style

labels are only supported for 2 things any longer:

1. Data (required to load specific data)
2. In front of loops to allow Continue / Exit to not only exit / continue the current loop but the specified outer loop with that label


Midimaster(Posted 2010) [#3]
What you are looking for is also working with "functions". All functions you create in the code, will create an entry in the right side tool bar of BlitzMax. This toolbar has three tabs "Home" "Code" and "Debug". Switch to the second "Code" to see the list of functions. If you now click on a entry, the cursor in the left window will jump to this code point.