JASS 101 Classroom

Status
Not open for further replies.

PurgeandFire

zxcvmkgdfg
Reaction score
509
K I'm in.
So are you PMing us or posting, because PM would make my life easier :eek:

ZOMG! :eek:

The almighty, Anti-JASSer, JASS repellant, GUILuver, GUIStayer, Non-JASS, GUIFtw, dude elmstfreddie is going to learn JASS??!?!?!

Wow, these classes thing are revolutionary! :D

*Still Gaping out of suprisement* :eek: :eek: :eek: :eek: :eek:
 
I

IKilledKEnny

Guest
I'm nervous so many people sign up... Whaty if I suck? :p

> im in!

Added

> TY IkilledKEnny for helping the classroom program

With great pleasure

> Steel

The first lesson will have kind of mini-dictionary. I'll add that up to lesson plan.

> Sign me

Done

> K I'm in

Finally famous elmstfreddie will get to learn JASS. :p

> So are you PMing us or posting

Posting, it would be easier for me with all those members. ;) Also PM have few limitations...

> count me in

Yup.

> KilledKenny, would it be easier if we told you our email addresses so that you could just chain mail us when classtimes are?

All who intrested may send me a PM with their E-mail and I will send them a massage. (Added to first post)

Edit:

I decided to add 2 more chapters, "Groups & Forces" and "Your first trigger", I thought maybe Groups & Forces were a little too advanced, but I think youi can handle it. :) As the 8th chapter ("Your first trigger") I will simply show you how to create trigger from nothing to a cpmleted working one.
 

Omni

Ultra Cool Member
Reaction score
37
sign me in

well then sign me in i'd like to learn JASS
will you also be showing what you can do in jass that's impossible in GUI?
Edit: dont add me so fast!
 
I

IKilledKEnny

Guest
> will you also be showing what you can do in jass that's impossible in GUI?

Of course.

> Edit: dont add me so fast!

I like to be efficent. :cool:
 

Tom Jones

N/A
Reaction score
437
I hope your ready for the task :)

If you need any verifications of the statements in your lessons, your welcome to PM me.

Oh, and good luck by the way. I'm thinking about teaching Jass Advanced, so I'll be following the class' from the sideline to get a point of view, and to see how it works.
 
I

IKilledKEnny

Guest
> I hope your ready for the task

Same here. :p

> If you need any verifications of the statements in your lessons, your welcome to PM me.

Thanks a lot, you are willing to help as always, however I wouldn't choose to teach stuff that I don't know so I should be fine.

> good luck

Thanks

> I'm thinking about teaching Jass Advanced

Sign me up. :p
 

Omni

Ultra Cool Member
Reaction score
37
>I will post every Friday, starting from 27/4/07 (April 27/07)

with 8 lessons it would take months for this to end:p ,
coulndt you give lessons a bit more often? (or is that too much)
 
I

IKilledKEnny

Guest
> Omni

It would take about 2 months, yes. It's not hard for me, actually first lesson is already half done, but the lessons are long, and I want to give you some time to read it. If anyone prefers the lessons to be posted every 4 days or so, please say so, if I get lots of votes, then I would change the posting dates.
 
I

IKilledKEnny

Guest
Ok, I have decided that a week between each class is too long. So I have decided to post a class every Tuesday and Friday. Private Massges will be sent to all students when a class has been submitted.
 

waaaks!

Zinctified
Reaction score
255
nice...good thing youve decided that, because our class starts on June, and maybe i can submit assignments or exercises and stuffs like maps with the assignment because i cant play my WE and wc3, but i can pass assignments like scripts and codes....
 
I

IKilledKEnny

Guest
> because our class starts on June

If you mean this class then it starts tommorow (I should edit the first post...)
 
I

IKilledKEnny

Guest
JASS 101: Basic Jass Classrom
Lesson 1: Basic JASS

Greetings

So this our first lesson, hello to you all! This thread begun 5 days ago and now here is the first class. The next class will be posted in 3 days at Friday, you may send in the assignments any time between now and then. If you forgot what this thread is then just go on and read the first post. You may still be added to the class if you want just send me a private massage to me, I will not accept assignments by unregistered members, however anyone may read this of course. I hope you will enjoy. I urge you to suggest and ask questions if you don’t understand something.

Lesson Plan
What is JASS?
Working with JASS
Trigger Conversion
Links that have something to do with JASS
Conclusion
Assignments

This is roughly the lesson plan. The lesson is separated into chapters to ease the reading process. I suggest reading the lesson’s chapters in their order. Skipping on things will shorten the read; yet, it might stop you from understanding things that will be written later on.

What is JASS?

In this chapter we will discuss, what JASS is, compare it to GUI and few general notes will be written

JASS is the language of World Editor. Like in any other program language, you type commands, you don’t click on commands. What that means is that World Editor can read scripts only, it can’t read what we call clicks. That is very odd, why then can you click on actions, conditions or events and World Editor still reacts the way I expected it? As I said World Editor reads nothing but script so it shouldn’t be able to understand the clicking. Well Blizzard (The creator of Warcraft), being generous (a rare event) created GUI system (stands for Graphical User Interface) which makes the programming to new mappers easier. GUI is famous of it’s simplicity, and of how inefficient it is compared to the original language, JASS.

However that still doesn’t explain how we can program using GUI. Well when you click using the blizzard made charts, World Editor converts it to script, so it could read it. So understanding from that, GUI is nothing but few charts which help you write triggers, which are in the end converted to a text, and that text, which is the actual trigger, is called JASS.

Ok, so we know JASS is the script that builds GUI, which is nothing but a nice way to present the triggers in World Editor, however we must always keep in mind that GUI is merely an introduction, it is not as fast, efficient nor powerful as JASS. But, it’s not enough that you know GUI is not as good as JASS you need to know why. Quoted from the introduction:
1. Few features that can be found using JASS are simply impossible to be done using GUI. Parts of them can be done, but you need to use advanced and complicated GUI. Those include special JASS actions, local variables, complete leak removal (there are leaks which you can’t remove when you use GUI, such as BoolExprs leaks, even when using custom script) and more.
2. JASS is cleaner. I know it seems like gibberish to you now, but pretty quickly you will find how easy it is to read JASS compared to GUI.
3. JASS if faster, you can do stuff in minutes were in GUI they could half an hour at least. Besides, it was tested, typing is faster the clicking.
4. JASS takes less memory space, in small maps it doesn’t matter that much, however in big massive maps it can changes the map’s size dramatically.
5. When knowing advance JASS (after many months of learning) you can actually create systems and new actions, yes, yes, I’m not lying. The best example would be KaTTaNa’s handle system. I won’t go into what it does, because simply it would do nothing but confuse you.
So, there is no doubt that JASS is the better then the program that is based upon it, GUI. Many members know that, however they don’t go on to learn JASS because they think they are not good enough with GUI or that JASS is too hard and not that good compared to GUI and all kind of nonsense. The problem is, if you like World Editor, it is a hobby that you spend time on; you need to learn JASS to get the best of it. Anyway what people say to themselves about JASS is usually wrong because they didn’t try it yet. More information about false myths about JASS can be found at the top part in this tutorial made by emj|r3.
In summary, GUI is a graphical feature made by Blizzard to aid new mappers in learning World Editor. While GUI is a good way to be introduced to World Editor, it’s not nearly as good as JASS for many reasons.

Finally one note is need to be noted. JASS is powerful tool, might sound silly but sometimes it’s too powerful, using it incorrectly, can crush Warcraft in the middle of a game and sometimes it can even crush World Editor when saving it, so there are few steps we need to follow to make sure saved data will not be lost when working with JASS. See the chapter “Working with JASS” in this lesson to know more.


Working with JASS

In this chapter I will explain oh to work with JASS most efficiently, avoid certain ‘dangers’ that there are in JASS and such

The most important thing we need to know when working with JASS is that we are working is World Editor it self, unlike GUI (reminder: Graphical User Interface), JASS is NOT safe; doing things improperly will cause crushes. However, don’t worry this could be stopped easily, and anyway after few weeks you should be able to avoid those crushes easily. See more in Known bugs thread made by Blade.dk.

First of all I suggest having at least 1 out of the 3 famous JASS programs (see in this lesson the chapter “Links that have something to do with JASS”) and working with one of those programs, they are much easier to work with (again see chapter “Links that have something to do with JASS”).

If you decide to work inside World Editor and not inside one of the programs above, I suggest keeping the trigger which you are working on disabled. Also add comments to yourself around the trigger, incase you start a trigger one day and you want to finish it in the other, without comments you might have a hard time understanding what you did.

Side note: Comments can be made easily by putting // in front of the comment, once you typed // the trigger will ignore the rest of the line allowing you to type things freely with no effect on the trigger.

Side note: Disabling trigger means the map will ignore the trigger, it is still there, written, however the map will not read it. When a JASS trigger was written badly, the map will not be able to understand it and will disable the trigger; unless you fix the problem and re-enable the trigger it will have absolutely no effect on the map. If you want to disable a trigger unmark the box above the trigger text that reads ‘enable’.

Lastly you need to make sure you save data all the time so when unexpected event happens you could retrieve any lost information easily.

Following those steps will prevent unpleasant events that may occur when inexperienced mapper uses JASS improperly.

So to make sure we are in the same head before continues let’s go over it one more time. JASS is powerful and can crush World Editor in extreme cases, knowing that we need to make sure we do anything we can prevent that. Do to do that we can either work with JASS programs, which have lots helpful features, or working with World Editor but keeping the trigger which you work on disabled. Always when working with JASS you need to save you map again and again (this goes to GUI too, but it is more important when triggering in JASS). I personally suggest working with JASS programs, if you want to learn more about JASS programs, keep reading this lesson. Also, it’s always good to leave few notes around the trigger.

So you know how to prevent data from being lost when not being careful, but that’s not enough, you want also to know how to work the fastest, naturally. Well the first problem you will meet as a starting JASSer is not knowing commands. For example you won’t know how to do to make the order “move unit (instantly)” in JASS. Well the first way will make the command in GUI and then covert it to JASS (see “Trigger Conversion” chapter later in this lesson). This way, while easier, is not recommended (more detail in chapter “JASSCraft and commands” in “Lesson 2: JASS Commands”). The other way is using the programs (see “JASSCraft and commands” and “Links that have something to do with JASS”).

Those two ways are the fastest ways to learn how to use new commands. The second tip is planning roughly your trigger before working on it. If it is a long, complicated one then you will need to write down, or keep in mind how to do certain things, when and where to right commands etc.

So we know more or less how to avoid crushes and how to work quickly. Unfortunately with your limited knowledge at the moment I will not be able to explain further those matters.

So that’s it for this chapter, we will discuss a little more on how to be efficient in few other chapters.

Side note: You can add auto save effect when going into the main World Editor screen File > Preferences > General > Check ( / Mark / V) Autosave and write down seconds. However I don’t suggest using this.

Side Note When working with JASS you can’t use ctrl+z (well you can but it would make unexpected things), so be very careful so you won’t make big mistakes because then it would be hard to fix them.

Trigger Conversion

In this chapter I will teach you how we can create JASS trigger. Also we will convert few triggers together.

Now let’s see how can start writing in JASS. By default when you create a new trigger it is a GUI trigger, thus you use chart and click to edit, you don’t type, and thus you don’t use JASS. How then do you set a trigger to be JASS trigger? Well there 2 ways to do it.

The first way, which is not recommended, simply optional is making custom script. Go to actions > -General > Custom Script and then type in command. Why isn’t this good way to work with JASS? Well of all it would make the trigger almost unreadable as well as it would take double the time to make trigger like this. And anyway there is no reason using that over the second way. Custom script is made if you want to add only few JASS lines, but keep the rest of the trigger in GUI.

The second way, is selecting the trigger and then going up to Edit > Convert to Text (click ok in the massage that will appear) and viola you got a trigger written in JASS that is also editable in JASS.

Now create a new blank trigger, and convert it to JASS in the second way that was taught (from now on I will refer to that way only). You should see this.

Code:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

This is a converted blank trigger in GUI gentlemen. You may ask “How did 0 lines turn into at least 10 lines?” well not to worry at the end of this classroom (in a month if everything goes smoothly) you will understand this and much (much) more. I just wanted to show you how does a converted trigger might look like.

Challenge 1: Spot the comment in the trigger we converted.



If you said that the comment is
Code:
//===========================================================================

Then you were right, comments come after // like we said in the previous chapter. We could delete this line and it wouldn’t affect the trigger even one bit. Why do we have it then? No need to know it now, it simply separates 2 part of the trigger with a comment. Ignore this.

Challenge 2: Now I added few comments to the trigger, you need to find out how many comments there are.

Code:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing // Hi
endfunction

function InitTrig_Untitled_Trigger_001 takes nothing returns nothing // I hope you are enjoying this class
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction // If not then I’ll make sure what happened to Kenny will happen to you too.



If you found 3 comments then you were 100% right, good job.

Now let’s go on and add few actions, conditions and events.

Code:
Untitled Trigger 001
    Events
        Time - Elapsed game time is 5.00 seconds
    Conditions
        (Number of units in (Units in (Playable map area))) Greater than 0
    Actions
        Player - Set Player 1 (Red) Current gold to 750

Now convert it to JASS. If you followed the steps properly you should now see this:

Code:
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
    if ( not ( CountUnitsInGroup(GetUnitsInRectAll(GetPlayableMapRect())) > 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    call SetPlayerStateBJ( Player(0), PLAYER_STATE_RESOURCE_GOLD, 750 )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Untitled_Trigger_001, 5 )
    call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

Now, that’s nice bit of programming, right? Don’t worry, JASS is much simpler the converted GUI, converted GUI is bad, keep that in mind. I only showed you this so you will understand how to properly convert GUI trigger.

Now, do you remember in the previous chapter I asked you how could we know how to type new commands such as “move unit (instantly)”

Well the first problem you will meet as a starting JASSer is not knowing commands. For example you won’t know how to do to make the order “move unit (instantly)” in JASS. Well the first way will make the command in GUI and then covert it to JASS (see “Trigger Conversion” chapter later in this lesson).

Well you should know how to do that already.

Challenge 3: Try to find out alone how we move unit instantly in JASS.



If you succeeded you should have gotten:

Code:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    [b]call SetUnitPositionLoc( GetTriggerUnit(), GetRectCenter(GetPlayableMapRect()) )[/b]
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

Let’s see how we can get to that. Create a blank trigger and add in the action “Move unit instantly”. Now go on and convert the trigger to JASS. That’s it you know how to do it, the bolded line is the action.

Relax, you shouldn’t understand any of this, I just want to make sure you understand how to convert a GUI trigger and using that to find out how to write JASS commands, after few lessons you should be able to understand more from the bolded line.

So that’s it for this chapter, you are welcomed to move to the next one.

Links that have something to do with JASS

In this chapter I will link few links that could help you with your JASSing

Websites:

The Jass Vault is a website created by KaTTaNa (famous for his / her handle system) which is dedicated to JASS.

The wc3c another website about World Editor, many thehelper.net members are members in wc3c as well.

Specific Threads / Forums

The index a famous pinned thread in thehelper.net, got links to many tutorials, look for the JASS category.

The JASS Zone in thehelper.net, a whole forum about JASS.

wc3c's JASS tutorials, this link holds 22 JASS tutorials.

wc3j's JASS tutorials holds 12 JASS tutorials

Programs:

JASSCraft - My favorite JASS tool, I suggest downloading this.

JASS Shop Pro - Another software made by the same author (Zoxc), a good software as well, but not as JASSCraft in my opinion.

JASS Editor - I don’t like that software, however some people do.

I suggest downloading at least one of those programs. I personally like JASSCraft best, and in the future there will be even a chapter about it. However JASS Pro Shop is similar to JASSCraft so downloading either could help you understand the chapter. I don’t like JASS editor so I won’t talk about that software.

Conclusion

We learned that JASS is the programming language of world editor. JASS is better and more complicated in GUI, there is not doubt that JASS > GUI, the hard part however will be learning it. Also we learned that JASS is powerful and we must use it properly to avoid any dangers with it . Finally I have shown you few little JASS triggers and links that will help you with your JASSing.

Assignments

In this lesson I will give you 1 an easy assignment because you know very little at the moment, however soon the homework will be harder. :) Create a trigger in GUI that will create for player red (1) a unit of type footman in the middle of the map when a footman owned by him dies. After that covert it to JASS and add at least 5 random comments around the trigger. Assignment Challenge: If you want a bit of a challenge, try to find out what each of the JASS trigger’s lines do (or at least few of them) and say so using comments. This will need time, logic, and self teaching, however if you are determined you should be able to do this.

Note about the challenge: You need to find out lines that have 4 spaces before them(“ “) only, no need to know what the rest of the lines do.
 

Attachments

  • JASS 101 Lesson 1.doc
    54.5 KB · Views: 330

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
u forgot to add the program tool: "TESH" it might be useful for the new guys...
 

waaaks!

Zinctified
Reaction score
255
sorry cant post assignment, wc3 destroyed and 4 wc3.mpq's are missing or accidentaly deleted, aww...
 
I

IKilledKEnny

Guest
> "TESH" it might be useful for the new guys

It's not as famous as the others and it works very differently (it edits World Editor, it isn't a whole new software).

> sorry cant post assignment

No problem, you don't have to post assignments, just a suggestion to make sure you understood what we talked about.
 

rodead

Active Member
Reaction score
42
rodead's homework

this is my homework i atacked it in a map here is the code

Code:
function Trig_create_unit_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetTriggerUnit()) == 'hfoo' ) ) then
        return false
    endif
    return true
endfunction

function Trig_create_unit_Actions takes nothing returns nothing
    call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), GetUnitLoc(GetDyingUnit()) )
endfunction

//===========================================================================
function InitTrig_create_unit takes nothing returns nothing
    set gg_trg_create_unit = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_create_unit, Player(0), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_create_unit, Condition( function Trig_create_unit_Conditions ) )
    call TriggerAddAction( gg_trg_create_unit, function Trig_create_unit_Actions )
endfunction
 
Status
Not open for further replies.
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top