Globals

Charapanga

New Member
Reaction score
46
Hi, another problem i have encountered with...Globals as in the function...globals where you set variables Example:
JASS:
globals
   unit u
   integer i
   real r
endglobals


Do you need to preset them like UDG? or are they created like the example above?
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Like what you write inside the global blocks. The only globals that require the udg_ prefix is the ones created in the variable editor.
 

Trollvottel

never aging title
Reaction score
262
you shouldnt use short names for globals, better are descriptive and non repetive names. But it should work like this, yoou dont need a prefix
 

Viikuna

No Marlo no game.
Reaction score
265

Charapanga

New Member
Reaction score
46
I got another question about Private globals... Does using them make a spell MUI or make it un-MUI?
 

Charapanga

New Member
Reaction score
46
so, if i make a spell with only privates, it will be MUI? It includes timers so it's not just like an instant spell...Beacuse first i made it with Locals, but it had to include waits since callbacks can't take arguments and it was MUI but it wasn't really what i was hoping for

And since it's a blink-strike kinnda spell i can't test it with beacuse i'm not that fast...
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
What Flare said is that private variable does NOT make them MUI automatically. All it does is name the variable so that it's named as the struct/library in which it is declared. It's still like any other global variable.
 

Flare

Stops copies me!
Reaction score
662
(From JASSHelper manual)
Notice how both libraries have private globals and functions with the same names, this wouldn't cause any syntax errors since the private preprocessor will make sure that private members are only available for that scope and don't conflict with things named the same present in other scopes. In this case private members are only to be used by the libraries in which they are declared.

JASS:
scope Test
globals
  private integer PrivateInteger
endglobals
endscope

would end up being something like
JASS:
globals
  integer Test_RandomPrefix_PrivateInteger
//From what I recall, the RandomPrefix is a random 5 (or 6) digit number, according to the Grimoire error messages
endglobals

after the map script is compiled

So, it's doing nothing other than giving it a modified name so that it's inaccessible outside of this scope, and the name of a variable doesn't have any impact on the MUI capability of a spell/system that uses private functions or globals. A global will act as a global, regardless of public/private status, so a private global will face the same MUI issues that any other global would face
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top