Can array size be declared by another variable?

Hiya folks, I’ve got a bit of a weird one. It’s sort of in the title but whenever I use another variable to declare the length of an array I get something like this…
image

After some fiddling got me nowhere I cut it all down into it’s basic parts.
image
The array won’t always be 5, I’m only pretending it is for the bug test.
image
The error still pops up…

image
I’ve tried brackets, I’ve tried putting the brackets in brackets. I’ve tried putting it all in regular () brackets too. No luck at all.

If anyone could help that’d be brilliant!

1 Like

It’s not currently possible, but it might be possible in the future.

1 Like

ahhh, that’s annoying.

If anyone in the future needs a solution. I’ve a subroutine for every value it could be and call it up through concatenation.

*gosub {("shiftArray_length_003_")&{(param_1)&"_count"}}

results in the word 'shiftArray_length_003_X ', where x is the length of an array with the same name as the string in param_1 (confusing I know, sorry lol)

Then I create a subroutine like so

*label shiftarray_length_003_5
*temp_array shiftArray 5
*return

If there’s a lot of numbers it could be, I’d suggest using gosub_scene and have a file dedicated to all those numbers.
Some way you could improve this is adding params to set the array name and if you need it, link to use other array_length subroutines if one array at one certain length needs to do something extra special

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.