Hello wurstscript maintainers. I'm new to wurstscript and just fiddling around at the moment. I am trying to use ClosureEvents to trigger some actions when a specific unit is selected. The trigger is active immediately upon map initialization.
I noticed that EventListener.add(u, EVENT_PLAYER_UNIT_SELECTED) does not work if the code is not wrapped under doAfter(0.5). Is this intended? Even in the Wurst item shop demo there is doAfter(0.5) for seemingly no reason.
I am completely okay with adding 0.5 second delay to the initialization. However, I could not find this behavior documented anywhere in wurstscript docs. If this is intended or caused by some limitations, then it should be in the docs. Please let me know, I am willing to help update the docs if that is better.
Simple steps to reproduce:
- Clone repo https://github.com/Frotty/wurst-item-shop/tree/main & use wurst setup jar to install dependencies
- Comment out
doAfter(0.5) in ItemShopTest.wurst
- Run the map
- Select paladin
We can no longer see "set target hero2" logged as expected.
Hello wurstscript maintainers. I'm new to wurstscript and just fiddling around at the moment. I am trying to use ClosureEvents to trigger some actions when a specific unit is selected. The trigger is active immediately upon map initialization.
I noticed that
EventListener.add(u, EVENT_PLAYER_UNIT_SELECTED)does not work if the code is not wrapped underdoAfter(0.5). Is this intended? Even in the Wurst item shop demo there isdoAfter(0.5)for seemingly no reason.I am completely okay with adding 0.5 second delay to the initialization. However, I could not find this behavior documented anywhere in wurstscript docs. If this is intended or caused by some limitations, then it should be in the docs. Please let me know, I am willing to help update the docs if that is better.
Simple steps to reproduce:
doAfter(0.5)inItemShopTest.wurstWe can no longer see "set target hero2" logged as expected.