I haven't tested it in AGS 3.2 yet, only the 3.2.1 Beta, but if I use a static variable (such as Room.Height, System.ViewportWidth, etc.) in the index of a dynamic array (by itself or as part of an expression) then I get a compile-time error. If there is an expression used (i.e., an arithmetic applied to the value) then I get "parse error in expression near [array name]", otherwise I get "parse error after '['".
It's reasonably simple to work around, I just store the static variable's value into a temporary variable and it compiles properly.
this is a general problem with the compiler using static variables inside a non-static, you get the same problem with:
int hour = DateTime.Now.Hour;
It does need to be fixed.
Yeah, I was aware of the issues with accessing a non-static member of a static member of a class. I wasn't sure if it was actually related since dynamic arrays aren't (at least on the user-side) tied to structs at all.
Anyway, since this is compile-side, is there a technical reason why the engine would reject it? Meaning, with the editor being open-sourced, would it be possible for this issue to be addressed by anyone right now, or would it still cause runtime issues?
It's an issue with the way the compiler parses expressions containing static variables.
It's purely a compiler error, the engine would accept it fine. However the compiler is part of the Native DLL which is not yet open-sourced.
Ah, yes. I later asked myself whether it might be there..
Very well then. :) Thanks for the info nonetheless.