MZ Please help me create a MZ time system plugin.

Hello everyone.

I was making an action farm simulation RPG.

Since I am a beginner, I had a hard time creating a plugin.
I created a time system plugin with the help of ChatGPT.

Can you take a look at the contents of this plugin?
Please let me know if anything is missing.

Spoiler
//=============================================================================
// MyTimeSystem.js
//=============================================================================

/*:
* @target MZ
* @plugindesc Simple Time System Plugin
* @Author Your Name
*
* ----------------------------------------------------------------------------
* This plugin provides a simple time system for your game.
* ----------------------------------------------------------------------------
*
* @param GameSpeed
* @text Game Speed (minutes per frame)
* @desc The speed at which time progresses in the game. Lower values make time pass more slowly.
* @type number
* @Default 1
*
* @param DayStartHour
* @text Day Start Hour
* @desc The hour at which each day starts.
* @type number
* @Default 6
*
* @param DayEndHour
* @text Day End Hour
* @desc The hour at which each day ends.
* @type number
* @Default 12
*
* @param SleepHour
* @text Sleep Hour
* @desc The hour at which the character goes to sleep and advances to the next day.
* @type number
* @Default 12
*
* @param DaysInWeek
* @text Days In Week
* @desc The number of days in a week.
* @type number
* @Default 7
*
* @param SeasonsInYear
* @text Seasons In Year
* @desc The number of seasons in a year.
* @type number
* @Default 4
*/

(function() {
var parameters = PluginManager.parameters('MyTimeSystem');
var gameSpeed = Number(parameters['GameSpeed'] || 1);
var dayStartHour = Number(parameters['DayStartHour'] || 6);
var dayEndHour = Number(parameters['DayEndHour'] || 12);
var sleepHour = Number(parameters['SleepHour'] || 12);
var daysInWeek = Number(parameters['DaysInWeek'] || 7);
var seasonsInYear = Number(parameters['SeasonsInYear'] || 4);

var seasonNames = ['Spring', 'Summer', 'Fall', 'Winter'];
var weekDayNames = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
var currentSeasonIndex = 0;
var dayCount = 0;

function Window_TimeDisplay() {
this.initialize.apply(this, arguments);
}

Window_TimeDisplay.prototype = Object.create(Window_Base.prototype);
Window_TimeDisplay.prototype.constructor = Window_TimeDisplay;

Window_TimeDisplay.prototype.initialize = function(rect) {
Window_Base.prototype.initialize.call(this, rect);
this.refresh();
};

Window_TimeDisplay.prototype.refresh = function() {
this.contents.clear();
this.drawText($gameSystem.getFormattedSeason(), 0, 0, this.contents.width, 'center');
};

Window_TimeDisplay.prototype.update = function() {
Window_Base.prototype.update.call(this);
if (this.needsRefresh()) {
this.refresh();
}
};

Window_TimeDisplay.prototype.needsRefresh = function() {
return $gameSystem._minute !== $gameSystem._lastMinute;
};

Game_System.prototype.initializeTimeVariables = function() {
this._minute = 0;
this._hour = dayStartHour;
this._day = 1;
this._weekDay = 1;
this._month = 1;
this._year = 1;
this._season = seasonNames[currentSeasonIndex];
};

Game_System.prototype.advanceToNextDay = function() {
this._day++;
this._weekDay = (this._weekDay % daysInWeek) + 1;
if (this._day > seasonsInYear * 28) {
this._day = 1;
this._month++;
if (this._month > seasonsInYear) {
this._month = 1;
this._year++;
currentSeasonIndex = (currentSeasonIndex + 1) % seasonNames.length;
this._season = seasonNames[currentSeasonIndex];
}
}
dayCount++;
this._hour = dayStartHour;
};

Game_System.prototype.getFormattedSeason = function() {
return this._season;
};

Game_System.prototype.getFormattedDate = function() {
var month = this._month !== undefined ? this._month : 1;
var day = this._day !== undefined ? this._day : 1;
var year = this._year !== undefined ? this._year : 1;

return month.padZero(2) + '/' + day.padZero(2) + '/' + year.padZero(4);
};

Game_System.prototype.getFormattedWeekDay = function() {
return weekDayNames[this._weekDay - 1];
};

Game_System.prototype.getFormattedTime = function() {
var hour = this._hour !== undefined ? this._hour : 0;
var minute = this._minute !== undefined ? this._minute : 0;

return hour.padZero(2) + ':' + minute.padZero(2);
};

var _Game_System_update = Game_System.prototype.update;
Game_System.prototype.update = function(sceneActive) {
_Game_System_update.call(this, sceneActive);
this.updateTime();
};

var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command.toLowerCase() === 'initializetimevariables') {
$gameSystem.initializeTimeVariables();
}
};
})();
I’m approving this thread because no rules about chatbot plugins have yet been extended to this section, though heads up, a lot of members will not work with chatbot plugins. They may instead opt to recommend other plugins.
I don't think this works... the variable gameSpeed is never used, I don't see where is the part where time moves forward.. I mean, did you try it? does it work for you?
There are dozens of time plugins out there:

just to mention a few.
I’m approving this thread because no rules about chatbot plugins have yet been extended to this section, though heads up, a lot of members will not work with chatbot plugins. They may instead opt to recommend other plugins.
Probably because it's degrading for someone who understands Javascript to play QA for a bot that just haphazardly stitches together bits of code from unknown sources, especially when half a dozen time system plugins already exist and have stood the test of time, so to speak.

In addition to the above, there's also Moghunter's time system which I use. It's in their MV pack but I hear it works in MZ.

As others have mentioned, there are lots of time system plugins if you simply Google it.

Additionally, you give zero information about what you actually want this to do. The majority of people who implement some kind of time system in their game do not need a plugin for it, it's easily done via events.

So skip talking to the computer and tell us what you actually want to do in your game.

Original thread: https://forums.rpgmakerweb.com/threads/please-help-me-create-a-mz-time-system-plugin.165213/