sevensc
New Member
- Reaction score
- 8
Hey all,
I'm having some trouble with a local integer in a loop, in a function.
This code works just fine, but it uses a global integer (udg_tempInteger):
When I replace the global with a local, the code no longer functions properly.
Do i need to return the value differently when using a local?
Any help is appreciated.
NOTE: I know this could be done with if statements or separate triggers for each region, but my regions are dynamic and the loop takes care of all possibilities. That being said, if one of those other options I mentioned seems like a better idea, let me know.
I'm having some trouble with a local integer in a loop, in a function.
This code works just fine, but it uses a global integer (udg_tempInteger):
Code:
loop
if RectContainsUnit(udg_regionsLeft[i], tempUnit) then
set udg_tempInteger = i
endif
exitwhen i == udg_tempInteger
set i = i + 1
endloop
Do i need to return the value differently when using a local?
Any help is appreciated.
NOTE: I know this could be done with if statements or separate triggers for each region, but my regions are dynamic and the loop takes care of all possibilities. That being said, if one of those other options I mentioned seems like a better idea, let me know.