ETA I seemed to have fixed it. I believe using the combination of <<link>> and <<goto>> was giving me problems. It's working now that I've changed it.
I'm using MadExile's Gregorian date & time widgets, and they've worked for me in past projects, but for some reason using the widget to advance the date sporadically causes the time to count upwards rapidly in the UI bar, rather than just setting the date x days ahead and taking me to the next passage. (So in this case, it doesn't load the next passage at all, either.)
I'm not sure what I can do to fix it? I get an error that says "Uncaught TypeError: Cannot read property 'setUTCMinutes' of undefined."
:: StoryInit
<<set $gameDate to new Date(1100, 0, 1, 10, 0)>>
:: StoryCaption
<<print GameDays[$gameDate.getDay()]>>
<<time12hr>>
:: PassageHeader
@@.header;
<<if $name isnot "">> $name ) <</if>>$season ) <<date>>
@@
:: testpassage
<<adddays 50>>
There hasn't been much improvement made on the house.
<<link "leave">><<goto "outside">><</link>>
:: gameclock (#widget)
/*
Date & Time Widget Setup
*/
<<set
window.GameDays to [
"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "NEWDAY"
];
window.GameMonths to [
"JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE",
"JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"
];
/*
Below we have to use the multi-parameter version of the Date
constructor, rather than the date string version, because the
date string version treats a missing timezone offset as UTC.
While there are ways to determine players' timezone offsets,
so they could be added to a date string, it's more convenient
simply to use the multi-parameter constructor.
The point of this is so that you can simply initialize the game
world clock to whatever date and time you wish without having to
worry about the players' timezone offsets, while still ensuring
that they all see the same game world dates and times.
*/
/* params: year , month(0-based) , day , hour(24H) , minute [, second ] */
$gameDate to new Date(2019, 3, 5, 7, 2); /* e.g. Mar 17, 2015 03:24 */
>>
/*
Date & Time Advancement Widget Definitions
*/
/* Adds the specified number of minutes. */
<<widget "addmins">>\
<<run $gameDate.setMinutes($gameDate.getMinutes() + $args[0])>>\
<</widget>>
/* Adds the specified number of hours. */
<<widget "addhours">>\
<<run $gameDate.setHours($gameDate.getHours() + $args[0])>>\
<</widget>>
/* Adds the specified number of days. */
<<widget "adddays">>\
<<run $gameDate.setHours($gameDate.getHours() + $args[0] * 24)>>\
<</widget>>
/*
Date & Time Printing Widget Definitions
*/
/* Prints the current date ("{weekday} {month} {day}, {year}"). */
<<widget "date">>\
<<print String.format("{0} {1}, {2} {3}",
GameMonths[$gameDate.getMonth()],
$gameDate.getDate(),
$gameDate.getFullYear()
)>>\
<</widget>>
/* Prints the current time (12H). */
<<widget "time12hr">>\
<<if $gameDate.getHours() eq 0>>\
12\
<<elseif $gameDate.getHours() gt 12>>\
<<print $gameDate.getHours() - 12>>\
<<else>>\
<<print $gameDate.getHours()>>\
<</if>>:\
<<if $gameDate.getMinutes() lt 10>>0<</if>><<print $gameDate.getMinutes()>> \
<<if $gameDate.getHours() gte 12>>PM<<else>>AM<</if>>\
<</widget>>
/* Prints the current time (24H). */
<<widget "time24hr">>\
<<if $gameDate.getHours() lt 10>>0<</if>><<print $gameDate.getHours()>>:\
<<if $gameDate.getMinutes() lt 10>>0<</if>><<print $gameDate.getMinutes()>>\
<</widget>>
/* Prints the current date and time (12H). */
<<widget "datetime">><<date>> <<time12hr>> (<<time24hr>>)<</widget>>
:: Story Javascript
/* TIME TAGS */
predisplay["advanceTimeEveryTurn"] = function () {
if (tags().contains("notime")) { return; }
var offset = 15; // default of 15 minutes.
if (tags().contains("time2h")) {
offset = 120; // 2 x 60 minutes.
} else if (tags().contains("time8h")) {
offset = 480; // 8 x 60 minutes.
} else if (tags().contains("time30m")) {
offset = 30; // 30 minutes.
}
var timestamp = variables()["gameDate"];
timestamp.setUTCMinutes(timestamp.getUTCMinutes() + offset);
};