Staredit Network > Forums > SC2 General Discussion > Topic: [Info] "For each" Undocumented Change 2.0.10
[Info] "For each" Undocumented Change 2.0.10
Aug 8 2013, 2:49 am
By: Ahli  

Aug 8 2013, 2:49 am Ahli Post #1

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

"For each integer/real" works differently after 2.0.10.

After finishing the loop, the variable won't end with the end value that you set in that function anymore (or the last correct value it had before).

For example, the following code ends with A being set to 10.0 after the loop:
Code
General - For each real A from 0.0 to 9.0 with increment 1.0, do (Actions)


Due to the way sc2 translates GUI to mapscript's galaxy code, maps can only be bugged when you update them. So, if you've updated your map or plan to update it, you might be adding bugs to it without being aware of that.

So, please check your maps for possible side effects. Note that this can only be a problem when you re-use the current value of the loop's variable.




Aug 8 2013, 8:33 am TF- Post #2

🤙🏾

Shouldn't this be getting fixed?

Probably not worth a thread but a thing I noticed is if you're changing a unit's max energy, its current energy gets set to the max energy now. Made for a small bug in my mod.



🤙🏾

Aug 8 2013, 9:46 am Lanthanide Post #3



It's a bit crap of Blizzard to change behaviour of a functional item like that, but I'd also suggest that if you were using "foreach", you shouldn't have been expecting variable A to have any particular value at the end of the loop.

Foreach has a distinctly different semantic meaning compared to a for loop which explicitly increments the counting variable and uses a test against that variable in order to exit the loop. Foreach literally just means "do this thing on all of the items in this loop", theoretically your use-case shouldn't care in what order the action is performed, just as long as it is performed exactly once for each item - the resulting value of the variable used to control the loop therefore shouldn't be assumed (unless the API indicates the value to expect). A for loop on the other hand is much less structured, and since it is simply checking against a variable value to decide when to exit the loop, the variable can be manipulated in numerous different ways within the body of the loop to give different exit behaviours, as well as for loops often being explicitly used to determine the appropriate value of the variable for further use (eg, count the number of characters in a string).



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[08:35 pm]
Ultraviolet -- :wob:
[11:38 pm]
Symmetry -- :wob:
[2026-6-21. : 4:56 am]
Ultraviolet -- I suppose we'll likely never know, but my guess would be that they already saw it operating successfully and there was no monetary incentive to finish the original work. And the dev cycle in old school Blizzard was so hectic, it's possible it just got forgotten about after the original game got released. Plus there's an element of existing MPQ files that were packaged with the original discs becoming outdated if they updated it. And it's not like they remade the original MPQs, they just made new ones for BW specifically
[2026-6-21. : 4:26 am]
Oh_Man -- so that makes me think maybe the theory they are unfinished is not true and its a deliberate design decision, coz why not finish them wen ur making brood war?
[2026-6-21. : 4:25 am]
Oh_Man -- the thing is thos buildings are from classic. that means they went ahead and made brood war without ever finishing the 'unfinished' buildings
[2026-6-20. : 6:15 pm]
Ultraviolet -- Yeah he's talked about a lot of that stuff in his casts before. It seems plausible. Especially knowing how Blizzard of yesteryear operated.
[2026-6-20. : 3:47 pm]
NudeRaider -- to clarify: couldn't recall the behavior for every single Protoss building but I was aware the disparity exists.
[2026-6-20. : 3:43 pm]
NudeRaider -- Contained nothing new for me. Didn't know all building's behavior, but very much all unit's. Also Terran balance whine - also nothing new :lol:
[2026-6-19. : 9:57 am]
Oh_Man -- makes me wonder if SEN knows anything about the topic
[2026-6-19. : 9:57 am]
Oh_Man -- artosis dropped pretty interesting vid: https://youtu.be/EqZHB8Blra4
Please log in to shout.


Members Online: Moose, lil-Inferno