Variables: Array Sizes, what are their functions?

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,710
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.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
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...
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,710
So, using sizes is like (using loops for (how large (the number of size) is) for that (default value))?
 

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
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.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> 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...
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,710
Oh...I wish I could give you +rep, but you're full.

Thanks for your answer.
 

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
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....
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,710
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.
 

Alphabet

New Member
Reaction score
12
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.
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,710
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.
 

tom_mai78101

The Helper Connoisseur / Ex-MineCraft Host
Staff member
Reaction score
1,710
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?
 

darkRae

Ueki Fan (Ueki is watching you)
Reaction score
173
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?
 

MurderMode

Giving new meaning to co-op... slowly
Reaction score
154
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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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