Twine Version: 2.6.2
I got a working day/time cycle widget thanks to StJohnLimbo, but now that I’m trying to implement an <<if>>
function to reset the week day back to Sunday, it doesn’t work anymore. Here’s the full code:
/* Changes the time of day by one */
/* Use <<add-time>> multiple times to pass more time for the same passage */
<<widget "add-time">>
<<set $gameTime += 1>>
<<if setup.time[$gameTime] == "Midnight">>
<<done>>
<<replace "#regular-content">>
It's getting late. You decide to head to bed before you feel more tired.
<br><br><<button "Okay.">>
<<set $gameTime = $playerAlarm>>
<<set $gameDay += 1>>
<<set $monthDay += 1>>
<<set $totalDays += 1>>
// Resets the day to Sunday when it's Saturday at Midnight
<<if $gameDay == "Saturday" && $gameTime == "Midnight">>
<<set $gameDay = 0>>
<</if>>
<<goto [[Disclaimer]]>>
<</button>>
<</replace>>
<</done>>
<</if>>
/* do further checks and messages here, as necessary */
/* (to track the possible change in weekdays and months etc.) */
<</widget>>
I’m thinking that the error is the <<set $gameTime>>
in this section (referenced below), but I tried retyping it for spelling errors, adding two equal signs instead of one, but with everything I tried the day after Saturday at midnight the day shows as [undefined]. Everything else works fine except for that one line.
// Resets the day to Sunday when it's Saturday at Midnight
<<if $gameDay == "Saturday" && $gameTime == "Midnight">>
<<set $gameDay == 0>>
<</if>>
Edit for clarity: I’m not sure if the error comes because of an updated Twine version (since I’m using my laptop rather than my desktop at the moment), but I don’t think that would cause an issue.