brand new jass beginner +rep for help

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
ok so i have a grasp on the following:
functions
returns
variables (local and global)
scopes
libraries
how the code compiles

is there anything else major i should learn before i really get started with jass? structs? wierd glitches i should watch out for? conditions? if then else functions?
 

Ayanami

칼리
Reaction score
288
You definitely should go touch up on If/Then/Else, loops. Also, groups would also be absolutely necessary, as well as Timers. After that, you can start coding basic spells. Then after you get comfortable with JASS, you can move on to OOP concepts (Structs, Inheritance, Interfaces, etc).
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
is using timers and groups pretty much the same as using them in gui but with different script?
 

Ayanami

칼리
Reaction score
288
It's not really exactly the same. Especially for Timers. I suggest you search around for tutorials.
 

Dirac

22710180
Reaction score
147
Using timers in JASS is way easier than in GUI because you don't need a timer to detect when the timer expires, take a look at the timer start function
JASS:
TimerStart(timer whichTimer, real timeout, boolean periodic, code handlerFunc)

in the [ljass]code[/ljass] you can write any function name, when the timer ends, that function runs.
JASS:
function Hello takes nothing returns nothing
    call BJDebugMsg("Hello!")
endfunction

function Go takes nothing returns nothing
    call TimerStart(CreateTimer(),5.0,false,function Hello)
endfunction
Functions that handle timer expiration must take nothing and return nothing. For timers there are very useful tools to retrieve data from them once they expire (TimerUtils or T32)

Structs are very important. If you're familiar with array variables then learning what a struct is wont be hard. An example of how a struct really looks like
JASS:
struct GFreak
    integer value
endstruct

->
JASS:
globals
    private integer array GFreak_value
endglobals

I've read some struct tutorials and i think some of them really fail hard because they try the user to understand what a struct is without mentioning the word "array" anywhere.
I think i'll write one of my own soon.
 

Dirac

22710180
Reaction score
147
Ayanami's post is a very decent approach to structs, you should submit it before it dies inside the JASS section. If i had to add something to it, it would be how related structs are with common arrays
JASS:
struct Demonstration
    
    integer value
    
    method setValue takes integer newValue returns nothing
        set this.value=newValue
    endmethod
    
endstruct

->
JASS:
globals
    private integer array Demonstration_value
endglobals

function Demonstation_setValue takes integer this, integer newValue returns nothing
    set Demonstration_value[this]=newValue
endfunction
 

Dirac

22710180
Reaction score
147
That's because struct tutorials fail to explain it, hence i should write one on my own
 

Laiev

Hey Listen!!
Reaction score
188
Don't care about struct right now, just learn Jass and some basic things at vJass :)
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
i understand i think
a struct is a way of creating variables of your own type that stores vast ammounts of information in multidimensional arrays if so chosen correct?
 

Dirac

22710180
Reaction score
147
Yes, the name of the struct encapsulates the amount of arrays inside of it, as well as the methods it contains, therefore you can call structs custom variables, but in the end they're a bunch of common variables and functions piled together.
 

Laiev

Hey Listen!!
Reaction score
188
Also, struct is an integer, so you can always refer it as a integer.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Ok now that last post re-confused me....

Were u meaning every instance/array of a struct or that they can only store integers?
 

Dirac

22710180
Reaction score
147
Array indexes can be only be integers, but you already knew that.
Try reading Ayanami's tutorial and come back if you have any doubts
 

Laiev

Hey Listen!!
Reaction score
188
No GFreak, what I mean is this:

JASS:
struct data
endstruct

call BJDebugMsg(I2S(data)) //this will show you a number from 0-8191 or so
 

Dirac

22710180
Reaction score
147
What? No!

what are integers are the struct instances, struct names lead to nowhere!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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