Countdown / wait till function is done
Hey, I just wonder if there is a way to pause a for-loop between every item.
My current approach is: Lua Code:
But the for-loop is so fast, that it stacks all sleep-calls and causes to freeze the game. x) |
What are you trying to approach?
MAybe you should have alook at LibAsync. Or try to use zo_callLater(function() ... end, delayInMS) within the loop where delay will increase each time by 5 seconds and thus the code in the loop will just delay each PlaySound for 5, 10, 15, 20, ...seconds |
There's no proper "sleep" function in eso, try reading this page (https://wiki.esoui.com/Running_LUA-Code_asynchroneously) to see how to 'work around' the 'lack of sleep' (:p)
|
Okay, thank you both, I will target the issue tomorrow. self:sleep(8h) :rolleyes:
|
So basically I found this big Sound list on the wiki https://wiki.esoui.com/Sounds, so I decided to go through it and maybe find some sounds for my next addon. Entering everything by myself in chat with "/script PlaySound(SOUNDS.ABILITY_CASTER_DEAD)" wasn't the right solution for me so I decided to write a little script which iterates through the list and play each sound one by one after a certain amount of delay.
My list structure was this: Lua Code:
After my game freezed, everytime I wanted to make a pause between the sounds, some kindly devs suggested me to use LibAsync for my purpose. LibAsync: https://www.esoui.com/downloads/info2125-LibAsync.html How to LibAsync: https://wiki.esoui.com/Running_LUA-Code_asynchroneously The solution for my problem which worked at the end was the following code: Lua Code:
|
You could also use a LAM slider control to add the sounds to (build a choices tale by Looping over the SOUNDS table) and play them on setFunc change. Some of my addons like FCOStarveStop, FCOChatTabBrain or FCOUltimateSound use this.
|
This would be just too easy. :p Jokes aside, the funny thing is when I call the function in a current existing async task, it stops by default and starts again from the beginning.
My assumption was that I would create another task doing the same. |
All times are GMT -6. The time now is 08:43 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI