Leaks and Tempveriables

Iwan_Krissov

New Member
Reaction score
18
I was wondering if there might occur any problems if you avoid leaks with temporar variables and you have many triggers that may run.
So how likely is it, that two triggers run at the exact same time and try to use the temporar variables at the very same time. Does it happen at all?

Do I need to create different temp variables for every spell etc. that may be used at the same time?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
I doubt so, as triggers appear to run in a sequence even if they are fired from the same event.
 

PrisonLove

Hard Realist
Reaction score
78
There's on thing to always remember. Computers cannot actually do more than one thing at a time. They can switch between tasks, and do things very quickly, making it appear to do things simultaneously, but it can't execute more than instruction at once. This applies to triggers. If two triggers fire off the same event, one of two things will happen. One trigger will be fired before another, or the computer will constantly switch between the two triggers. I don't know what actually happens, but if the second instance is true, then using the same variable in both triggers could be problematic.

The solution is to use local variables; however, that requires (for the most part) knowledge of JASS.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
2 triggers firing off the same event results in each completing their actions before it goes on to the next one, not alternating between the two, the first one to fire is the farthest up on the script when it is compiled (all triggers get crammed into one text)
 

merlinds

Member
Reaction score
15
exactly, the triggers run like a one single actions, unless you use waits.
So, if your triggers does not have waits inside of them you can share the variables with no problem.
 
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