This is what I tried and it almost works except for some syntax errors. (No clue as to why it will not allow me to set the inner array status.)
scn myarray
array_var actor
array_var actorStates
ref tempref
begin gamemode
if actorStates == 0
let actorStates := ar_Construct actorStates;
let actorStates := ar_resize actorStates 4;
endif
;=== runs once you enter a new cell ===
if actors == 0
let actors := ar_Construct Array
let actors[0] := ar_Construct actorStates ; Appears to work. No errors.
endif
; <other functions>
;here is my problem, accessing the inner array.
let actors [tempref][1] := 1 ; Errors are "invalid operrand for '[' " / "Too many operands"/ "invalid operrand for ':=' " / and "unknown variable for [tempref] [1] for parameter variable."
end
Looks like I might have to use either the Map array type or use your suggestion QQuix.
The thing that I need is simple in idea. For each refid, I need a sub array of X size to hold arbitrary state variables.
In C I would just do this:
int arrayActors [ 40][ 4 ]; I probably would use dynamic memory allocation (malloc) and a pointer array if I needed on the fly arbitrary outer arrays.
void main(void)
{
arrayActors [0] [0] == 1
printf "Array 0 0 = %d" ,arrayActors [0][0]
}
Hope this helps. (It seems complex, but in theory would be simple if we had multidimensional arrays. lol)



Sign In
Create Account

Back to top








