• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Questions about JASS

Status
Not open for further replies.
Level 3
Joined
Jun 12, 2011
Messages
21
Hi guys,So I've been working on my map for awhile,and I've been puzzled about JASS.What exactly is JASS?How is it different from GUI?And is there any tutorials on how to use JASS scripts?Because I've been snooping around,and I can't find any tutorials on how to use JASS.

Hope someone can help me out here,thanks!

PS:I hope this isn't the wrong forum to ask.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
This may seem weird at first, but in truth there is only 1 language in Warcraft 3: JASS.
Blizzard tried to make it easy for new users by making GUI, which stands for "Graphical User Interface". GUI is nothing more than JASS-scripts with icons and dropdown boxes.
What is the difference then? Well, Blizzard did a really sloppy job when making GUI. Nearly all functions ('actions') you can use in GUI are slow, and there are a lot of functions you can't even use in GUI!
It is recommended you learn at least a little JASS. This is almost required for spawn-based maps to reduce performance lag (in GUI, the performance of your map will heavily decrease if you don't clean what we call "memory leaks", I suggest reading a tutorial about it or something).

To use JASS, try this: open a map, go to the trigger editor and randomly select a trigger.
Still inside the trigger editor, go to "Edit" -> "Convert to Custom Text" (a warning should appear, just click "OK").
What you see now, is JASS. And this is also how you use it (if you know how to, of course).

But be honest: it now looks ugly. Just black text on a white background.
This is why people (such as Vexorian) have edited the standard editor and made a new one, with a syntax highlighter for JASS (and vJASS, more about that later).
You can get the program here: http://www.hiveworkshop.com/forums/pastebin.php?id=qw5ch1 (it is "jassnewgenpack5d.zip"), you can read the install guide here: http://www.hiveworkshop.com/forums/...456/how-download-install-confige-jngp-160547/.
Now try to convert a trigger to custom text, you'll see that appears a lot better now (the hive workshop uses this syntax highlighter as well).


There are plenty of tutorials on how to use JASS, but the best way to start is by converting triggers and checking what they do.
After converting some triggers, you'll notice that some functions are highlighted red. These are the 'bad' functions (BJ's), as they call more functions.
The next step in learning JASS is learning how to turn those red functions (BJ'S) into purple-ish ones (natives), as natives run faster.
To do this, hold CTRL and click the BJ. A pop-up should appear. Try to understand the logic behind the BJ (if there is any :p) and switch the BJ with the native.

Here's an example:

Say you converted a trigger which adds experience to a hero.

When converted, it could look like this:
JASS:
call AddHeroXPSwapped(1000, udg_Hero, true)
This is simple: it adds 1000 experience to the hero "udg_Hero" (a unit variable) and the "true" means that you can see the level-up graphics.

But it is a BJ!
This is what CTRL + clicking the BJ tells us:
JASS:
function AddHeroXPSwapped takes integer xpToAdd, unit whichHero, boolean showEyeCandy returns nothing
    call AddHeroXP(whichHero, xpToAdd, showEyeCandy)
endfunction

So all you need to do is switch the variables in the correct order and you get this:
JASS:
call AddHeroXP(udg_Hero, 1000, true)
A native, exactly what we wanted.

Of course I picked out an easy example. If you're not sure what all that stuff about "takes", "returns" and "call" is, you could try a simple tutorial.
http://www.hiveworkshop.com/forums/tutorials/ there are plenty of them here
 
Level 3
Joined
Jun 12, 2011
Messages
21
Oh my goodness...Such detailed explanation ap0calypse,I really appreciate it!But its really difficult to understand @..@;

I'll try to understand this thing by meditating in front of my pc for hours now...Thanks again ap0calypse!

P/S:Sorry for late replies,been away from home for some time @[email protected] ap0calpse YOU'RE DA MAN!

Edit:Erm,mind if I ask something?I just messed around with the JASS supported world editor,and is it normal that when I click on test map,it doesn't run the map immediately,instead it runs warcraft?And if I manually try to play the map when the warcraft window pops up,I can't run it.Thanks again ap0calypse
 
Last edited:
I'll just tell you from what tutorials you should start with. This is Jass tutorials main page.

I recommend to start with: Jass beginers tutorial by wyrmlord. Proofs to be the best for any beginer, explained everything step by step.
Rheias's tutorial - very detailed tutorial, discribes very well the start with this language.
Oldschool one. Old, even very old compared to rest, but still great and one the best stuff you can find.

You can follow them by two Daelin's tutorials about tips and variables. Very usefull after getting a bit of knowledge about Jass, gives a better understanding of some important parts of it.
- Jass Tips.
- Variables in detail.

The rest I leave up to you, you can read other great tutorials out there, but I'm pretty sure that after reading all that stuff, you can start with making Jass script on your own. Try to do as many even simple codes as posible, search for answers for any question that's going on your mind, don't fear to ask community for help, and don't forget that the great part of learning comes from looking on others - those know how to use Jass properly. Download Jass spells, try to think what each function does, and why it is needed. Then think about simple modification and try to do it by yourself using that spell as a base, as a teacher. With time you will getting better and better, and when you'll start noticing mistakes that other's have made in thier codes or that something could be improved/is unneeded - that will mean that you've learned enough. Now you can use that knowledge to make your dreams come true or even move to vJass. Good luck.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
Vexorian has the answer to GUI hehe. Probably not the answer you speak but yet funny as shit.
Vexorian said:
SomeRandomDude said:
I wasn't speaking of you directly; there are just certain people who see GUI like some sort of horrid plague and all those who use it must be erradicated and refuse to accept that anything ever can be made in GUI.


That's because it IS a horrid plague.

No kidding, it is like a virus, and the fact this discussion is happening is proof.

GUI must be exterminated, it is a waste of time. I think everyone should be given access to the best tools. A great deal of this is to prevent people from believing it is right to stick to tools that lock people into a mentality that makes the transition harder.

GUI is but a hazard to this improvement, it slows progress. Therefore I'll oppose it as the plague it is.

No wc3c contest I remember had a no GUI rule, I even remember a couple of GUI things that won prizes. I doubt contests will ever have a no GUI rule ([1] which BTW means this whole discussion is as irrelevant as a cow's sense of smell) But that doesn't change the fact GUI is a really , really, really bad tool, forcing people into a low spectrum, making them think they are "weaker", and wasting their time.

A community in which GUI is accepted is not healthy, because GUI forbids modularity and sharing code. Sure attempts to defeat these weaknesses happened, that's how things like WEU happened (and as you already know it sucked terribly). GUI is a complete antipattern, and it is very harmful. People that think it is some sort of standard or that it is all right would often frown upon you for not using GUI in your spells because copying a text trigger is too hard for them.

These are the reasons I have opposed GUI ever since I noticed for the first time how it doesn't allow sharing code. Even when Jass kept crashing and causing tons of issues, it was better than GUI.

People that can't get over the "GUI is all right" mentality, should really drop coding altogether and focus on things like art (hence the reason wc3c welcomes some of them) else they are just harmful to the community, as in really.

I actually started with GUI and making tools for GUI like some things in UMSWE (that then were added to WEU), with time it was clear enough that GUI is a solution looking for troubles and the difficulties it adds to everyone's lives are way too large in comparison to any 'good' thing about it (which are actually nil so far).



Anyway, because of [1] and because there is already a decision about the olympics (wait for Sunday for a conclusion on what's going to happen) this thread is useless and therefore I am closing it.


Edit: To add, I did not begin with this strong opposition to GUI as a plague, it started with the likes of weaaddar, dataangel and Kattana, honestly if it wasn't for them I would have stayed with GUI and that's just plain wrong.

I think that though some people may see it as elitism, there is probably not a better solution to the GUI problem than being aggressive to them. I see some sites out there, and perhaps because of some attempts to be nice, GUI ressurfaced as something acceptable and it is only making the Jasser's lives harder, just like in the old times. What I see in the other sites is more of a reason to know that I should keep my strategy.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Oh my goodness...Such detailed explanation ap0calypse,I really appreciate it!But its really difficult to understand @..@;

I'll try to understand this thing by meditating in front of my pc for hours now...Thanks again ap0calypse!

P/S:Sorry for late replies,been away from home for some time @[email protected] ap0calpse YOU'RE DA MAN!

Edit:Erm,mind if I ask something?I just messed around with the JASS supported world editor,and is it normal that when I click on test map,it doesn't run the map immediately,instead it runs warcraft?And if I manually try to play the map when the warcraft window pops up,I can't run it.Thanks again ap0calypse
You're welcome.
And no, that's not normal. You made a mistake, so the map doesn't start :)
Also, nobody said it was going to be easy...

Baassee: great quote :D
 
Last edited:
Level 20
Joined
Jul 6, 2009
Messages
1,885
Edit:Erm,mind if I ask something?I just messed around with the JASS supported world editor,and is it normal that when I click on test map,it doesn't run the map immediately,instead it runs warcraft?And if I manually try to play the map when the warcraft window pops up,I can't run it.Thanks again ap0calypse
You have to save the map before testing it.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Not if he's using regular JASS, which I believe he's doing (vJASS would be a bit too early, wouldn't it?)
I just messed around with the JASS supported world editor,and is it normal that when I click on test map,it doesn't run the map immediately,instead it runs warcraft?And if I manually try to play the map when the warcraft window pops up,I can't run it.Thanks again ap0calypse
He probably means JNGP (both according to the underlined text and the error he described) here in which case he has to save map before testing.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
He probably means JNGP (both according to the underlined text and the error he described) here in which case he has to save map before testing.
I wonder where he learned how to use vJASS-only functions then, because all tutorials here are linked to regular JASS.
Even with JNGP, you can test the map without saving (unless you use vJASS, obviously).
That error can also occur if you made a mistake in regular JASS, and coincidentally, only with JNGP his described error would happen (as the regular WE would disable the incorrect triggers and then run the map).

Saving wouldn't solve his problem is he's not using vJASS (which I truly believe he isn't), he would indeed see the errors, but that doesn't mean he actually understands where he went wrong (takes a while to get accustomed to that).
 
Level 3
Joined
Jun 12, 2011
Messages
21
Um...What's vJass?And yeah,it seems when I fixed some jass stuff in the triggers the map runs properly.So...I don't know when or where,but somewhat I kinda fixed the error for now...Thanks for all the tips!I think I've learned alot from masters like yourselves.Thanks!
 
Um...What's vJass?And yeah,it seems when I fixed some jass stuff in the triggers the map runs properly.So...I don't know when or where,but somewhat I kinda fixed the error for now...Thanks for all the tips!I think I've learned alot from masters like yourselves.Thanks!

vJASS is also JASS but vJASS makes coding more easier, a good example of this is the variable editor, in normal JASS, usually you click CTRL+B and set your variables and put the prefix "udg" like >>> udg_UNIT when coding...

But in vJASS, the variable editor is completely useless since you can declare variables in blocks and the prefix 'udg' is not needed...

vJASS global declarations...
JASS:
globals
   unit UNIT
endglobals
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
vJASS is also JASS but vJASS makes coding more easier
To elaborate (as this may sound strange): although you are seemingly able to use new stuff in vJASS (see above post for the "global" declaration, for example. Structs, scopes and libraries are other common examples), all vJASS is converted to regular JASS when saving the map.
This is also why you must save the map before testing when using vJASS (what Garfield basically said).

Everything you can do with vJASS, you can also do with JASS. The difference is that it's often really annoying to do it with JASS (or you just don't know how to do it).
So vJASS makes it easier, but vJASS itself cannot be read by Warcraft (Warcraft is made for 1 language only: JASS). You have to convert it to JASS before you're able to play (again, this is done by simply saving the map).


Aside from global declaration (and probably scopes and libraries as well), most things vJASS introduces are for more advanced users who are already familiar with JASS.
 
Status
Not open for further replies.
Top