• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

JASS worth learning?

Status
Not open for further replies.
Level 6
Joined
Apr 5, 2013
Messages
154
Are there any up to date guides? Beginning JASS Tutorial Series I just don't understand where to input the code from the first part of that tutorial.
When I convert it into a custom text I get the following:
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
Where am I supposed to input the "hello world" stuff? Is the pre-existing code supposed to be there at all? This is really confusing.
 
Elemental Coder Guide - here are some other JASS tutorials mentioned.

Is the pre-existing code supposed to be there at all? This is really confusing.
Yes, it's normal that there is a default code when you convert from GUI to custom script.

A GUI trigger can have events, conditions, and actions. "Event" is something that a trigger is registered to. Actions and Conditions are "functions" that are executed when the trigger runs by the registred event.
Now, for arranging this all, we need to make operations to create a trigger, to bind the event to the trigger, and to define functions as actions, or conditions. This all happens automaticaly in GUI, and the user can't see this. If you convert the GUI trigger to JASS, then you can see the "Actions" function, which is the function which does hold all actions of the trigger, and a "Init" function, which does create the trigger and binds the action to it.
 
Level 6
Joined
Apr 5, 2013
Messages
154
Hmm, sounds logical. I'll try it out soon.

Edit: So here's what I got
Code:
function Trig_Trigger1 takes nothing returns nothing
call DisplayTextToForce( GetPlayersAll(), "Test" )
endfunction

//===========================================================================
function InitTrig_Trigger1 takes nothing returns nothing
    set gg_trg_Trigger1 = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Trigger1, Player(1), "Test", true )

endfunction
You can probably see what I tried to do, player 1 types "Test" and the game prints "Test". It's not working, though.
 
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
Hmm, sounds logical. I'll try it out soon.

Edit: So here's what I got
Code:
function Trig_Trigger1 takes nothing returns nothing
call DisplayTextToForce( GetPlayersAll(), "Test" )
endfunction

//===========================================================================
function InitTrig_Trigger1 takes nothing returns nothing
    set gg_trg_Trigger1 = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Trigger1, Player(1), "Test", true )

endfunction
You can probably see what I tried to do, player 1 types "Test" and the game prints "Test". It's not working, though.

The code is not wrong, you just need one more line.
Use "call AddAction(yourTrigger, yourFunction)
 
Level 11
Joined
Jun 2, 2004
Messages
849
I've always felt GUI triggers to be an excellent introduction to programming. It was pretty much my introduction as a kid.

JASS is nice too though I'm not sure it's worth it solely from an educational standpoint. It's got some oddities like its verbosity and the details of how it handles containers (uniform and enforced size of arrays, bolted on and clunky nature of hashtables, type specificness of stuff like unit groups...). If one can do GUI triggers fine and wants to program proper, I'd suggest moving on to python and do some hello world stuff. After that, a strongly typed language like java or some flavor of c. After that one is very much enabled to do any sort of hobbyist programming project and well on their way to being a programmer.
 
Last edited:
Level 12
Joined
Jun 15, 2016
Messages
472
In my opinion, JASS has some nice aspects of visualizing what you do with the code very early on. Also, some of the constraints JASS has requires you to utilize certain programming conventions. but this is the bare basics, after that what kaijyuu said is probably more accurate.
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
So you want to know if it's valuable to learn other languages before JASS? I think it is, but if your end goal is to learn JASS, then you don't need to delve too much into them. Once you've grasped the logic behind writing the program, parameter passing and basic function calls (from the API or your own), you're good to go.

Reversing your question, let me tell you, if you intend to learn other programming languages after JASS, then know this:
JASS is totally worth learning!
  1. When I enrolled in university and attended my first Java classes, I quickly grasped the basics of Object-Oriented Programming (OOP). But guess what! I had never learned vJASS before my enrollment!

    On most OOP language tutorials, everything the objects do is happening inside the computer. You don't really see it. But with Warcraft III, you do; units, destructibles, items. When you think of a unit, you realize it has properties that you can manipulate. For example, the unit's position on the map. Then, when you see the function SetUnitPosition(unit u, real x, real y), it makes absolute sense. This function grabs the unit you specify, and changes its coordinates to a (x,y) of your choice. From there to getting used to the traditional OOP dot notation is a very short distance. ;)

  2. Problems with JASS: it's clumsy, leaks memory for every reason imaginable, and has a fair amount of overhead also for mostly silly reasons. And guess what. This is also great! When I started C classes, the whole deal with memory management didn't seem strange to me at all. And the overheads? They get you thinking on efficiency.

  3. Finally, it won't be strange if you start writing large pieces of code. Then you open it up again a few weeks later and don't have a clue what you did. This gets you thinking on code commenting.
    Though possibly less successfully :croll:
This, of course, not to mention you'll never struggle with the initial impact of meddling with operators and function calling in a computer science degree, if you ever choose that path. ;)
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Yes it does make learning other languages easier, however learning any programming language does the same.

If you plan to make complex maps with WC3 then learning JASS is highly recommended as GUI is kind of rubbish. If you just want to mess around and experiment with WC3 maps then GUI is sufficient.
 
Status
Not open for further replies.
Top