Solved How to detect time since sleep event?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Dracconus

Member
Jun 1, 2023
2
1
3
I'm looking for a way to detect whether a player has slept, and compare time since that event.
I know that there's a way to do it with scoreboard values, I was just curious whether it's possible with skript and how I'd go about it.
 
You could use on bed enter:, set a variable at that time and then use the difference between that variable and now to see how long it has been. Although on bed enter won't tell you if they have slept, just that they've been in bed.
 
I actually sort of figured out how I want to approach this prior to reading your response albeit it took having an epiphany on how I was going to approach it since I'm still figuring everything out with Skript.

What I'm doing is I have a section for "on bed enter:" where I set a variable to the database to "now" then compare against that later in the code to a random integer in order to perform a randomly timed event and it actually does work.
Thank you for looking out, though!
 
  • Like
Reactions: BaeFell