I have a bit of an issue with Skript functions, they seem to be non-blocking by default.
For example, if I have the function below:
And I use this function in another section of code:
I would expect it to broadcast the message, count down, and then refresh the map.
However, it doesn't wait for the countdown to finish and it immediately refreshes the map and continues counting down.
How do I make the cooldown() function synchronous and make it wait for the countdown to finish before refreshing the map?
Server version: 1.21.1 Paper
Skript version: 2.9.5
Addons:
skript-placeholders 1.7.0
skript-gui 1.3
Skuishy 2.8
SkQuery 4.1.10
SkBee 3.6.1
skript-citizens 1.0.0
For example, if I have the function below:
Code:
function countdown(length: number):
loop {_length} times:
broadcast loop-number
wait 1 second
And I use this function in another section of code:
Code:
every 30 minutes:
broadcast "refreshing map in 1 minute!"
countdown(60)
# code that refreshes the map
I would expect it to broadcast the message, count down, and then refresh the map.
However, it doesn't wait for the countdown to finish and it immediately refreshes the map and continues counting down.
How do I make the cooldown() function synchronous and make it wait for the countdown to finish before refreshing the map?
Server version: 1.21.1 Paper
Skript version: 2.9.5
Addons:
skript-placeholders 1.7.0
skript-gui 1.3
Skuishy 2.8
SkQuery 4.1.10
SkBee 3.6.1
skript-citizens 1.0.0
Last edited: