Using Globals Outside The Declared Trig

DrEvil

FCRI Associate!
Reaction score
111
I know you can declare globals in a trig ,
JASS:
globals
   integer life = 30 // whatever 
endglobals


Can i access that global from a different trigger ?
 

Faust

You can change this now in User CP.
Reaction score
123
Yes.
You wouldn't be able to only, if it was

JASS:
private globals
   integer life = 30 // whatever 
endglobals
 

DrEvil

FCRI Associate!
Reaction score
111
Can i ask

If i dont put "private" key word it makes it public , so whats the point of the public key word ?
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
It doesnt make it public.
Heres an example:

JASS:

scope TEST

globals
    public integer I
endglobals

endscope


Would be accesed: TEST_I

JASS:

scope TEST

globals
    integer I
endglobals

endscope


Would be accesed: I

Atleast, I think thats how it works.
 

DrEvil

FCRI Associate!
Reaction score
111
So when its public you use the scope name + _ + name of global to access it .

And private it can only be used in that trigger right ?
 

Romek

Super Moderator
Reaction score
964
No prefix, you just get the normal name.
Public, you use SCOPENAME_VARIABLENAME
Private, same as above but with a random amount of __ (Well, sometimes it's 2, sometimes 3).
 

DrEvil

FCRI Associate!
Reaction score
111
Ok , i think its 2 _'s

How does NewGen get the maps script ?

When you make a JASS Error is shows you the whole map script and the line(s) which is wrong .

Ok thanks Romek for the thumbs up on the prefix / no prefix
 
Reaction score
456
> And private it can only be used in that trigger right ?
There are no trigger. It's either a scope or a library.
 
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