-
-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no delay with smaller than 1 tick "wait for" times #35
Comments
Out of curiosity, could you try doing "wait for 0.04 seconds" and see if it rounds down to 0? |
You're right about what the issue is. I think it's impossible for Skript (or any plugin) to do anything in smaller increments than 1/20th of a second. Minecraft doesn't process things quicker than that, so you can't make it do anything quicker than that. |
As far as I know, Skript runs even delayed tasks in main thread. Minecraft is not thread safe, excluding the chat, and with Spigot even that is not thread safe. I will see if I can make it report clear error, though. |
Currently, we are still able to write something like Tagging as enhancement because this isn't exactly a bug, but a better error would be an improvement (and rounding up will prevent crashes if people have a big loop with |
I just spend 3 hours yesterday trying to figure out why my code doesn't work and it all came down to this:
The issue:
If the "wait for" time is less than 1 tick there will be no delay of any kind, it's being rounded downwards to 0.
As I understand Minecraft has 20 tick cycle to execute everything in main thread. I don't know how Skript is built - perhaps it's tied up to the main thread and perhaps some things are run in their own thread the frequency of which I can only guess. But either there should be a delay smaller than 1 tick (which at the moment seems unlikely to be possible) or - in my humble opinion - the wait time should at least be rounded up to the smallest span of time that Skript is capable of waiting in the case where there is a wait time defined which is more than 0 to protect stupid users like me who do not fully understand the undocumented inner workings of Skript. I can see some possible use scenarios for a "wait for 0 ticks/seconds" which can be used to release events and keep running the rest of the code while the event has been released (but without delay).
It's hard to say from my point of view whether this is a feature (and why?) or a bug but it should probably be looked into.
If it's a feature you should probably either round upwards and/or give error/warning message when loading the skript: "the shortest amount of time you can wait is 1 ticks"
The text was updated successfully, but these errors were encountered: