Why does it say it is not declared, though it is clearly declared?

Level 6
Joined
Apr 15, 2016
Messages
118
dsa.png

It's clearly right there, the first integer with the maximum instance, and the second line of error is the current instance, upon trying to call a "removeLocation". What is the deal here?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I don't get it, you mean I should add "udg" in the arrays part too?
Yes, if it's a variable that you've created in the Trigger Editor then it has to have the "udg_" prefix, no exceptions.

It's how you can distinguish between variables created in the editor and variables that you've created in your code:
  • Actions
    • Set MyVariable = 1
vJASS:
globals
 integer MyVariable = 1
endglobals
Both of these can exist at the same time without interfering with one another despite having the same name. This is because the one in the trigger will be given the "udg_" prefix when it's being handled internally, if that makes sense.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
Uncle wrote _udg erroneously, so to avoid confusion it is in fact udg_.

For context the game’s generated variables for things like regions, camera angles, specific units directly referred to in trigger lines use the gg_ prefix and many internal variables for more complex jass functions use bj_ as their prefix.

If you ever aren’t sure how to refer to a variable or object you can make a new trigger with a single action that references the thing and then convert that trigger to JASS (Edit > Convert to Custom Text). Then look at the line and see how the thing is referred to.
 
Top