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
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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