An 'issue' with setting variable...

darkRae

Ueki Fan (Ueki is watching you)
Reaction score
173
Well, there's this guy who claimed that using one Global variable for a type to be used in every trigger is 'not safe for MUI'

He first commented on my Creeps Unite thread on an Indonesian gaming forum and said that that method I am using is 'not safe for MUI'

In other words, let's say, to clean up Point leaks you created a Point variable called 'TempPoint'. Now this guy said that using TempPoint in every trigger is 'not safe for MUI' (well, in an AoS map, there'll be a looot of triggers for abilities)

For example, you have a lot of triggers like this:

Code:
Events
    Unit - A unit Starts the effect of an ability
Conditions
    (Ability being cast) Equal to <...ability...>
Actions
    Set TempPoint = ...
    Set TempUnit = ...
    <...do something for your spell here...>
    Custom Script: call RemoveLocation( udg_TempPoint )

And he said that if two units cast the ability at the same time (which won't happen, since units can't practically cast at the exact same time) the variables will get overridden (thus making it not MUI)

Strange? Yes, that's what I thought too.
I mean, I believe most of all GUI users in the world use the same method, right? (and it doesn't even use Waits)
And yet, there's no known issues involving the method above.

So my question is:
Is there any problems in using the above method for MUI?
(hell, it doesn't even use any Wait)

TBH I want to hear what Acehart has to say about this :)
If you can read Indonesian, here's the thread link
 

Artificial

Without Intelligence
Reaction score
326
SFilip said:
A thread is a form of a connection between an application and your CPU. Maybe it's the easiest to explain if you see it as a pipe.
Now the application sends instructions to the CPU through this pipe and lets say there can only be one pipe active at time (this is not really true as there are multithreading and dual core processors around, but is almost always the case when it comes to Warcraft3). Now every trigger is started as a new thread and until it finishes with all its actions no other trigger will run. TriggerSleepAction pauses the thread, temporarily seals the pipe and lets another thread in the queue to run (yes, there is indeed a form of a queue).
So it's perfectly MUI to use the same variable for all of them. :p
 

darkRae

Ueki Fan (Ueki is watching you)
Reaction score
173
Thanks guys :)
I knew it was perfectly fine (I just need a confirmation to make him believe it)
 

Lightstalker

New Member
Reaction score
55
Actually, he's right. I've used temp_point and temp_group in over 28 different triggers, and it would cause some of them to malfunction. Then, I decided to make a variable for every trigger, and it worked perfectly fine.
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
I have used temp point in a pick all units loop, in a pick all player loop, in a for each varible so to so loop and they all worked fine, the only clashing I have ever had happen is useing inter a in a leveling trigger and in an item combo trigger at the same time.
 

vypur85

Hibernate
Reaction score
803
> Actually if those 2 or more units will be forced to cast by trigger than?

Even if it's simultaneous cast, the event will only being run one by one. It will finish one set of actions before the next incoming event. So it should be fine, I think.


> temp_point and temp_group in over 28 different triggers

Not sure about this though :rolleyes:. So far, I personally have not experience any problem... yet.
 

Lightstalker

New Member
Reaction score
55
> temp_point and temp_group in over 28 different triggers

Not sure about this though :rolleyes:. So far, I personally have not experience any problem... yet.

It probably works fine when you use it in a couple triggers that aren't likely to run at the same time.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top