Twine Version: 2.5.1
I was trying to make a new attempt in making a day/time cycle using cnull’s code as a reference here:
So far, everything looks good, however, my variables in the arrays for the game time and game day doesn’t seem to change. This is what I have in my StoryInit:
/* Game Date */
// Determines what the current month is
<<set setup.dateMonth = ["January", "Feburary", "March", "April", "May", "June", "July", "August", "September", "November", "December"]>>
<<set $gameMonth = 0>>
// Resets the month to January
<<if setup.dateMonth[$gameMonth] is "January">>
<<set $gameMonth = 0>>
<</if>>
// Determines what day it is
<<set setup.dateDay = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]>>
<<set $gameDay = 0>>
// Resets the day to Sunday
//<<if setup.dateDay[$gameDay] is "Saturday" && setup.time[$gameTime] is "Midnight">>
//<<set $gameDay = 0>>
//<</if>>
// Determines the time of the day
<<set setup.time = ["Dawn", "Morning", "Noon", "Afternoon", "Evening", "Night", "Midnight"]>>
<<set $gameTime = 1>>
<<set $playerAlarm = 1>>
// Resets the time of day to player's alarm (default is morning)
<<if setup.time[$gameTime] == "Midnight">>
<<set $gameTime == $playerAlarm>>
<<set $gameDay += 1>>
It's getting late. You decide to head to bed before you feel more tired.
<</if>>
And this is what I have in my StoryCaption:
Today is ''<<=setup.dateDay[$gameDay]>>,'' ''<<=setup.dateMonth[$gameMonth]>>''
It is ''<<=setup.time[$gameTime]>>''
At the moment, I’m not focusing on the months, just on the day and time. From my testing, when I increase the game time by 1, the time goes up normally, but once it reaches midnight, instead of going back to morning it goes to [undefined]. The day stays on Sunday instead of changing to Monday as well.