H̶i̶!
T̶h̶e̶ ̶a̶l̶g̶o̶r̶i̶t̶h̶m̶s̶ ̶n̶e̶e̶d̶e̶d̶ ̶f̶o̶r̶ ̶t̶h̶e̶ ̶g̶a̶m̶e̶ ̶I̶’̶m̶ ̶w̶o̶r̶k̶i̶n̶g̶ ̶r̶e̶q̶u̶i̶r̶e̶s̶ ̶t̶o̶ ̶d̶y̶n̶a̶m̶i̶c̶a̶l̶l̶y̶ ̶a̶d̶d̶ ̶s̶o̶m̶e̶ ̶c̶h̶i̶l̶d̶s̶ ̶v̶a̶r̶i̶a̶b̶l̶e̶s̶ ̶t̶o̶ ̶a̶ ̶s̶t̶r̶u̶c̶t̶u̶r̶e̶ t̶h̶r̶o̶u̶g̶h̶ ̶a̶n̶ ̶i̶t̶e̶r̶a̶t̶i̶o̶n̶,̶ ̶a̶t̶ ̶r̶u̶n̶t̶i̶m̶e̶,̶ ̶t̶o̶ ̶s̶i̶m̶u̶l̶a̶t̶e̶ ̶a̶n̶ ̶a̶r̶r̶a̶y̶.̶ ̶ W̶h̶a̶t̶’̶s̶ ̶t̶h̶e̶ ̶s̶y̶n̶t̶a̶x̶ ̶n̶e̶e̶d̶e̶d̶ ̶t̶o̶ ̶t̶h̶a̶t̶?̶ ̶H̶o̶w̶ ̶c̶a̶n̶ ̶I̶ ̶d̶y̶n̶a̶m̶i̶c̶a̶l̶l̶y̶ ̶d̶e̶c̶l̶a̶r̶e̶ ̶t̶h̶e̶ ̶n̶a̶m̶e̶ ̶o̶f̶ ̶t̶h̶e̶ ̶c̶h̶i̶l̶d̶ ̶o̶f̶ ̶a̶ ̶s̶t̶r̶u̶c̶t̶u̶r̶e̶?̶
T̶h̶a̶n̶k̶s̶ ̶i̶n̶ ̶a̶d̶v̶a̶n̶c̶e̶.
[size=200]SOLUTION:[/size]
You can use structure notation to declare the child of a structure:
Do = 1 To Variable myStruct["myChildVar"]
You can also declare it dynamically:
Do = 1 To Variable myStruct[VariableString(myVar)]
And use almost the same syntax to dynamically access its value:
Do = Variable(myStruct[VariableString(myVar)]) To Variable myVar
So, you can simulate dynamic arrays (declared during an iteration for example):
Do = 1 To Variable myStruct[VariableString(myCounterVar)].myChildVar
And dynamically access its value:
Do = Variable(myStruct[VariableString(myCounterVar)].myChildVar) To Variable myVar
Or access the value of a specific element of the array (in this example, 5):
Do = Variable(myStruct["5"].myChildVar) To Variable myVar
You can even use double square brackets to simulate a 2D array:
Do = 1 To Variable myStruct[VariableString(counter1)][VariableString(counter2)].childVar
And dynamically access to its value with the same syntax:
Do = Variable(myStruct[VariableString(counter1)][VariableString(counter2)].childVar) To Variable myVar
[i]This tutorial in the wiki: http://www.wiki.compilgames.net/doku.php/en/game_develop/tutorials/simulatingdynamicarrayswithstructurenotation
Thanks to Victor and Lizard-13 for the help.[/i]