This is probably a result of my head being stuck in some really old dialects of BASIC (i.e. BBC BASIC) but I can't see any way in Dark Basic Pro to replicate the method that I used back then to do this quick and easy thing...
What I'm trying to do is branch to one of many labels based on a variable.
An example to illustrate what I mean:
Say I had a game in which the data for the various "rooms" was held in DATA statements that followed labels.
In old versions of BASIC that I'm used to, I would simply store the data like this:
ROOM01:
Data ... (room data)
ROOM02:
Data ... (room data)
etc.
And then, if the variable "room" held the player's current room-number, I would construct a string
d$="ROOM"+right$("00"+str$(room),2)
and then simply
RESTORE d$
That would set the data-pointer to the appropriate block of data, and I'd simply read the room data.
There doesn't seem to be any way in Dark Basic Pro to branch (e.g. RESTORE, GOSUB, etc) to a label that is held as a variable.
It seems labels must be specified absolutely, e.g. RESTORE ROOM01
Am I missing something? (I won't even go there with "ON x GOTO 100,200,300"!)
I can see that I would be able to do this if the data was stored in external data-files (i.e. you can use a string to construct a path and/or filename and load the data from outside of your program) but I really want to be able to work with (and see, and edit) the data directly within my main code.
I could, of course, simply store all of the DATA statement as one vast sequence, and read through it, ignoring the data until I reach the required "block", but it seems really inefficient to do it that way when (ideally) I should be able to leap directly to the required label.
Hope I've described the problem clearly (?) and any tips would be much appreciated!
TBC