• 🏆 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] 1774 compile errors in 187 lines? wth?

Status
Not open for further replies.
Level 8
Joined
Aug 4, 2006
Messages
357
i have a JASS trigger 187 lines long, that comes up with 1774 compile errors when i save it in world editor. world editor does not disable the trigger. when i run the syntax check in JassCraft, it finds no errors with the trigger.

does anyone have experience with a problem like this? have any ideas what might be causing it without having to wade through all my code?
:sad:

Edit: I tested to make sure the syntax checker was working properly by putting in stuff that isn't JASS, and it detected it. So, it probably is not something wrong with JassCraft.
 
Level 4
Joined
May 17, 2008
Messages
75
Certain errors mess up the compiler and cause it to register absurd numbers of additional errors. In general you should focus on the first error.

Specifically, what is the first error?
 
Level 8
Joined
Aug 4, 2006
Messages
357
first error: Expected a name
"function forForceActions takes nothing returns nothing"

ok before i go posting the whole trigger, i have a question about functions in triggers. can you call a function from any trigger, or only the functions declared in the current trigger? if you can, then i need to change some function names (like "forForceActions") that i used in multiple triggers. that might be the problem.
 
The function declared in a trigger can be used in all triggers BELOW that trigger in the trigger list.

The only problem is when you create a new trigger. The functions you declare in the new trigger cannot be used by the other triggers that already exists, because its code will be put in the end of the map's code no matter where you put the trigger. To solve that, close and reopen the map.

And, sometimes, the true error is one line above the line indicated. Pay attention to that line :p
 
Level 8
Joined
Aug 4, 2006
Messages
357
the line above was blank, and the one above that was blank, and the one above that said "endfunction."

i changed the name of the function to something that wasn't used by another function in a different trigger, and it saved properly. what you said makes sense. then wc3 can just define all the functions in order, at the beginning of the map script, and call them whenever the triggers are executed. +rep


Edit: I now have another related problem. you said a function declared in a trigger can be used in all triggers below that trigger. i declared a bunch of functions in my initialization trigger (which is at the top), and i tried to call a couple functions from it in later triggers. however, world editor disabled all the triggers referencing these functions when i saved the map. wtf? the errors all said "expected a function name".
 
Last edited:
Did you create the initialization trigger, wrote the functions, and then tried to use functions in the other triggers that ALREADY existed before you create it?

If so, that's the problem. Open your map again and try to enable them and save it again.

That's because, when you create a new trigger, no matter where you put it, it's code will be saved in the end of the map's code. So, in fact, the trigger's code was AFTER every other trigger.

So let's say you have a trigger #1. Then you create the trigger #2, put it in the top of the list, and write some functions. Before you close'n'open the map, you won't be able to call those functions at #1 :p
 
Status
Not open for further replies.
Top