How to keep track of real time daily events?

I am trying to create a game where when you boot it up it knows the local time on your computer to understand if it is a new day and then asks you how many hours you slept last night. I want it to be able to save the number you give it and be able to say things such as how much you slept each day and the average hours slept this week, month, last month, two months ago, this year, last year, etc.

I am unsure how to make the game save the answers for example it asks “how many hours did you sleep last night” and the player enters “7” so information that the player slept 7 hours on Saturday, February 13 is saved, and be able to hold that information forever so it doesn’t get over written the next day.

Currently using sugarcube and twine 2. Once I learn how to do this with sleep I plan on messing around with a bunch of different daily life planner tracking stuff.

For help with that you should check out the “Time” section of my Twine/SugarCube sample code collection. It shows how to get the current time and manipulate time data using the JavaScript Date object.

Have fun! :slight_smile: