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.
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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