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.

Old & Easy - Current Time & Day into variables

Hey, this is an easy request.
I had a script about a year and a half ago, which took the current time from your computer and entered it into variables.
I've serached and serached many forums for it, just can't seem to find it anywhere, and if I remember correctly it's only a few lines of code.
I would like current hour into a variable, minutes, and the day.
Please feel free to scream at me if its right in my face somewhere, but I just couldn't seem to find it, scripts have gotten so much more advanced nowadays, just can't seem to find the old basic easy ones.
Many thanks, Adam.
 

Eilei

Sponsor

You don't even really need a full script for this. Just put the following lines:

current = Time.now
$game_variables[ 1 ] = current.day
$game_variables[ 2 ] = current.hour
$game_variables[ 3 ] = current.min

into a Script command in the event you want, where 1, 2, and 3 are replaced with the IDs of the variables you want to use.

Edit: current.day will give you day of the month. If you want day of the week, use current.wday
 

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