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!
 
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.
 
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.
 
umm

why? why dont we need to declare how large the array is in the first place???
 
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
 
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.
 
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).
 
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.
  • 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

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top