| 08-10-2003, 09:56 PM | #1 |
Is it possible to create an array that can increase its size whenever needed (like in C++ you can use a list/vector instead of an array).. i beleve the arrays in Wc3 Vanilla editor worked like this, but not now? I really need this because otherwise i have to use 10 arrays with 1000 elements each, and the loading-time after playing the map is quite extreme. |
| 08-10-2003, 10:12 PM | #2 |
Don't quote me on this, but I believe that arrays are kinda dynamic now to the point of 8192 |
| 08-10-2003, 10:16 PM | #3 |
What do you mean? If i put it at max 10, it wont go over 10. Nothing dynamic about it.. And what do you mean by 8192? Is that some max? |
| 08-10-2003, 10:21 PM | #4 |
Yes 8192 is the max, and no dynamic or 3 dimension arrays are not possible in WE. |
| 08-10-2003, 10:23 PM | #5 |
Damnit.. and it not possible to get with any 3rd party program either? Also, 3 dimension? I didnt even know 2 dimension where possible without "cheating" |
| 08-10-2003, 10:24 PM | #6 |
3rd party editors are just mods to the editor that adds extra functions. So no. |
| 08-10-2003, 10:29 PM | #7 |
Uhm, are there no completely new editors? I know there were before, like zepyrs? And do you know why they destroyed the arrays? |
| 08-10-2003, 10:30 PM | #8 |
Zepir did make an editor, but all it is good for is to modify map properties hard coded into WE. I never played with a shitload of arrays until after TFT came out and I started scripting the DC engine. |
| 08-10-2003, 10:34 PM | #9 |
Ahem... this isnt dynamic? Well call it semi dynamic then since you can only increase it. |
| 08-10-2003, 10:36 PM | #10 |
Well I can tell you that if you create an array with size 1, it increases automatically when needed. For instance I am currently using tons of them in my map (with the TFT editor). I create an array of size 1. Then I use -set array[2]=... -set array[3]=... And it works ! These commands are used in game: for instance: set a=1 set variable array[a]=... set a=a+1 -set variable array[a]=... The value of "a" is not predetermined (the editor can't know the maximum value of "a", or it could but it would have too be very smart). You couldn't dream of something more dynamic. Now I am not sure you can do that : -set variable array[2]=... -set variable array[5]=... |
| 08-10-2003, 10:41 PM | #11 | |
Quote:
Hm, thanks, im gonna do a little testing with that. Oh, and Sage, what i want to do is increase in-game, not in the editor Edit- Yes!! It works! And Fyre, what did you mean with that 3d matrixes dont work? |
| 08-10-2003, 10:46 PM | #12 |
If you create an array with size 1 this will show up Code:
local integer i = 0
set i = 0
loop
exitwhen (i > 1024)
set udg_ConstSTRItemNames0[i] = ""
set i = i + 1
endloopThat will set 1024 indecies of ConstSTRItemNames, thus initializing the array. EDIT: You can't have Variable1[Variable2[0]] as an array index. |
| 08-10-2003, 10:50 PM | #13 | |
Quote:
Damn, that wouldnt decrease my loadingtimes.. But what about Variable[((I1 - 1) x MaxX) + I2] ? (And thats 2d matrix, not 3d..) |
