Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Real Time System

Ok, now here's a toughy (I think). I've seen the AWS and ATS scripts out there but was wondering, is there a way to pull the time and date from the Real clock (you know, the one in the lower right of your taskbar in M$ Windows) I'm making a game that will have different things going on depending on what time of the day you play it, or have special things depending on what day you play it, for example, Santa Claus will appear and give you gifts if you play between Dec 24 12:00am - Dec 26 11:59pm.
 
I think you can use Ruby's built-in "Time" class.
Look in "Help - RGSS Reference Manual - Standard Library - Built-in Classes - Object - Time" for more details.

Edit: Here it is...
Time
The time class.

Superclass
Object

Included Module
Comparable

Class Method
Time.now
Returns the current Time object.

Methods
self + other
Returns a time that is later than self by other seconds.

self - other
When other is a Time object, returns the difference between the two times with Float. If other is a numeric value, returns a time that is earlier than self by other.

self <=> other
Compares times. other must be a Time object or a numeric value; if a numeric value, the times are compared in terms of seconds since the epoch began.

strftime(format)
Returns the time, having been converted into a string via a format string. The format string may be specified with the following:

%A
Day of the week (Sunday, Monday ... )

%a
Day of the week, abbreviated (Sun, Mon ... )

%B
Month (January, February ... )

%b
Month, abbreviated (Jan, Feb ... )

%c
Date and time

%d
Day of the month (01-31)

%H
Time of day, 24-hour format (00-23)

%I
Time of day, 12-hour format (01-12)

%j
Day of the year (001-366)

%M
Minutes (00-59)

%m
Month of the year (01-12)

%p
AM or PM

%S
Seconds (00-60, 60 being a leap second)

%U
Week of the year, the first week starting with the first Sunday (00-53)

%W
Week of the year, the first week starting with the first Monday (00-53)

%w
Day of the week (0-6, 0 denoting Sunday)

%X
Time

%x
Date

%Y
Year, 4-digit

%y
Year, 2-digit (00-99)

%Z
Time zone

%%
The character %

sec
Returns the seconds.

min
Returns the minutes.

hour
Returns the hour.

mday
Returns the day.

mon
Returns the month.

year
Returns the year.

wday
Returns the number representing the day of the week.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top