• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Can anyone properly explain why we shouldnt use 'Integer A' or B ?

Status
Not open for further replies.
Level 5
Joined
Feb 1, 2009
Messages
111
As i stated before i have a TON of triggers and have always used int a or b and they havent caused problems (gui user).

I would love to know why i should change? (My map is an orpg and have been testing with 6-8 players more than a few dozen times now)
 
They are less efficient if you compare it with custom made integers, and so a bit slower. (you don't feel difference in game)

They take more operations, so they may hit operation limit earilier.

You can test it by yourself:

  • Test
    • Ereignisse
      • Zeit - Elapsed game time is 1.00 seconds
    • Bedingungen
    • Aktionen
      • For each (Integer A) from 1 to 100000000, do (Actions)
        • Schleifen - Aktionen
          • Spiel - Display to (All players) for 0.01 seconds the text: (String((Integer A)))
  • Test 2
    • Ereignisse
      • Zeit - Elapsed game time is 0.50 seconds
    • Bedingungen
    • Aktionen
      • For each (Integer I) from 1 to 100000000, do (Actions)
        • Schleifen - Aktionen
          • Spiel - Display to (All players) for 0.01 seconds the text: (String(I))
  • Show Result
    • Ereignisse
      • Spieler - Spieler 1 (Rot) skips a cinematic sequence
    • Bedingungen
    • Aktionen
      • Spiel - Display to (All players) for 5.00 seconds the text: (Integer A: + (String((Integer A))))
      • Spiel - Display to (All players) for 5.00 seconds the text: (I : + (String(I)))
Integer A will have a lower value. And if you use it more often in your loop the difference may be huge. --> less efficient and hit operation limit faster.

Some people say they have bugs with overwriting, but I think in most cases it more a user problem. Because if you use own integer variables in loops you also can make some mistakes, if you use waits for example... but who knows maybe there is a rare bug. (since it's blizzard :d)
 
Seriously, just use Integer A/B if you've already used it all the while.
No point changing all of em. It's a waste of time.
Being too anal isn't too good for health sometimes.

> ...but I think in most cases it more a user problem
Completely agree.
 
If you have waits in the loop or fire an event by an action, another trigger may intervene and reset the variable. Neither Integer A/B nor the variables you can create in GUI are local but if you use designated global variables, you should be able to tell, if the related pieces of code that use it have to be MUI or not. It's simply better for the independence of things to not access the same resource for different purposes and it makes the code more legible than inserting some "tempVar".
 
Status
Not open for further replies.
Back
Top