A Few JASS Questions

ShadowInTheD

Active Member
Reaction score
12
I have a few questions that I don't understand in JASS.

1. Events: How do they work? I've seen them called and I've seen the function with InitTRIGGER_NAME_Initiation and stuff like that.

2. Simple question: Are the spaces before calls and sets and other things like that required, or can the be any amount?

3. Does ANY error in the trigger cause WE to crash when saved, or is it specific types of errors?
 

Charapanga

New Member
Reaction score
46
1. What do you mean? They work exactly how GUI ones do and function InitTRIGGER_NAME is where the trigger is created and actions are added to it

2.WRONG:
JASS:
localunitu=GetTriggerUnit()
setu=GetEnteringunit()
callpauseunit(u,false)

Acceptable:
JASS:
            local                 unit                u            =               GetTriggerUnit()
             set          u              =            GetEnteringUnit()
             call         PauseUnit(    u     ,         false)

Best:
JASS:
    local unit u = GetTriggerUnit()
    set u = GetEnteringUnit()
    call PauseUnit(u, false)


i hope that explains it

3. Not all trigger errors crash WE, syntax checker just pops up and alerts you of the errors
 

ShadowInTheD

Active Member
Reaction score
12
I'm still not sure about 1. and 3.

1. Does the name of the actual trigger function determine ANYTHING about the function? Such as... InitUntitled_Trigger_001_Initialization. When I convert GUI to JASS with a Map Initialization event, it gives a different trigger name than when I use an event such as A unit dies.

3. What are things that WON'T crash WE?

EDIT: Also, what does the CreateTrigger() thing do?
 

Charapanga

New Member
Reaction score
46
1 The name can be either InitUntitled_Trigger_001_Initialization or Blabliblubla it will still create the same trigger...you just need to add the correct Event to the trigger

3 Simple syntax errors wont crash WE or when you miss something out or stuff like that...but triggers will rarely crash WE
 

Monovertex

Formerly Smith_S9
Reaction score
1,461
3. Does ANY error in the trigger cause WE to crash when saved, or is it specific types of errors?

Things like not having an endloop or not putting // when using models paths will crash your WE when saving the map. You should use NewGen, as this enhanced editor compiles the code with its own compiler and won't crash.
 

ShadowInTheD

Active Member
Reaction score
12
I don't get the triggers' names. When I turn a trigger with events, conditions, and actions, it will have names like "Trig_TRIGGER_NAME_Actions", but when called, it's just "TRIGGER_NAME", why?
 

chobibo

Level 1 Crypt Lord
Reaction score
48
If a trigger doesn't have a called event, is it assumed to be fired at Map Initialization?

No, you have to check the run at map Initialization checkcox below the Trigger Editor's toolbar.

EDIT: oh, already answered... sorry
 

Charapanga

New Member
Reaction score
46
You can change the Function names, the function names are not important! You just have to check which function is which
 

ShadowInTheD

Active Member
Reaction score
12
NVM, I'm just blind, sorry about the last question ><

What does set gg_trg_TRIGGER_NAME = CreateTrigger( ) do exactly, make the trigger?
 

Romek

Super Moderator
Reaction score
964
JASS:
gg_trg_TRIGGER_NAME = CreateTrigger( )

gg_trg_TRIGGER_NAME is a global.
generated global trigger

= means the variable will be set to what follows the sign.
CreateTrigger() returns a trigger handle.
 

Romek

Super Moderator
Reaction score
964
Is there a trigger called "Help2" on the trigger list?

Alternatively, use a local trigger. It's independent from the name of the trigger object.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top