RMXP and RMVX has a built-in Time function that allows the display of the current date and time (based on the system clock). I found this by accident while sifting through the Help file - actually while searching for Bitmap and Sprite management - and after some experimentation discovered how to place it in windows.
To use it, there are two functions to be aware of:
This reads the current time and date from the system clock.
This converts the time into a string, using the time of day (in 12-hour format), minutes and seconds, as well as showing AM/PM.
So to add the time and date, we can add the following:
What this will do is store the time/date stamp format into variables and convert them to strings so that they can then be "drawn" in a window.
In RMXP, the following script can be used to replace the default. In RMVX, create a new script called
Window_PlayTime:
RMXP will display the replacement time/date in the default "Play Time" window on the menu status.
To make this work in RMVX, add the following to
Scene_Menu:
In the
start definition routine, add
where
X and
Y are the x- and y-coordinates for the window placement.
Add the following to the
terminate definition routine:
This is to ensure that the window doesn't stay onscreen when the status menu has been exited.
And finally, add the following to the
update definition routine:
This is to ensure that the time refreshes every second while on the status menu.
The resultant "Play Time" window should now contain the current time and date, thus:
And that's it, but the
strftime element does have a number of different format options, which I'll detail in the next entry.