Version: 2.2.0

Description: Time system.

Want to create a merchant that only appears on weekdays during certain hours? Easily!

Want to create holidays in the game? Easily!

Looking to create a time-based building system? Easily!

Features:

  • Use preset time or real time from the player’s device
  • Display a window with time while playing
  • Change time/date through plugin commands, script calls
  • Write time/date to variables
  • Control switches with time/date based conditions
  • Events wait using time instead of waiting with frame count
  • Change switches, self switches and variables with a time/date based timer

Planned features:

  • Support for Lighting
  • Support for Weather

Add-ons:

Compatibility:

  • RPG Maker MV: 1.5+
  • RPG Maker MZ: 1.0+

Script calls:

spoiler
You can create Game_Time type objects for their own needs

Constructor of Game_Time supports multiple parameter options:
1. Without parameters (it will be created based on current system time)
Example: var gameTime = new Game_Time();

2. With 1 parameter (object of Game_Time)
Example: var gameTime = new Game_Time($gameTime);
Example: var gameTime = new Game_Time(new Date());
Example: var gameTime = new Game_Time({
 sec: 0, min: 0, hour: 0,
 day: 1, month: 0, year: 0
 });

# Get time and date #
$gameTime.ms - get milliseconds
$gameTime.sec - get seconds
$gameTime.min - get minutes
$gameTime.hour - get hour
$gameTime.day - get day
$gameTime.dayWeek - get day week
$gameTime.dayWeekName - get day week name
$gameTime.dayWeekShortName - get day week short name
$gameTime.dayYear - get day of the year
$gameTime.week - get week number
$gameTime.month - get month
$gameTime.monthName - get month name
$gameTime.year - get year
$gameTime.season - get season
$gameTime.seasonName - get season name
$gameTime.date - get date (day, day week, month, year)
$gameTime.time - get time (ms, sec, min, hour)
$gameTime.speed - get speed

# Set time and date #
$gameTime.year = year - set year
$gameTime.month = month - set month (starting at 0)
$gameTime.day = day - set day (starting at 1)
$gameTime.hour = hour - set hour (starting at 0)
$gameTime.min = min - set minutes (starting at 0)
$gameTime.sec = sec - set seconds (starting at 0)
$gameTime.ms = ms - set milliseconds (starting at 0)

# Add time and date #
$gameTime.addMs(value = 1) - add milliseconds. Default 1.
$gameTime.addSec(value = 1) - add seconds. Default 1.
$gameTime.addMin(value = 1) - add minutes. Default 1.
$gameTime.addHour(value = 1) - add hour. Default 1.
$gameTime.addDay(value = 1) - add day. Default 1.
$gameTime.addMonth(value = 1) - add month. Default 1.
$gameTime.addYear(value = 1) - add year. Default 1.
Chaining is supported. Example:
$gameTime.addDay(1).addHour(1).addMin(10)

# Subtract time and date #
$gameTime.remSec(value = 1) - subtract seconds. Default 1.
$gameTime.remMin(value = 1) - subtract minutes. Default 1.
$gameTime.remHour(value = 1) - subtract hour. Default 1.
$gameTime.remDay(value = 1) - subtract day. Default 1.
$gameTime.remMonth(value = 1) - subtract month. Default 1.
$gameTime.remYear(value = 1) - subtract year. Default 1.
Chaining is supported. Example:
$gameTime.remDay(1).remHour(1).remMin(10)

# Comparison methods #
1. gameTime > otherGameTime
1.1. Compare date and time
more(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.more(otherGameTime, false)
1.2. Compare only date
moreDate(otherGameTime)
otherGameTime - object of Game_Time
Example: $gameTime.moreDate(otherGameTime, false)
1.3. Compare only time
moreTime(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.moreTime(otherGameTime, false)

2. gameTime < otherGameTime
2.1. Compare date and time
less(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.less(otherGameTime, true)
2.2. Compare only date
lessDate(otherGameTime)
otherGameTime - object of Game_Time
Example: $gameTime.lessDate(otherGameTime)
2.3. Compare only time
lessTime(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.lessTime(otherGameTime, true)

3. gameTime >= otherGameTime
3.1. Compare date and time
moreEquals(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.moreEquals(otherGameTime, false)
3.2. Compare only date
moreEqualsDate(otherGameTime)
otherGameTime - object of Game_Time
Example: $gameTime.moreEqualsDate(otherGameTime)
3.3. Compare only time
moreEqualsTime(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.moreEqualsTime(otherGameTime, false)

4. gameTime <= otherGameTime
4.1. Compare date and time
lessEquals(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.lessEquals(otherGameTime, true)
4.2. Compare only date
lessEqualsDate(otherGameTime)
otherGameTime - object of Game_Time
Example: $gameTime.lessEqualsDate(otherGameTime)
4.3. Compare only time
lessEqualsTime(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.lessEqualsTime(otherGameTime, true)

5. gameTime == otherGameTime
5.1. Compare date and time
equals(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.equals(otherGameTime, false)
5.2. Compare only date
equalsDate(otherGameTime)
otherGameTime - object of Game_Time
Example: $gameTime.equalsDate(otherGameTime)
5.3. Compare only time
equalsTime(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.equalsTime(otherGameTime, false)

6. Define sort order
6.1. Compare date and time
compareTo(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.compareTo(otherGameTime, true)
6.2. Compare only date
compareToDate(otherGameTime)
otherGameTime - object of Game_Time
Example: $gameTime.compareToDate(otherGameTime)
6.3. Compare only time
compareToTime(otherGameTime, blockSeconds = false)
otherGameTime - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.compareToTime(otherGameTime, true)

7. Range check
7.1. Compare date and time
inRange(gameTime1, gameTime2, blockSeconds = false)
gameTime1 - object of Game_Time
gameTime2 - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.inRange(gameTime1, gameTime2, true)
7.2. Compare only date
inRangeDate(gameTime1, gameTime2)
gameTime1 - object of Game_Time
gameTime2 - object of Game_Time
Example: $gameTime.inRangeDate(gameTime1, gameTime2)
7.3. Compare only time
inRangeTime(gameTime1, gameTime2, blockSeconds = false)
gameTime1 - object of Game_Time
gameTime2 - object of Game_Time
blockSeconds - block seconds comparison (true/false)
Example: $gameTime.inRangeTime(gameTime1, gameTime2, true)

8. Formatted string
format(formatString)
Use special symbols from the "Date and time format" section
Example: $gameTime.format("%HH:%mm")

# Other functions #
clone() - clone an object
copyFrom(object) - Copy data from an object (Game_Time, Object or Date)
pause(duration = -1) - Stop time. Pause duration in frames. -1 for unlimited pause
resume() - Resume time
print() - Print time and date to console
setTime(object) - Set time (ms, sec, min, hour)
setDate(object) - Set date (day, dayWeek, month, year)
isUpdated() - Returns true if the time is updated
isPaused() - Returns true if time is paused
isRealTimeUsed() - Returns true if real time is used
isLeapYear() - Leap year
isDayOff() - Day off
add(type, value) - Add parameter (sec, min, hour, day, month, year)
rem(type, value) - Subtract parameter (sec, min, hour, day, month, year)
getDaysInMonth() - Days in current month
getDaysInYear() - Days in current year
getDayStart() - Returns start of the day
getDayEnd() - Returns end of the day
getFirstDay() - Returns first day of the month
getLastDay() - Returns last day of the month
toDate() - Returns a Date object
useRealTime(use = true) - Use real time

# Static methods #
Game_Time.checkVersion(version) - Check Game_Time plugin version
Game_Time.getMillisecondsInSecond() - Milliseconds in one second
Game_Time.getSecondsInMinute() - Seconds in one minute
Game_Time.getMinutesInHour() - Minutes in one hour
Game_Time.getHoursInDay() - Hours in one hour
Game_Time.getDaysInWeek() - Days in one week
Game_Time.getDaysInMonth(month, year) - Days in a month
Game_Time.getDaysInYear(year) - Days in a year
Game_Time.getMonthsInYear() - Months in a year
Game_Time.getDaysDifference(gameTime1, gameTime2 = $gameTime) - Difference in days between 2 dates
Game_Time.isDayOff(dayWeek) - Day off
Game_Time.isLeapYear(year) - Leap year
Game_Time.save(slot, gameTime = $gameTime) - Save Game_Time object to slot
Game_Time.load(slot) - Load Game_Time object from slot
Game_Time.addTime(gameTime, action) - Add a timer. When $gameTime >= gameTime, action will be executed

# Static properties #
Game_Time.months - Number of days in each month
Game_Time.window - Get time window
Game_Time.frameDuration - Frame duration

“Help” languages: English, Russian

Terms of use

How to get a commercial license

Demo: coming soon

Download: become a patron and download now

Public release: 12 December 2020