Tutorial Variable Introductory

Indexes*

Let's say you have an Array of units called Units. In Unit[1], 1 is the index. Basically the integer you use to refer to the value.

So if I set size for a timer array to 10, it would go through indexes 1-10 (Timer[1],Timer[2]... etc) and sets them to CreateTimer()

Timer[11] through Timer[8191] would all be set to null (and you can't use anything higher than 8191). That means that you won't be able to use them in any way (unless you know JASS, of course).

Indexes isn't a real word. Indices is just the plural of Index.

Although that's true Darth, things such as integers can still be used from 0 - 8191 without any problems at all. Just set them to 0 when you start using it :)

But, You have got a point there. Timers, Dialogs and some other stuff can't be created in GUI, and have to be initialized.
 
>_> I've always wondered, can you use negative indices? Like: Timer[-58]?
I doubt it.
It'll probably have the same effect as Variable[9994]. Always being null.

You could always use something like this though:
JASS:
function GetUnit takes integer index returns unit
  return UNITVAR[index + 1000]
endfunction

Then you'd have indexes from -1000 to 7191 :D
 
Thanks for clearing things up. I myself learnt something about SIZE too ;)

Updated tutorial.
 
will be set to 'null', and you can't use them in anyway, unless you know JASS

You can. The only ones you can't use are the types which can only be created by setting a default value to the variable.
Some I can name off the top of my head are:
  • Timers
  • Dialogs

And I think Multiboards and Leaderboards, but I'm not certain.

Things such as integers, reals, booleans, units, etc. You can use 0-8191 without any hassle, regardless of the array size you put in.
 
You can. The only ones you can't use are the types which can only be created by setting a default value to the variable.
Some I can name off the top of my head are:
  • Timers
  • Dialogs

And I think Multiboards and Leaderboards, but I'm not certain.

Things such as integers, reals, booleans, units, etc. You can use 0-8191 without any hassle, regardless of the array size you put in.

You forgot about groups (depending on their usage) - if you're using Set Var = Units in... , defaulted array size doesn't matter, but if you're using it for Group - Add/Remove Unit, then the defaulted array size must be sufficient to encompass all the groups you will need

I guess you guys didn't see my first post in this thread. I explained it all in detail. The second post was just a more basic version/example, so the OP could understand it better.

The new edits are much better, nice work! (You also left off the [ /I ] tag at the end of the place where you gave us credit, though. ;))
 
> You can. The only ones you can't use are the types which can only be created by setting a default value to the variable.
Some I can name off the top of my head are:
  • Timers
  • Dialogs
(Romek)


Thanks. I'll update it.

> You also left off the [ /I ] tag at the end of the place where you gave us credit, though. (Darthfett)

Will change.

[DEL]Updating tutorial.. (2% done)[/DEL]
[DEL]Updating tutorial.. (12% done)[/DEL]
[DEL]Updating tutorial.. (27% done)[/DEL]
[DEL]Updating tutorial.. (34% done)[/DEL]
[DEL]Updating tutorial.. (56% done)[/DEL]
[DEL]Updating tutorial.. (77% done)[/DEL]
[DEL]Updating tutorial.. (77% done)[/DEL]
[DEL]Updating tutorial.. (77% done)[/DEL]
[DEL]Update crashed. Reboot update? Y/N[/DEL]
[DEL]Y[/DEL]
[DEL]Updating tutorial.. (2% done)[/DEL]
[DEL]Updating tutorial.. (12% done)[/DEL]
[DEL]Updating tutorial.. (27% done)[/DEL]
[DEL]Updating tutorial.. (34% done)[/DEL]
[DEL]Updating tutorial.. (56% done)[/DEL]
[DEL]Updating tutorial.. (77% done)[/DEL]
[DEL]Updating tutorial.. (84% done)[/DEL]
[DEL]Updating tutorial.. (99% done)[/DEL]
[DEL]Updating tutorial.. (100% done)[/DEL]
Tutorial updated.
 
You might also want to add that most variables (Booleans, Units, Reals, Integers, etc) can be used up to index 8191 without setting the size.
So if you set the size to 0, the default value of the integer (for example) will be null, but you can easily set it using the set action.

Another thing, setting the array size to 8191 will probably make your Init trigger stop on that loop (Hitting the OP limit).
 
But too much information would probably make one beginner's head burst.
 
But too much information would probably make one beginner's head burst.
Well they don't have to read it all at once.
It's related to variables, and as this is a variable tutorial, I believe it is necessary.
 
Well okay. I've updated the tutorial again.

Well.. this thread is 3 pages already and I think it's time for me to get it approved. From what I understood from my tutorial, I realised I was only explaining what variables are in a very detailed way, but I'm not showing any good examples.

All I did was play around with the unit actions. It's 12.09 AM here and I'm going to sleep, but when I wake up tomorrow (or today, well, later, because its a new day already) I'm going to edit the tutorial and add in a new section, where I can provide examples (maybe spells) and I'll show screenshots of the spells to keep readers interested.

G'night.
 
It's not up to you whether it's approved or not.
The content, usability, and originality can affect whether it's approved or not.

Originality is a problem here as there are quite a lot of variable tutorials, each of them explaining the same amount of stuff as this tutorial, or more (Locals?).
 
> I think it's time for me to get it approved.

Haven't slept yet, but I think you misunderstood :p

I actually meant that I have to get it approved not by me.

> The content, usability, and originality can effect whether it's approved or not.

I know it's not original. That's why I'm thinking of adding that new section.. and hopefully it's good :p
 
> You can. The only ones you can't use are the types which can only be created by setting a default value to the variable.
Some I can name off the top of my head are:
  • Timers
  • Dialogs
(Romek)


Thanks. I'll update it.

> You also left off the [ /I ] tag at the end of the place where you gave us credit, though. (Darthfett)

Will change.

[DEL]Updating tutorial.. (2% done)[/DEL]
[DEL]Updating tutorial.. (12% done)[/DEL]
[DEL]Updating tutorial.. (27% done)[/DEL]
[DEL]Updating tutorial.. (34% done)[/DEL]
[DEL]Updating tutorial.. (56% done)[/DEL]
[DEL]Updating tutorial.. (77% done)[/DEL]
[DEL]Updating tutorial.. (77% done)[/DEL]
[DEL]Updating tutorial.. (77% done)[/DEL]
[DEL]Update crashed. Reboot update? Y/N[/DEL]
[DEL]Y[/DEL]
[DEL]Updating tutorial.. (2% done)[/DEL]
[DEL]Updating tutorial.. (12% done)[/DEL]
[DEL]Updating tutorial.. (27% done)[/DEL]
[DEL]Updating tutorial.. (34% done)[/DEL]
[DEL]Updating tutorial.. (56% done)[/DEL]
[DEL]Updating tutorial.. (77% done)[/DEL]
[DEL]Updating tutorial.. (84% done)[/DEL]
[DEL]Updating tutorial.. (99% done)[/DEL]
[DEL]Updating tutorial.. (100% done)[/DEL]
Tutorial updated.

at this, i rofl'ed. and THANK YOU SO MUCH. I am beginning to understand wat variables are in the first place now. now to work on my blink strike....

so to clarify, if i just spam dummy units for a shield effect i will get a serious lag ltr in the game? even if the unit's model animation expires after it appears?
 
If you remove the leaks, I think it should be fine.
However, if you spawn 1000 dummy units at once per every 0.03 seconds, even if you remove the dummies and remove the leaks, I think you'll get a serious lag.
 
I'm having a problem at this part
Q: So how do we travel in time?
A: You must learn how to duplicate units first. After the fourth action, add a 60 second Wait and then repeat the first three actions. Now test the map.
It's not working for me, when I test the map it just shows the starting point, the red buliding, and the default workers it comes with, then it says victory right when the game starts, help=/

ooh, didn't know you could do this ,well this is what it looks likexD
Trigger:
  • Create Unit
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set TestPoint = (Center of (Playable map area))
      • Unit - Create 1 Footman for Neutral Passive at TestPoint facing Default building facing degrees
      • Custom script: call RemoveLocation( udg_TestPoint )
      • Set TestUnit = (Last created unit)
      • Wait 60.00 seconds
      • Set TestPoint = (Center of (Playable map area))
      • Unit - Create 1 Footman for Neutral Passive at TestPoint facing Default building facing degrees
      • Custom script: call RemoveLocation( udg_TestPoint )


If it helps, it's in the folder intialization under the trigger melee initiaionza
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top