0 votes
by (140 points)
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 */



Your local time:<<set $CurDate = new Date(Date.now())>>
<<= $CurDate.toLocaleString("en-US", {month: "short", day: "numeric", year: "numeric", hour: "numeric", minute: "2-digit" } )>>

1 Answer

0 votes
by (880 points)
One option might be to write the start time to a temporary file.

However, be sure to include a way to work around this. if I were playing such a game where such an option were required for successful play-through, I'd be extremely frustrated and never play anything by that author ever again.