Simple Variable Question

Cfw_Master

New Member
Reaction score
1
I've been reading many guides on triggers but I couldn't figure out what variables with a [1] or [2] were.

When I created my own variables, I couldn't create them with brackets at all.

Thanks for your help!
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
When creating the variable, there is a checkbox "Array". Make sure that is checked :)

You don't need to change the number next to "Array", you can leave it as 1 and still be able to make as many arrays as you want.
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
When creating the variable, there is a checkbox "Array". Make sure that is checked :)

You don't need to change the number next to "Array", you can leave it as 1 and still be able to make as many arrays as you want.


To a point you do not need to change the 1, but if you plan to use the array in a loop then you will want to set the array to be larger or it wont work for any array over 1.
 

Dois

New Member
Reaction score
1
umm

why? why dont we need to declare how large the array is in the first place???
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
To a point you do not need to change the 1, but if you plan to use the array in a loop then you will want to set the array to be larger or it wont work for any array over 1.

Really? Never noticed that before. o_O
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
humans have imaginations, we look at the array and can imagine a larger number then is specifyed in the code, so we refrence these larger numbers, now the game AI on the other hand has no imagination, it takes what is written as unchangable fact and wont even try to refrence above any limit placed in front of it, in short the game AI is like a religous fanatic, even if you point out conterdictions to it in the bible (the game data) it wont bodge on what it belives to be true.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
To a point you do not need to change the 1, but if you plan to use the array in a loop then you will want to set the array to be larger or it wont work for any array over 1.

This has only a little bit of truth to it.

Variables such as Units, Points, Integers, Players, etc. do not need to be initialized, so it does not matter what you put for the array default value, and how many array members are set to the default. However, some variable types have to be initialized before they can actually be used, such as Unit Groups, Player Groups, Timers, and a few others.

For Unit Groups and Player Groups:

If you do not initialize these, and try to Add Units/Players to these groups, it will not work. The Group does not yet exist. However, if you create a group for these variables, either by using the "Set Unit_Group = (Units ....)" or by simply initializing it, you can add Units/Players to these groups.

Timers simply have to be initialized, since it's not possible to create a timer in the GUI (without JASS custom script).

@Dameon

Computers are not magical, or anything like that, they are purely logic. :p They do what they are told. If you try to tell the computer to do something illogical (such as adding units to a nonexistent group), it will simply say "I can't do that!" and give an error telling you why it was unable to do what you told it to do.

Warcraft III (this is true for a lot of programs) simply has a lot of fallbacks (programmed into the game), so that even if you tell it to do something impossible (such as create a unit at a non-existent location), it will simply try and do something alternative (such as create the unit at the center of the map, as a default location).

There are a lot of other fallbacks you simply don't notice, such as dividing by 0. Warcraft III would rather crash the thread if it finds one of those, rather than the game. Then, Windows would rather crash the game, than let the game try to calculated X / 0, which prevents a blue screen of death (the computer would run out of memory, since it is an infinite equation that has no real answer).
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
If you read my post that is prety much what I said only in way better words then I used. Also I have actualy devided by 0 in triggers a few times with no crashing, it must have to be done in a certain way or maybe I found a loop hole, also if you reread my post I said to a point you wont have the change the 1 for the loop, I never said you absolutly had to set it higher.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • 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

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top