After a small summer break we return this month with many bugfixes and improvements to WurstScript quality of life and overall user experience.
Make sure your wurst setup tool is up to date and then update your wurst installation to get improved handling of wc3 patch versions, some new code inspection warnings, and new optimizer features.
@compiletime
have been added, which aids in avoiding some user level programming issues.Many new features and many merged pull requests! The standard library is doing great - here are some notable changes:
TerrainUtils
package has been refactored for better integration and advanced functionality by #67LinkedList#sort
has been fixed to not have exponential performance anymoreClosureEvents
have been added to the standard library. A new package for easy encapsulated event listening. Code Sample:EventListener.onPointCast(hero, MY_SPELL) (caster, target) ->
forUnitsInRange(target, 256) victim ->
caster.damageTarget(victim)
Big thanks to all the amazing contributors!
Did you know that the wurst compiler supports a number of automatic optimizations that keep your map script small & fast? (Discussed further in Wurst for vJass Users).
This month we have added numerous new optimizer improvements, making this feature of wurst more powerful than ever. Here’s a summary:
init
s.set
and exitwhen
are now merged into one if applicable.a + a => a*2
) which improves the effectiveness of other optimizations.The great thing about new optimizations is that they cause something like an avalanche effect. Meaning that due to these ‘minor’ changes in the output code, other already existing optimizations can now be applied over again successfully, where they didn’t change anything before.
You can always check the output code in the _build/output.j.txt
file. Here is a small example:
let g = CreateGroup()
for u from g
u.addHP(100)
Turns into:
local group from = CreateGroup()
local unit iterUnit
loop
exitwhen FirstOfGroup(from) == null
set iterUnit = FirstOfGroup(from)
call GroupRemoveUnit(from, iterUnit)
call SetUnitState(iterUnit, UNIT_STATE_LIFE, GetUnitState(iterUnit, UNIT_STATE_LIFE) + 100.)
endloop
set from = null
set iterUnit = null
Thanks for reading, we hope you enjoy these posts - and as usual, let us know what you think.
p.s.: If you haven’t starred the Wurst repository yet, please do so to help us get to 100 stars!
Cheers!
-Frotty