• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Mountains of Undeclared Variables

Status
Not open for further replies.
Below is about 0.5% of the "undeclared variables" I face when trying to check my map's syntax. Is there a hack-and-slash way to declare all of these variables or do I need to go and manually declare each one (which, to be honest, I don't even know how to do). Can someone help me get on the right foot?
JASS:
 call PlayMusicBJ( gg_snd_MusicLoadingTheme )
 call ClearMapMusicBJ(  )
 call EnableDawnDusk( false )
 call SetGameSpeed( MAP_SPEED_FASTEST )
 call LockGameSpeedBJ(  )
 call SetTimeOfDay( 24.00 )
 call UseTimeOfDayBJ( false )
 call SetMapFlag( MAP_LOCK_RESOURCE_TRADING, false )
 call FogMaskEnableOn(  )
 call SetSkyModel( "Environment\\Sky\\FoggedSky\\FoggedSky.mdl" )
 set udg_SoundTrap[1] = gg_snd_Frost1
 set udg_SoundTrap[2] = gg_snd_Frost2
 
Level 9
Joined
Nov 4, 2007
Messages
931
If its just converting to custom text then there should be absolutely no problems, if your moving things around or transferring triggers then I can see the reason for all the undeclared vars youd be having.
 
Yeah I started moving things around in WE and now I'm using JNGP and the syntax checker gives me these errors...

btw at one point my .wts file (with the strings) got 99% wiped. No idea how that happened but that could be related to these syntax errors...

So you recommend I reload the version of my map from before I started converting/tweaking triggers?
 
If they are saying that there are undeclared variables, make sure you have all your globals created properly.

Open up the global variable editor thing and check to make sure all your variables are in order. Also be sure that you didn't rename your variables when converting it to JASS or do something such as making it an array when it wasn't initially declared as one. If you did rename your variables, either rename them in the variable editor as well, or fix the names in your code to match the ones in the variable editor.

If it was directly converted from GUI to JASS without any alterations, you shouldn't have any problems.

EDIT: Also, yeah, you should keep a copy of the map before you start tweaking it, in case you do something that might be irreversible.
 
Level 9
Joined
Nov 4, 2007
Messages
931
I recommend you check in any order: your sound editor for any undeclared sound variables, for example if it says that gg_snd_MusicLoadingTheme is undeclared, then you need to create a MusicLoadingTheme sound variable in sound editor, for trigger variables, if it says udg_SoundTrap[1] is an undeclared, then create a SoundTrap variable thats an array. Hope that helped.
 
Hey guys, I have to tell you, even older version of my map still give me the same f*ed up syntax errors. Here's a copy so you can take a look:

http://www.hiveworkshop.com/forums/pastebin.php?id=ck5d9u

Simply convert any of those triggers into custom script and check them with NGE and you'll see about 500 results for "undeclared variables". This is a version from before I did anything with converting triggers.
 
Level 9
Joined
Nov 4, 2007
Messages
931
OH hehe, its fine don't worry, the syntax error won't occur in a full syntax check, to do that just run the check on the WarChasers_2_Mercury.w3x at the very top of the triggers in the trigger editor, converted to custom script or not, it will parse successfully, you probably did the syntax check on the trigger itself, which doesn't have the variables registered locally, if you do it from the WarChasers_2_Mercury.w3x however, it'll run through all variables for the triggs, local and global. In short, there is nothing wrong with your map at all.
 
Level 7
Joined
Jul 18, 2009
Messages
272
You're not the only one with that problem Bribe.
I started conversing triggers in my map to jass to learn how jass works, and the syntax checker shows me every global variable, unit, region and even trigger that is used in the code as an "undeclared variable". I get up to 50 of those for each trigger.
Everything still works perfectly though, so I'd like to know what the syntax checker's problem is. ^^

/edit: thx Darkness-4ever! :D
 
Level 9
Joined
Nov 4, 2007
Messages
931
Whether or not there is code in there, it is still the *roots* of your trigger tree, and will be the place where all your triggers and variables meet to be syntax checked when you save your map.
 
Status
Not open for further replies.
Top