JASS: Moving From GUI to Jass, the Start

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
yeah u make me more understand about return
+rep
_______
SPREADING xIDS
 
H

Hjalle

Guest
Im a total beginner at JASS (almost really), so this helped me alot. Good tutorial. At last i understand the return, takes things :p

+rep and 5 stars :)
 

l46kok

TH.net Regular
Reaction score
6
on your tutorial, you introduced an example about multiplying function

JASS:
function multiply takes integer a, integer b returns integer
    local variable counter = 1
    loop
        exitwhen counter > b
        set a = a + a
        set counter = counter + 1
    endloop
    return a
endfunction


Suppose the parameter given for this code is

a = 3
b = 3

which the result should return 9 right?

However, if you actually run the code, you would get 12 if you examine the loop since a gets a + a

First loop : 3 + 3 = 6
Second loop : 6 + 6 = 12
Third loop : Counter = b, loop exits here

You might want to make some changes :D

Sorry about double post. I thought that you should include a warning about global variables.

In any practice of computer programming (Yes, this includes JASS), it is almost always a good idea to avoid global variables. They are usually considered bad practice precisely because of their nonlocality: a global variable can potentially be modified from anywhere, and any part of the program may depend on it. A global variable therefore has an unlimited potential for creating mutual dependencies, and adding mutual dependencies increases complexity.

Furthermore, the use of global variables makes software harder to read and understand. Since any code anywhere in the program can change the value of the variable at any time, understanding the use of the variable may entail understanding a large portion of the program. They can lead to problems of naming because a global variable makes a name dangerous to use for any other local or object scope variable.

Well I suppose, in a few cases, global variables can be suitable for use. For example, they can be used to avoid having to pass frequently-used variables continuously throughout several functions.

But the bottom line is, unless if you are absolutely sure that having a global variable would be advantageous in your code, avoid using them.

P.S : (I do not understand why JASS tutorials here do not emphasize this enough. This is a crucial matter in programming).
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Very nice spotting about the function, I will fix it right a way. Thanks!

As for global variables, I agree with you completely, most people agree that locals are better then globals, and locals should be used if possible.
 

Naminator

Coming Back To Life
Reaction score
76
It really made me saw Jass in a different way. Help me a lot!

+Rep. Really good tutorial!
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Great tutorial, it was really helpfull.

Actually, isn't JASS similar to Visual Basic?

People say it is, I have no idea, I never bothered learning C++.

~Gals~, yes locals, if used correctly make a good MUI spells.

So, mods / admins, what's happening with this tutorial, is it approved or disapproved?
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
no idea...many tut just scattered around...+rep and push to 5stars :D
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
> So, mods / admins, what's happening with this tutorial, is it approved or disapproved?

Well, at least it's not in the Graveyard yet. :p

> you could get rid of the center alignment from the table of contents and use the default font, as well. Makes easier to read.

I DO agree with that. Somewhat. I think you should make the headers for each of the sections larger and maybe bold, then make the sub-headings beneath them smaller. Also, you might add a blank line between each big section.
 

Tinki3

Special Member
Reaction score
418
>is it approved or disapproved?

I vote for approval.
-Long, and explanatory
-Useful
-Adds to the 'JASS Tutorial' collection(*)

>at least it's not in the Graveyard yet

Wait, AceHart's lurking around the corner!
Joking :p

(*) Wait, that is a good thing, right?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
> I vote for approval.

Is there a poll on it? :p Make it happen, then.

I agree. The content certainly warrants approval.
 

Weebl

New Member
Reaction score
5
Very nice tut. I've read a few but they all manage to make even the most basic things look really scary. This however was really comprehensive and made it perfectly clear to me just how simple JASS actually is to learn.

O and by the way I disagree with all the people who say this is too long. Although I don't like unneccessarily drawn-out tuts, this one only takes half an hour (maximum) to read and it teaches you ALL the basics. As far as I'm concerned anyone who isn't willing to spend half an hour learning a comlpete new set of tools shouldn't call himself a modder.
 

cowmenace

New Member
Reaction score
22
I knew absolutely nothing about jass, custom scripts, I was hardcore GUIer I took this tutorial I understand functions, loops, ifthenelse, and so much more that looked like gibberish. Only took me about 1 hr to get thnx u r awesome!!!!!
 

mr_fj

New Member
Reaction score
10
OMG OMG OMG Thank you so much. If you havn't written this, i would never have begun learning Jass. Thx +rep (and maybe next time i see you post somewhere, because of this toturial ^^)

Thanks.























Thanks again :D



















Last time: THANKS!!!! THX THANK'U XD XD XD
 
M

MeRn00b

Guest
WoW, Thats truly a 11 of 10
Goodbye GUI, Hello JASS
+Rep
You really, really did create, it's like >:eek:< just simply amazing

~My thought is, lucky me, for waiting to learn JASS~
 
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