Hi,
I've been trying to use a date and time tool/widget. Mainly to show it on the sidebar as so:
Time: <<time24h>>
Date: <<date>>
I've also removed the year from the widget since I did not need it and it worked perfectly:
<<print String.format("{0} {1} {2}, {3}",
GameDays[$gameDate.getDay()],
GameMonths[$gameDate.getMonth()],
$gameDate.getDate(),
)>>\
I can add days, hours and so on, but I've tried to create a way to set the time so that it can be more flexible. Like so:
/* Date & Time Setting Widget Definitions */
/* Sets the specified number of minutes. */
<<widget "setmins">>\
<<run $gameDate.setUTCMinutes($gameDate.setUTCMinutes() + $args[0])>>\
<</widget>>
/* Sets the specified number of hours. */
<<widget "sethours">>\
<<run $gameDate.setUTCHours($gameDate.setUTCHours() + $args[0])>>\
<</widget>>
/* Sets the specified number of days. */
<<widget "setdays">>\
<<run $gameDate.setUTCHours($gameDate.setUTCHours() + $args[0] * 24)>>\
<</widget>>
It's, obviously, mainly a copy/paster of the advance time of Mad Exile's /* Adds ... */. I thought it could work, but it displays this:
Time: :
Date: NaN,
The character goes to sleep. So I need a day to pass and the time to always be 8:00 (24h). The code looks like this:
/* Sets hours */
<<sethours 08>>
/* Sets minutes */
<<setmins 00>>
/* Adds 1 day-Pass time */
<<adddays 1>>
Adding things works like a charm. But it seems like I'm far from knowing how to change the "add" command into a "set" one.
I hope that's clear enough and that it isn't too much to ask for. I can't figure out how to solve it, but something tells me it's simple when I look at the code I'm using for reference (not that I'd be able to create it...).