I'm almost done writing my program, but I'm stuck at one point. It works with TYPE commands. Some variables are grouped together using subscripts, like
hitpoints as integer
mana as integer
To actually use this, I need to do
dim shared myvariable (amount) as playerinfo
Then I can access it
myvariable(subscript).hitpoints = value
Right? I have that down, but that's not my problem. The question I have relates to the variable above, amount. With each and every call to my subprocedure, the amount variable changes. One call, it could be 20, another one, it could be 300. I need some way to redimension the memory that the variables uses. At sub call, one variable is passed, a number, in long format. My math inside the sub takes over, and based on what it does, it returns a value in the variable 'total'. This variable total is how many 'things' can be done with this number. Once this has been computed, I need to somehow run the command "DIM myarray(0 to total) as mytype". The DIM statement can't be run from a sub/function, so I need to know how to run it, and how to allocate the needed memory (using DIM) once the variable "total" has had it's new value computed.
I think that's it. If this is unclear, please post, and I will try to make it clearer. Please submit any ideas on how to do this, no matter how stupid/outrageous you think they may be. At this point, I am willing to try almost anything. I do have Qbasic 4.5 on my computer, so if what I need is inside the QB 4.5 language, I can use it. I can also get my hands on Qbasic 7.1 PDS, if need be.
Thank you very much.