• 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] JASS Scope Redeclared? Corrupted Map?

Level 1
Joined
Jun 13, 2024
Messages
2
I'm having a bizarre problem with my Jass scripts. When I try to save my map, I get a scope redeclared error. I have scoured the trigger editor, looking for a duplication of my script but I can't find anything. I'm new to Jass, but not to coding.

Here is what the trigger looks like in the trigger editor (IMAGE 1)
TriggerEditorView.png


Here is the error I get when I save (IMAGE 2)
WhereIsScopeRedeclared.png


And here is where the scope is previously declared (IMAGE 3)
PreviouslyDeclaredHereAndCorrect.png


IMAGE 3 shows the correct code with the trigger file name and the TREE_WARD_MANA_COST variable removed. I have no clue where the code in IMAGE 2 comes from and there is no trigger file name associated with it.

I'm using the Reforged editor with JassHelper and vJass enabled.

Thoughts? Any help is appreciated.
 
Level 1
Joined
Jun 13, 2024
Messages
2
A friend had the answer. I had somehow copied my code into the map specific script. I deleted the code there and it works fine. Hopefully, this will be helpful for anybody else that runs into this problem.
ErrorSource.png
 
Level 24
Joined
Feb 27, 2019
Messages
833
It might be a "ghost" error caused by testing/saving the map before enabling jasshelper, prompting a lot of errors, and then enabling jasshelper afterwards. If that is the case, restarting the editor should fix it.

Edit: If Im not 100% wrong the "ghost" errors dont actually do anything except give a lot of warnings, map should still be testable and savable even if the errors occur, at least if its only "ghost" errors. However if saving Id use a new save file, maybe disable the real trigger for that save.
 
Level 19
Joined
Oct 17, 2012
Messages
859
More information on the error that you are experiencing:
I've the same bug as SmitingDevil where sometimes (happened 3x times today) the code of the first vJass trigger is copy/pasted in the game "Custom Script Code" header, resulting in compilation error because of duplicate definitions.

However I have no idea of a reproducible scenario. I produced it with 2 different maps. I don't know what usefull information about the bug I could give you :S

This is a warning to not place code in the map header because it might randomly get replaced with code from some trigger.
 
Top