• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Define variables in one trigger but use them in another.

Status
Not open for further replies.
Level 6
Joined
May 31, 2008
Messages
218
Is is possible to define a whole number of variables in a trigger and then use those variables in another trigger without defining them again? like making the second trigger read the first trigger and therefore retrive all variables.
 
Level 11
Joined
May 16, 2007
Messages
288
If they're global variables (variables created with the variable window in the trigger editor or through a global block in a code) yes, you can use them in other triggers, but if they're local variables you'll have to pass them to a global variable or set them again if you want the second trigger to be able to use them.
If you're using GUI, then you shouldn't worry about this since variables will always be global unless you used custom script to create locals.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Globals are always usable and changable no mater the function that is run unless they are constant, in which case they will always be readable but not changable.

locals exist only within the function they were defined in, and passed parameters can also be considered as locals as far as the way they can be referenced and changed.
 
Status
Not open for further replies.
Top