Variables: Array Sizes, what are their functions?

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,751
In theory, variables with arrays in WE would look like this:

Variable[x]: Size 1.
Variable[x][y]: Size 2
Variable[x][y][z]: Size 3
etc.

But from sources within WE Help Zone, some people say that array sizes can only be 1, and will never go past 1. Some people would say that sizes being how large would affect the map size. Some, with experiences, like Acehart, would say that sizes can change everything to a variable.

I know about size 1 arrays, but what else are the sizes 2 and up are for? A grid? Or a plane? Or it's just an unconventional bug Blizzard developers missed out on?

As a Japanese man would say, "It would be an honor to understand the mysteries around us..." :rolleyes: Maybe...

What are they exactly for? Their functions? Not how to do it, or what is an array, or something tutorials would mention about.
 
All arrays can hold precisely the same maximum number of values. 8192. And it starts at 0. And you do not want to use the final index 8191.

The size determines how many values, from 0 to that size, limits included, are initialized with the default value.

The default value, for example on player groups, is an empty group.
Do you expect "Player group - Add <player> to Group[10]" to work if that group has not been created yet?

Map size? Nonsense.

8000 as size? Your "init" triggers will reach the operations limit and never make it to the end...
 
So, using sizes is like (using loops for (how large (the number of size) is) for that (default value))?
 
array sizes have nothing to do with creating a grid or plane, it's just how many seperate peices of data you can tie into 1 variable.

A variable with no array holds a single amount of data, whether it be an integer or a unit or whatever.

A variable with an array size of 1 can hold two lots of data, one in the array '0' and one in the array '1'.

An array with the size of 99 stores one hundred peices of info, starting at 0 and going up to 99.

It's basically just so you can use one single variable for a specific number of tasks. A good example being when you want to use a unit variable for a hero on each team. If there are 12 heroes all up, the minimum size array you would use is 11 (however i would make it 12 so that it's easier to set player 1-12 to it's specific number, and I just wouldn't set 0 to anything).

I don't know where you got ur idea that array sizes can only be 1, I have seen another thread you have posted that you are using (integer A) with the integer ranging from 1-6 and 7-12 ..... that's an array size of 12 right there in your own trigger...

oh and I don't know what the 'variable [x][y][z]' is supposed to mean.... notice that in a variable array the part in the square brackets says [index] when u need to set it.

here is a dictionary meaning for index - 2. a sequential arrangement of material, esp. in alphabetical or numerical order.

what I am trying to say is that a variable is like a book... and the array is the pages. On page 1 you draw a druid, on page 2 you draw a shaman and on page 3 you draw a warlock.

book_variable[1] = druid
book_variable[2] = shaman
book_variable[3] = warlock

...it's that simple.
 
> So, using sizes is like (using loops for (how large (the number of size) is) for that (default value))?

If you create, for example, an array of type integer, with size 5, and a default value of 3, the editor will add something like this to your map:

For each Integer A from 0 to 5, do
- Set myArray[Integer A] = 3


You can still use myArray[42] if you want... however, don't try to use it before you actually set it to something...
 
Oh...I wish I could give you +rep, but you're full.

Thanks for your answer.
 
Did I just write that for the fun of it or did you actually read it and understand what an array is :S

or did I completely misunderstand the question because to me it looks like you don't get the whole point of an array, and you might be confusing yourself in it's use if you don't grasp the basics first....
 
I can't comprehend your post, just below this "An array with the size of 99 stores one hundred peices of info, starting at 0 and going up to 99." line. Acehart said it like it was in a loop.

So, I took the Simplier English. Sorry if it bothers you. And since you're not as full as Acehart, for your efforts on that post up there, +rep.
 
or did I completely misunderstand the question because to me it looks like you don't get the whole point of an array
Or maybe you're the one not getting it? :) A variable with array 1 can store more than 2 values as you claimed (and as I've read many times, so not blaming you or anything). As Acehart said: "The (array) size determines how many values, from 0 to that size, limits included, are initialized with the default value". It doesn't determine the amount of slots that can be used.
If you don't believe it otherwise, you could try making an integer with array size 1 and try out these actions:
Code:
Actions
    For each (Integer A) from 1 to 100, do (Actions)
        Loop - Actions
            Set i[(Integer A)] = (Integer A)
            Game - Display to (All players) the text: (String(i[(Integer A)]))
            Wait 0.10 seconds
Works perfectly.
 
If I were to make a variable sized 2, what would it look like in the triggers? Sized 3?

I'm comparing, if you wanted to know the reason why I ask these questions.
 
So, size 1 variable is: Variable[x], where x stands for a number.
Size 2 and 3 doesn't show anything else in the triggers?
And that's it, no other kinds?
 
x stands for the index.
Size 1 and 2 or 3 just show how many Default Values have been set for that variable.

What other kind?
 
alphabet what you typed was an array size of 100 tho... setting the value of the index to integer A from 1-100 means it's looping for each value.

With integer A being from 1-100, your index value is actually going to loop like this -

Integer A = every number from 1-100

i[integer A] = i[1], i[2], i[3], i[4], i[5], i[6]... all the way up to i[100].

that is a variable with and array size of 101 (if counting an i[0]), not 1 array.

It's probably why tom was getting confused with what an array is (ie. assuming it becomes a grid whenit increases in number).... because people think that integer A counts as an array size of 1... when it's actually whatever u set integer A to be. I wasn't responding with a post to say setting the array size is or isn't necessary, I was just trying to clarify what the numbers mean in an array.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top