Problem with array definition in script
Posted: Tue Jun 24, 2025 4:28 pm
Hi.
I'm currently simplifying the exported text from my Sheet to my ZGE project. So I'm trying to declare arrays in script.
Instead of doing this:
I'd like a simpler :
string[39] Alphabet = {"A","B","C",...};
But I get 'Assignment destination must be variable or array: Alphabet'
The problem is that even the example in the Help file of ZGameEditor is not working:
byte[] data = {1,2,3,4}; // initialization of 1D array of bytes
I'm currently simplifying the exported text from my Sheet to my ZGE project. So I'm trying to declare arrays in script.
Instead of doing this:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
<OnLoaded>
<ZLibrary Comment="Constants" HasInitializer="1">
<Source>
<![CDATA[
{
Alphabet.SizeDim1 = 39;
Alphabet[0] = "A"; Alphabet[1] = "B"; Alphabet[2] = "C"; Alphabet[3] = "D"; Alphabet[4] = "E"; Alphabet[5] = "F"; Alphabet[6] = "G"; Alphabet[7] = "H"; Alphabet[8] = "I"; Alphabet[9] = "J"; Alphabet[10] = "K"; Alphabet[11] = "L"; Alphabet[12] = "M"; Alphabet[13] = "N"; Alphabet[14] = "O"; Alphabet[15] = "P"; Alphabet[16] = "Q"; Alphabet[17] = "R"; Alphabet[18] = "S"; Alphabet[19] = "T"; Alphabet[20] = "U"; Alphabet[21] = "V"; Alphabet[22] = "W"; Alphabet[23] = "X"; Alphabet[24] = "Y"; Alphabet[25] = "Z"; Alphabet[26] = "0"; Alphabet[27] = "1"; Alphabet[28] = "2"; Alphabet[29] = "3"; Alphabet[30] = "4"; Alphabet[31] = "5"; Alphabet[32] = "6"; Alphabet[33] = "7"; Alphabet[34] = "8"; Alphabet[35] = "9"; Alphabet[36] = "-"; Alphabet[37] = "."; Alphabet[38] = " ";
}]]>
</Source>
</ZLibrary>
</OnLoaded>
<Content>
<Array Name="Alphabet" Type="2" SizeDim1="39"/>
</Content>
</ZApplication>
string[39] Alphabet = {"A","B","C",...};
But I get 'Assignment destination must be variable or array: Alphabet'
The problem is that even the example in the Help file of ZGameEditor is not working:
byte[] data = {1,2,3,4}; // initialization of 1D array of bytes