Personally I find it quite irritating that when making an array variable, you have to take 1 off the size because a size 2 array means the last index is 2, not 1, so really it's a size 3 array (0,1,2). So many arrayOutOfBounds errors because of this confusion...
Yeah, I am annoyed at them as well. Not because of that, you just enlightened me, lol. In my case it is more because I am used to languages like Java or C#, where I can just get the size of the array from the array instead of having to remember it (or have I missed something?).
@Vexal I keep getting out of bounds because it's confusing to keep track of what's the size, and what's one less than the size. Sometimes I go one over by accident.
EDIT: I mean I try to compensate by making an array of "sc2 size" 3 instead of 4 if I want it to really be of size 4.
I just make all my arrays size 100000 so I never have to worry about size. For example, if I have 100000 unit array, but only ever have 3 units, I can be sure everything will be safe and error-free.
As a side note, to make a dynamic (integer) array I used a string that has each integer separated by a white-space. Since I was just pushing items on the top I could just concatenate a " " followed by the number (converted to string). Then you can use blizz's action of 'get word of string' to return the index :D
I use this in Death Haven when spawning the waves.
@Vexal I keep getting out of bounds because it's confusing to keep track of what's the size, and what's one less than the size. Sometimes I go one over by accident.
EDIT: I mean I try to compensate by making an array of "sc2 size" 3 instead of 4 if I want it to really be of size 4.
I suppose you could try using constants to declare your array sizes, then use those constants when looping(?) your array later. You won't have to remember the size, just remember the name of the constant you use.
In Warcraft III it would automatically resize an array if you tried to assign something out of bounds... I guess that would probably slow down the program anyways...
I'm annoyed by arrays in any language. I started programing with PHP, which has dynamic arrays, and I really got used to that... and not having to declare every little variable at the start ;(
Static vs dynamic languages is a discussion with a lot of different point of views. I personally prefer direct control over what type I am using, but that is just a personal preference. However, Galaxy really doesnt seem to handle arrays very well. Have only worked with the GUI, though, but I really wish arrays could be created and grow or shrink in a more dynamic way (as I said, only used the GUI, so it may be possible in Galaxy).
@Tolkfan: Go
...but I really wish arrays could be created and grow or shrink in a more dynamic way (as I said, only used the GUI, so it may be possible in Galaxy).
In Warcraft III it would automatically resize an array if you tried to assign something out of bounds... I guess that would probably slow down the program anyways...
Warcraft III did not have dynamic arays, but static ones, and even worse, with a fixed size of 8192. For SC2 and it's script memory size limit, this would be devastating.
Aye, got confused. There was this save bug, where the 8192th slot gets deleted, so actually only 8191 slots were useable. And since it starts with 0, the highest useable index was 8190, thats where the number came from :)
Aye, got confused. There was this save bug, where the 8192th slot gets deleted, so actually only 8191 slots were useable. And since it starts with 0, the highest useable index was 8190, thats where the number came from :)
The bug occurs when you try save and load a map. The 8192nd slot is not save and thus always null after loading.
Warcraft III did not have dynamic arays, but static ones, and even worse, with a fixed size of 8192. For SC2 and it's script memory size limit, this would be devastating.
Not sure what qualifies as dynamic, but if you make an array in warcraft 3 of size 2 (for example), and you go over it, it works fine, leading me to believe it is resizing the array. I've done this many times, I know it works.
Personally I find it quite irritating that when making an array variable, you have to take 1 off the size because a size 2 array means the last index is 2, not 1, so really it's a size 3 array (0,1,2). So many arrayOutOfBounds errors because of this confusion...
the galaxy arrays are strange. made my arrays with a size of 7 to cover player 1-6 until i recognized these arrays are size+1
How could you possibly have more out of bounds errors if your array is bigger than you expected, not smaller...
Arrays go from 0 through size (inclusive) in order to help developers who have never used an actual programming language.
Arrays are 0-size. So in total it has 1 more than the size you set (Which is 0).
@LazyCoder: Go
Yeah, I am annoyed at them as well. Not because of that, you just enlightened me, lol. In my case it is more because I am used to languages like Java or C#, where I can just get the size of the array from the array instead of having to remember it (or have I missed something?).
@Vexal I keep getting out of bounds because it's confusing to keep track of what's the size, and what's one less than the size. Sometimes I go one over by accident.
EDIT: I mean I try to compensate by making an array of "sc2 size" 3 instead of 4 if I want it to really be of size 4.
I just make all my arrays size 100000 so I never have to worry about size. For example, if I have 100000 unit array, but only ever have 3 units, I can be sure everything will be safe and error-free.
@Vexal: Go
lol.
As a side note, to make a dynamic (integer) array I used a string that has each integer separated by a white-space. Since I was just pushing items on the top I could just concatenate a " " followed by the number (converted to string). Then you can use blizz's action of 'get word of string' to return the index :D
I use this in Death Haven when spawning the waves.
I suppose you could try using constants to declare your array sizes, then use those constants when looping(?) your array later. You won't have to remember the size, just remember the name of the constant you use.
@FuzzYD: Go
That would work. But it is still annoying you just cannot ask the array for its size :P.
what me annoys most is that we cant declare arrays with dynamic size (constants) in gui.
why? =/
In Warcraft III it would automatically resize an array if you tried to assign something out of bounds... I guess that would probably slow down the program anyways...
Rather, why aren't vectors a data type in Galaxy?
I'm annoyed by arrays in any language. I started programing with PHP, which has dynamic arrays, and I really got used to that... and not having to declare every little variable at the start ;(
@Tolkfan: Go
Static vs dynamic languages is a discussion with a lot of different point of views. I personally prefer direct control over what type I am using, but that is just a personal preference. However, Galaxy really doesnt seem to handle arrays very well. Have only worked with the GUI, though, but I really wish arrays could be created and grow or shrink in a more dynamic way (as I said, only used the GUI, so it may be possible in Galaxy).
It is not.
Warcraft III did not have dynamic arays, but static ones, and even worse, with a fixed size of 8192. For SC2 and it's script memory size limit, this would be devastating.
8192.
Aye, got confused. There was this save bug, where the 8192th slot gets deleted, so actually only 8191 slots were useable. And since it starts with 0, the highest useable index was 8190, thats where the number came from :)
The bug occurs when you try save and load a map. The 8192nd slot is not save and thus always null after loading.
Somebody screwed up there :)
Not sure what qualifies as dynamic, but if you make an array in warcraft 3 of size 2 (for example), and you go over it, it works fine, leading me to believe it is resizing the array. I've done this many times, I know it works.