• 🏆 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] Weird syntax error

Status
Not open for further replies.
Level 10
Joined
Jan 21, 2007
Messages
576
Alright so I am getting a weird syntax error in my code and I don't know why, I think it might be something with the map itself unless I am missing some small detail because this code was working before.
JASS:
library CWonhit initializer init requires CWdummy
function E1 takes unit t returns nothing
    call Cast(GetOwningPlayer(c), 'A000', t) 
endfunction

function Hit takes unit t, unit c, integer i returns nothing
    if i == 1 then
        call E1(t, c)
    endif
endfunction

function init takes nothing returns nothing
endfunction
endlibrary
This line:
JASS:
function E1 takes unit t returns nothing
Prompts a syntax error.
 
Level 10
Joined
Jan 21, 2007
Messages
576
I realize the colors don't work, thats what the edit was for. And that is the whole trigger D=, thats why it's weird. Was working before as well.
 
Level 10
Joined
Jan 21, 2007
Messages
576
This is vjass, but otherwise I am not sure what your question is for what do you mean talking about simple jass? Kind of an irrelevant question.
 
Level 10
Joined
Jan 21, 2007
Messages
576
Well, this is vjass.
EDIT: Did some more experimenting and if I remove the function that is getting a syntax error it just hops down to the next function, even hopping from trigger to trigger =/.
 
Level 10
Joined
Jan 21, 2007
Messages
576
Nah I don't care, figured it out. The init function of my first trigger had endfuncion instead of endfunction.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
function E1 takes unit t returns nothing
call E1(t, c)
Ok um you are passing a function which takes 1 parameter 2...
This might not be causing the error you are getting but is an error non the less.

Secondly, make sure you have no other function called E1 difined in your map. If you want the function bound to the library use the private or public keywords. Unless you bind it to a library, it will be as if the function is difined outside the library and so if 2 functions have the same name it will cause an error.
 
Level 10
Joined
Jan 21, 2007
Messages
576
It wasn't before, I must have had my cursor there and accidentally bumped delete or something o_O. But I love that as soon as I post the thread after like 10 minutes of "...wtf" as soon as I post a thread I figure it out.

DSG: Yea I was just fucking around with the parameters seeing if that was the cause of the problem, and I was initially going to have the E# functions called from outside of the library that is why they are not private yet, this error kind of disrupted everything heh.
 
Status
Not open for further replies.
Top