Twine 2
Sugarcube 2.21
I want to create a passage which does not show any link until 2 hours have gone by. While that can easily be done with a timer but the timer keeps resetting if I shut the game and restart.
How can I go about this?
I've tried calling real time and have been successful in that but I don't know what to do ahead. I essentially understand that I need to freeze the real-time and remember that variable and then when the user starts and restarts compare real time with the remember time. If the difference is more than 2 hours show the link.
I don't know how to go about this though. Any help will be appreciated.
Here is my javascript
/* Date code - Start */
window.getDayName = function(CurDate) {
return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][CurDate.getDay()];
};
/* Date code - End */
HTML
Your local time:<<set $CurDate = new Date(Date.now())>>
<<= $CurDate.toLocaleString("en-US", {month: "short", day: "numeric", year: "numeric", hour: "numeric", minute: "2-digit" } )>>