Skript

Skript

743k Downloads

Time calculations are incorrectly calculated

Fusezion opened this issue ยท 0 comments

commented

Skript/Server Version

[03:09:06 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[03:09:06 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[03:09:06 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[03:09:06 INFO]: [Skript] Server Version: 1.21.1-77-4ff58c4 (MC: 1.21.1)
[03:09:06 INFO]: [Skript] Skript Version: 2.9.2 (skriptlang-github)
[03:09:06 INFO]: [Skript] Installed Skript Addons:
[03:09:06 INFO]: [Skript]  - skript-gui v1.3 (https://github.com/APickledWalrus/skript-gui)
[03:09:06 INFO]: [Skript]  - skript-reflect v2.5.1 (https://github.com/SkriptLang/skript-reflect)
[03:09:06 INFO]: [Skript]  - SkBee v3.6.2 (https://github.com/ShaneBeee/SkBee)
[03:09:06 INFO]: [Skript]  - SkAnimation v1.0.1 (fusezion.github.io)
[03:09:06 INFO]: [Skript] Installed dependencies:
[03:09:06 INFO]: [Skript]  - Vault v1.7.3-b131

Bug Description

While originally meant for just time, timespan also seems to have some mild issues in terms of what we'd expect to work.

When changing the time of a world using time classinfo anything other than (whole number):00 will become invalidated and refuse to function.

However even when using 1:00 the time that gets added as 1:12 not exactly 1:00 this also happens with add 1 minute to time of world where it add 1:12 following the example of 1 second one would likely expect this to add only 1 to the hour placement.

Expected Behavior

Time to be correctly calculated when using time classinfo and timespans for modifying world time.

Steps to Reproduce

command /testing:
    trigger:
        set {_world} to world of player
        set {_starttime} to time of {_world}
        set {_previousState::*} to gamerule doDaylightCycle of {_world} # this is a whole other issue

        broadcast "Time Testing"
        set time of {_world} to 0:00
        broadcast "&7Start Time&e: %time of {_world}%"
        add 0:01 to time of {_world}
        broadcast "&7Added 0:01&e: %time of {_world}%"
        add 0:10 to time of {_world}
        broadcast "&7Added 0:10&e: %time of {_world}%"
        add 1:00 to time of {_world}
        broadcast "&7Added 1:00&e: %time of {_world}%"

        broadcast "TimeSpan Testing"
        set time of {_world} to 0:00
        broadcast "&7Start Time&b: %time of {_world}%"
        add 1 second to time of {_world}
        broadcast "&7Added 1 second&b: %time of {_world}%"
        add 1 minute to time of {_world}
        broadcast "&7Added 1 minute&b: %time of {_world}%"

        set gamerule doDaylightCycle of {_world} to {_previousState::1}
        set time of {_world} to {_startTime}

Errors or Screenshots

image

Other

In truth the usage behind time is rather poor I remember from a previous pr that the existing implementation might need looked at and possible reworked to a degree, at the time i just lacked the knowledge of how to do so.

Agreement

  • I have read the guidelines above and affirm I am following them with this report.