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.
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[2024-4-26. : 6:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[2024-4-26. : 6:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
Please log in to shout.


Members Online: jjf28