• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

JASS problem

Status
Not open for further replies.
Level 3
Joined
Mar 27, 2009
Messages
30
I'm not so good at jass, altho when i see code i can see what it does. (logics ftw) My friend sent me a map and told me to add some stuff he wanted. The triggers are made in GUI, but converted to jass to save space. Anyway, I use NewGenWE, and on one map i got an error from jasshelper:

Line 1324: Function refeclared: InitGlobals

The InitGlobals trigger i found was on line 308, and that's the one i want. The otherone has some stuff missing, and some stuff wrong (as far as i can se). I need to delete one of them, but i don't know how to find the one i want to delete. And maybe, the one i think is the correct one might not be the one i should use.

Here are the triggers:

The one jasshelper found on line 1324:
JASS:
function InitGlobals takes nothing returns nothing
 local integer i = 0
set udg_currentlevel = 0
 set udg_wavetimer = CreateTimer()
 set udg_creepdead = 0
 set udg_currentlevel_num = 0
 set i = 0
 loop
 exitwhen (i > 8)
 set udg_Kills[i] = 0
 set i = i + 1
 endloop
 set udg_creep = 0
 set udg_CurrentPlayer = 0
 set i = 0
 loop
 exitwhen (i > 8)
 set udg_Player[i] = 0
 set i = i + 1
 endloop
 set i = 0
 loop
 exitwhen (i > 2)
 set udg_Playerranking[i] = 0
 set i = i + 1
 endloop
 set udg_EndingTimer = CreateTimer()
 set i = 0
 loop
 exitwhen (i > 5)
 set udg_CheatHeroStart[i] = false
 set i = i + 1
 endloop
endfunction

the one i found on 308:
JASS:
function InitGlobals takes nothing returns nothing
 local integer i = 0
set udg_currentlevel = 0
 set udg_wavetimer = CreateTimer()
 set udg_creepdead = 0
 set udg_currentlevel_num = 0
 set i = 0
 loop
 exitwhen (i > 8)
 set udg_Kills[i] = 0
 set i = i + 1
 endloop
 set udg_creep = 0
 set udg_CurrentPlayer = 0
 set i = 0
 loop
 exitwhen (i > 8)
 set udg_Player[i] = 0
 set i = i + 1
 endloop
 set i = 0
 loop
 exitwhen (i > 2)
 set udg_Playerranking[i] = 0
 set i = i + 1
 endloop
 set udg_EndingTimer = CreateTimer()
 set i = 0
 loop
 exitwhen (i > 5)
 set udg_CheatHeroStart[i] = false
 set i = i + 1
 endloop
endfunction

Also, please ignore the name of the variables xD
I didn't name them and i won't do so ether...
 
Level 3
Joined
Mar 27, 2009
Messages
30
Darn! What does "Function redeclared" mean? Is it some kind of syntax error or such? I removed the one of the 2 i saw, but it still says the same!
 
Level 4
Joined
Nov 23, 2007
Messages
113
It means you have 2 functions of the same name, which you can't. InitGlobals() is automatically generated by WE. How you ended up with 2 of them, I don't know but perhaps you copied something to the custom script area which also had an InitGlobals() function (such as an exported map script).
 
Level 3
Joined
Mar 27, 2009
Messages
30
Okey. I removed the one i found and somehow it still won't run in wc3. Any idea? The other one is still hidden somewhere. What's the best way of viewing whole jass script at the same time?

And why doesn't jasshelper show both of them? i think it would help alot!
 
Level 4
Joined
Nov 23, 2007
Messages
113
You can view the entire script by using the File->Export Script... function. But I'd check your custom script area to see what (if anything) you have pasted in there or into all your triggers you converted to text.
 
Level 3
Joined
Mar 27, 2009
Messages
30
LOL'd! on export, jasshelper somehow found an error on every line and aborted the export... 12000errors xD

I've got it now, tho. Gonna check it out asap :D
 
Level 3
Joined
Mar 27, 2009
Messages
30
Tried to get it to work, but with no success. Does anyone have an idea of how to make it work? I tried to make it work by removing both of them, by replacing .j-file, by exporting (wich didn't lead to anything), and by using different programs. Somehow i've got 2 different triggers wich aren't supposed to be there bcs they're made by WE automatically, and two different "call InitGlobals( )" in two different places. Help, anyone?
 
Status
Not open for further replies.
Top