How to create and use a list of labels?

BlitzMax Forums/BlitzMax Beginners Area/How to create and use a list of labels?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi folks. I wish to use several GOTO calls, to a selection of several routines that are organized by labels. For example:

Goto Routine1
#BackToBeginning
End

#Routine1
'Add some program lines here
Goto Routine3

#Routine2
'Add some program lines here
Goto Routine 4

#Routine3
'Add some program lines here
Goto Routine 2

#Routine4
'Add some program lines here
Goto BackToBeginning


What I want to be able to do is, at runtime, change which labels are jumped to with each of the Goto's in each routine, so that the routines can run in a different order.

I was hoping that maybe you could use labels in the same way as function pointers so that you can dynamically change the pointers. ie something like this:

FirstRoutine=Routine3
SecondRoutine=Routine2
ThirdRoutine=Routine4
FourthRoutine=BackToBeginning
Goto Routine1
#BackToBeginning
FirstRoutine=Routine4
FourthRoutine=Routine2
SecondRoutine=BackToBeginning2
Goto Routine1
#BackToBeginning2
End

#Routine1
'Add some program lines here
Goto FirstRoutine

#Routine2
'Add some program lines here
Goto SecondRoutine

#Routine3
'Add some program lines here
Goto ThirdRoutine

#Routine4
'Add some program lines here
Goto FourthRoutine


Will this work (any hope in h***?) ... and if not, is there a way to get this to work (efficiently and with the least code possible)? I need to be able to rearrange the order in which the routines are performed and this needs to NOT use functions - it must be GOTO's. ????????

Furthermore, would it then be possible to create an array or bank containing a list of the Label pointers so that they you can Goto Routine[i]? (or something like that)???

Thanks in advance.