| 12-24-2006, 04:51 AM | #1 |
This is a series of JASS tutorials for the brand new learner. It breaks down the aspects of JASS into easy to follow lessons. This is an ongoing tutorial, and any and all feedback is greatly appreciated and wanted. We are still working on this, more lessons are on the way! Rule of Thumb: Me and Moyack's tutorials will be in Word Document form; Wyrmlord's will be in HTML (a webpage basically). Credits are given to: Darkwulfv (Intro) Wyrmlord (Lesson 1) Darkwulfv (Lesson 2) Wyrmlord (Lesson 3) Moyack (Lesson 4) Wyrmlord (Lesson 5) Darkwulfv (Lesson 6) Wyrmlord (Lesson 7) We hope these tutorials will help! Make sure that if you plan on repping, you rep all of us (if you can). We are all working on this together. Happy JASSing! ~Darkwulfv, Wyrmlord, Moyack, and The)TideHunter( UPDATE: 5/1/07 ~Latest version is up, redownload!~ |
| 12-24-2006, 04:59 AM | #2 | |
Intro: (By Darkwulfv) Quote:
|
| 12-24-2006, 04:12 PM | #3 |
The same as Lesson 1 in the first post, only formatted with HTML to improve how it looks. Hmm, I can't upload HTML files so here's a zip file with the HTML file inside of it. |
| 12-24-2006, 10:02 PM | #4 |
Hi, if you use friging gVim (use google) and JASS.vim (my sig) you can highlight vim code and save the highlighted code as html (kind of like WE/JASSHelper readmes) |
| 12-24-2006, 10:45 PM | #5 |
Lesson 2 is here!! It's in the first post. |
| 12-25-2006, 12:40 AM | #6 |
... Nice to know... Any comments on the tutorial(s)? or didnt you view it/them? |
| 12-25-2006, 01:31 AM | #7 | |
Quote:
EDIT: A bit confused as to how to use gVIM with Vex's file. EDIT 2: I think I figured out the gVIM thing, and now here's lesson 3: Functions |
| 12-25-2006, 03:59 AM | #8 | |
Quote:
... I meant It would be good to have highlighting in the html, another way would be to use the pastebin to generate the highlighting and then merge stuff, it was easier for me with vim. .. Edit, I see you got able to highlight it, I think I am gonna wait till you finish everything and then you have the entire tutorial in a single zip. And then aproval, there are also chances it is gonna require corrections, I think griffen had something to say |
| 12-25-2006, 08:29 AM | #9 | |||||||||
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
TIME FOR CHALLENGE! Quote:
|
| 12-25-2006, 08:39 AM | #10 | |||
Quote:
I'd say that incredibly stupid comment almost invalidates your entire post. Quote:
If I had to give one reason to go to JASS from GUI, I would just say GUI arithematic. There's nothing like having to redo a whole 20 window calculation to change one thing. (joking obviously >.>) Quote:
Only if you're still using normal WE and don't use a separate text editor with PJass. |
| 12-25-2006, 08:40 AM | #11 |
MERRY CHRISTMAS |
| 12-25-2006, 11:24 AM | #12 |
I agree with Blu, GUI arithmatic was hell. Especially the long stuff. JASS is just plain easier than GUI once you learn. Anyone have any useful critique or suggestions on how to make this tutorial better? |
| 12-25-2006, 02:10 PM | #13 |
My critique is useful. |
| 12-25-2006, 06:46 PM | #14 | |||
Tutorial No 4. if/then/else and loop structures. By Moyack. These kind of structures are the most important in any programming language. In JASS, these structures are quite versatile and useful. Let's see the first structure: IF/THEN/ELSE To work with it, we can write it in this way. if/then/else structucture:if <condition 1 function or variable> then <Condition 1 script> elseif <condition 2 function or variable> then <Condition 2 script> ... else <Else condition script> endif Now you understand why I said versatile :) As you can see, the conditions must be a function which have to return a boolean variable type (true/false) or a boolean variable. Other interesting feature with the if/then/else structure in JASS, is that it can be used as a multiselection structure too, something very useful in many cases. In order to ensure the understanding of this structure, This is a small example showing the IF/THEN/ELSE in action IF/THEN/ELSE example:function Set_Damage_To_Unit takes integer level returns real // this example will set the damage amount in a spell, according to a level // (unit level, ability level, etc) local real dam if level < 2 then set dam = 0 elseif level == 1 then set dam = 50. // probably you noticed the point after the number. this is used to indicate the number is a real one. // Is a good programming practice to do that in order to avoid annoying debugging mistakes. elseif level == 2 then set dam = 63. elseif level == 3 then set dam = 125. else set dam = 125. + 50. * (level - 1) return dam endfunction Here, we are using a local variable which will have a value according to the input argument in the function, and then that variable will be returned by the function. Important note:
Now let's see the LOOP structure. Loops in programming are used to make a set of instructions to be executed several times. Loops can be classified by finite and infinite, the finite loops are which have a defined a fixed number of repetitive executions, controlled by an exit control. The Infinite loops in the other hand, will execute the script contained in it indefinitelly. The loop structure is as following: JASS:loop <Here you can put code too :)> exitwhen <condition function or variable> <your iterative script> endloop This structure is quite flexible as you can see, because you can put the exitwhen condition in ANY place inside the loop. Let's see an example. Loop example:function Heal_Unit_Group takes group g returns nothing // this example will heal all units in a unit group. local unit u // a local unit variable loop set u = FirstOfGroup(g) //Selects the first unit in the group. exitwhen u == null // the loop will finish when the group will be empty, // in tother words, when the FirstOfGroup() function returns null call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_MAX_LIFE)) //sets the life of the selected unit at its maximum. call GroupRemoveUnit(g, u) // removes the unit from the group endloop call DestroyGroup(g) // to avoid group leaks, we must destroy the group variable. endfunction The usage of FirstOfGroup and group functions inside a loop is very common in AOE spells, with them we can do several things to a unit group. Some tips with loops:
Exercise:
Good luck :) |
| 12-25-2006, 08:41 PM | #15 |
If I had time, i'll learn JASS straight away, with these, also merge posts as well. -Av3n |
