Utility Library
Utility Library
This is a simple utility library that adds some useful functions for Triggers in the Starcraft 2 Editor. If you have any suggestions for useful features, post them here! :-)
Features
- Efficient For Loops
- Is True / Is False boolean Conditions, so you no longer have to do "My Boolean Variable == true", you can say "My Boolean Variable"
What are Efficient For Loops?
See this thread for a description of the problem with the current for loops. Basically, nesting for loops causes an exponential growth of code lines, as each for loop duplicates the contained code twice (to deal with both the case of increasing loops as well as decreasing loops). The thread says 6 nested for loops = 10k lines of code.
This is easily fixed by having two different for-loop actions, one for increasing and one for decreasing. Here's an example of the Trigger Editor with 8 nested for loops using Utility Library:
Here's the code produced: GalaxyScript
While not pretty, it is a lot more efficient than the built-in solution - about 125 lines of code generated! :-)
No offense or anything, but that looks like it would be a nightmare to debug under certain conditions. I think I'll stick w/ while loops. I like my sanity.