HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

ARray Size

08-04-2003, 10:26 PM#1
pvxc
In TFT Editor (just got) What is this ARRay Size?

Like when you create an array, what is size meaning.
08-04-2003, 11:31 PM#2
FyreDaug
The amount of indexes it carries.
08-05-2003, 03:18 AM#3
Raptor--
does this actually make a difference though? because how can it know whether i start my arrays at 0 or 1 or something different?
08-05-2003, 03:20 AM#4
weaaddar
your arrays start where ever you want.
You can define the maxium definations here up to 8096 I believe vs the old limit of 1024.
08-05-2003, 04:34 AM#5
FyreDaug
This is just the max value of indecies.
08-06-2003, 06:42 PM#6
pvxc
So what is the point of making it exact? Does it take less space or something? What I am asking is, Is it somehow more efficient if my array size is not more than is necessary?
08-06-2003, 06:54 PM#7
Starcraftfreak
@weaaddar: The max array size is 8112.

I don't know what difference it makes whether you set it or not. But I don't think it takes less space, because if you set it to 10, you can assign values to array[11] too.

I think Warcraft III handles the array internally, that they take just as much space as there are values in it.
08-06-2003, 08:49 PM#8
Taion
The only real purpose is so the WE can initialize the needed slots for some types of arrays.... Here's a quote from Brett Wood on the b.net fourms...

Quote:
3) Arrays are still dynamically sized based on the highest index used. The "preset" size tells the editor to initialize that many elements to the initial value.

This solves an extremely common problem from RoC in which arrays of various handle types (dialogs, unit groups, etc) required manual initialization via custom script code.
08-06-2003, 10:39 PM#9
SentryIII
So let me get this straight. The only purpose for the array size is to define variables at startup? For example, I have an integer array called Numbers. If I set the array size to 12, with an initial value of 5, it will do the exact same as the following trigger, except before it:

Events
Map Initialization
Conditions
Actions
Set Numbers[0] = 5
Set Numbers[1] = 5
Set Numbers[2] = 5
Set Numbers[3] = 5
Set Numbers[4] = 5
Set Numbers[5] = 5
Set Numbers[6] = 5
Set Numbers[7] = 5
Set Numbers[8] = 5
Set Numbers[9] = 5
Set Numbers[10] = 5
Set Numbers[11] = 5

Seems ok to use instead of making all those actions by hand or using a For loop.
08-06-2003, 11:38 PM#10
Taion
Yep. Except it will also set Numbers[12] = 5, since it sets the array to work with either 0 or 1 as the first entry.
08-07-2003, 08:14 PM#11
pvxc
That still doesn't seem all that helpful. Couldn't you just use (to do the above actions)

For each integer A from 0 to 12, set Numbers(Integer A) equal to 5.

Yea, it lets you not have to do that, but that still doesn't really seem THAT great.


EDIT: Oh, I missed where wrote "Use a for loop," which I just expalined.