Another Jass Question

adeoin

Member
Reaction score
11
Would a jass trigger mess up if i accidently added 1 too many parenthesis or 1 too little? Also how would i know what each line meant? like this...

GetSpellAbilityUnit how do i exactly know what that means. Jass Craft lists them all but i dont know what they all mean and how they are used

EDIT: Since I already posted 2 other threads I'll just ask another question here.

I got basic JASS down except for the part at the bottom. Creating actions and conditions and the gg_trg_ thingy. I have no idea what that part is. Could any explain in detail what that place really is all about
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
Would a jass trigger mess up if i accidently added 1 too many parenthesis or 1 too little?
Yes.

Also how would i know what each line meant? like this...

GetSpellAbilityUnit how do i exactly know what that means. Jass Craft lists them all but i dont know what they all mean and how they are used
You learn them the same way you learn anything else. Look up what you need to know, gain knowledge from experience, take advantage of the extremely intuitive names of most functions, etc...
 

Matrixboy

New Member
Reaction score
1
Would a jass trigger mess up if i accidently added 1 too many parenthesis or 1 too little? Also how would i know what each line meant? like this...

GetSpellAbilityUnit how do i exactly know what that means. Jass Craft lists them all but i dont know what they all mean and how they are used

Yes, it will mess it up-- but it will not pass the syntax checker. It'll give you an error with a line. You'll notice your mistake (hopefully, or you'll start disecting your crazy inlining code you were just working on) and throw in the right parenthesis where it belongs.

Well, that's one thing I've always had problems with in JASS. Most of the natives (that I've had to use, anyway. I haven't experimented with cinematics really...) seem to be intuitive, but there are some that really knock you on your ass as to what they do.

The best way to understand what they do is look at what they take, and what they return.


As an example, I opened the API browser on sourceforge. No clue at all what this function could do

native GetUnitCount (integer unitid) returns integer

Well, the name can help us a little. GetUnitCount. Something about units, and counting them. But is it units owned by a player? All the units in a game?

We then see it takes an integer that is a unitid. (aka, it takes a unit). So, it takes one specific type of unit, and returns an integer. It must give us all of those _specific_ units that are currently on the map. So, if you ever wanted to know how many footmen all the humans made in a melee game, you'd use that.


And don't really bother going into creating your own triggers for now. Learn to add Actions, but don't bother with setting up the initialization trigger-- you need a global variable declaring the trigger exists, or you have to run a pre-global trigger that'll then call the local trigger. For now, it's not something to worry about.
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
> I got basic JASS down except for the part at the bottom. Creating actions and conditions and the gg_trg_ thingy. I have no idea what that part is. Could any explain in detail what that place really is all about

Example:

JASS:
function Init takes nothing returns nothing
        local trigger trig = CreateTrigger()    //Create the trigger, you can replace gg_trg_blabla with a local one since a variable name is more convenient than the whole gg_trg_blabla.
        call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)  //Registers an event to the trigger named "trig". The event in this case is "A unit starts the effect of an ability"
        call TriggerAddCondition(trig, Condition(function Conditions)) //Adds a function named "Conditions" as the conditions for our trigger named "trig"
        call TriggerAddAction(trig, function Actions) //Adds a function named "Actions" as the actions for our trigger named "trig"
endfunction


That's basically the idea behind it.
 
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