Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Time condition

Open ShaneBeee opened this issue 7 years ago • 8 comments

So doing a time condition, anywhere between 1-24 works.... but I find that as soon as you go past midnight it no longer works.

For instance if I do if time in world of player is between 18:00 and 23:59: it works, but if I do if time in world of player is between 18:00 and 6:00: it does not work

The example in the Bensku docs is as follows time in world is between 18:00 and 6:00:

ShaneBeee avatar Jul 07 '18 22:07 ShaneBeee

Probably just order is the issue here, it would be grabbing 6:00-18:00. Place AM or PM after it and make it a 12 hour format to fix. There are multiple time formats.

TheLimeGlass avatar Jul 08 '18 08:07 TheLimeGlass

Regardless of if changing it to a 12 hour format would fix it (not sure if it would), this method should work since the docs do literally use this exact example as was pointed out.

I assume you're on the latest Skript version @ShaneBeee ?

TheBentoBox avatar Jul 10 '18 12:07 TheBentoBox

Correct @TheBentoBox Dev36.
And I agree. If it’s in the docs like that it should work like that.

ShaneBeee avatar Jul 10 '18 15:07 ShaneBeee

I know this is already marked as a bug, but I just wanted to let @TheLimeGlass know that the AM/PM add did nothing.

for example, I did set my time to 8pm, and tried this:

command /test:
	trigger:
		if time in world of player is between 6pm and 1am:
			send "TRUE" to player

nothing shows up if I do this:

command /test:
	trigger:
		if time in world of player is between 6pm and 11pm:
			send "TRUE" to player

then TRUE pops up on my screen.

ShaneBeee avatar Jul 13 '18 16:07 ShaneBeee

Related issue from past fork: https://github.com/Mirreski/Skript/issues/45

TheLimeGlass avatar Oct 25 '18 10:10 TheLimeGlass

I've ran into the same issue now:

command /clock:
    trigger:
        set {_p} to player
        if time in {_p}'s world is between 22:00 and 2:00:
            send "Actual time: %time in {_p}'s world%" to console
            send "Skript's decision: between 22:00 and 2:00" to console
        else:
            send "Actual time: %time in {_p}'s world%" to console
            send "Skript's decision: not between 22:00 and 2:00" to console

Output:

[11:55:59 INFO]: TestPlayer_1 issued server command: /clock
[11:55:59 INFO]: Actual time: 12:00
[11:55:59 INFO]: Skript's decision: between 22:00 and 2:00
[11:56:04 INFO]: TestPlayer_1 issued server command: /time set midnight
[11:56:04 INFO]: [TestPlayer_1: Set the time to 18000]
[11:56:07 INFO]: TestPlayer_1 issued server command: /clock
[11:56:07 INFO]: Actual time: 0:00
[11:56:07 INFO]: Skript's decision: not between 22:00 and 2:00

Is there any workaround available?

Thanks a lot!

UWUplus avatar Aug 09 '22 10:08 UWUplus

Workaround could be anything that doesn't use the between condition, for example time in {_p}'s world is greater than 22:00 or time in {_p}'s world is less than 2:00 (not valid syntax with or, you'll have to do this in multiple lines)

TPGamesNL avatar Aug 09 '22 10:08 TPGamesNL

I'm looking to automate reading from a file for specific time drops, so I'll probably do this with reflect, thanks for the idea though!

UWUplus avatar Aug 09 '22 11:08 UWUplus

This is actually a little more serious than first reported: not only does the condition not pass as expected, it is actually backwards since CondCompare checks both forwards and backwards, image which is the correct behaviour for numbers but is wrong for any cyclical value or wave function like times or degrees, where 00:01 is either after or beford 23:59 depending on the situation, but never both. I expect this will need a special case in the comparison condition.

Moderocky avatar Sep 22 '23 11:09 Moderocky