How can I have it so Ren'Py checks the date of the computer?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
EnderSprings
Newbie
Posts: 3
Joined: Sat Feb 20, 2021 10:45 pm
Projects: I'm work on a indie game, it has no name yet, but it's a husband/wife collection game. It has some rpg elements to.
Deviantart: EnderSprings
Discord: 🌸🌺EnderSprings 🌺🌸#7320
Contact:

How can I have it so Ren'Py checks the date of the computer?

#1 Post by EnderSprings »

Hi!
I want Ren'Py to check the date of the computer so I can add holiday events. Where player's would get special event items, outfits, and special characters. I don't know if it's possible, but it'd be a great help! Thanks a bunch!

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How can I have it so Ren'Py checks the date of the computer?

#2 Post by PyTom »

Use the datetime module:

Code: Select all

init python:
    import datetime

label start:
     $ now = datetime.datetime.now()
     if now.month == 1 and now.day == 1:
         "Happy new year."
     else:
         "Happy not-new-year."
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

EnderSprings
Newbie
Posts: 3
Joined: Sat Feb 20, 2021 10:45 pm
Projects: I'm work on a indie game, it has no name yet, but it's a husband/wife collection game. It has some rpg elements to.
Deviantart: EnderSprings
Discord: 🌸🌺EnderSprings 🌺🌸#7320
Contact:

Re: How can I have it so Ren'Py checks the date of the computer?

#3 Post by EnderSprings »

Thank you a bunch! is there anywhere I could find the module?

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: How can I have it so Ren'Py checks the date of the computer?

#4 Post by PyTom »

The datetime module is built into Ren'Py. You can find the documentation at:

https://docs.python.org/2/library/datetime.html
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

EnderSprings
Newbie
Posts: 3
Joined: Sat Feb 20, 2021 10:45 pm
Projects: I'm work on a indie game, it has no name yet, but it's a husband/wife collection game. It has some rpg elements to.
Deviantart: EnderSprings
Discord: 🌸🌺EnderSprings 🌺🌸#7320
Contact:

Re: How can I have it so Ren'Py checks the date of the computer?

#5 Post by EnderSprings »

Oh, thank you a bunch! That was a bunch of help!

Post Reply

Who is online

Users browsing this forum: No registered users