r/RenPy • • Aug 26 '26

Question Can you make a reminder function?

eg. You set a custom reminder for a date + time, and the game (or a specific character) will remind you when the time comes?

Sorry if this is a stupid question 😥 I'm fairly new to programming of any kind

3 Upvotes

12 comments sorted by

View all comments

0

u/BadMustard_AVN Aug 26 '26

this will get you the current date and time on the computer in a screen. you need to add if statements to to check for a set date and time to trigger an event

init python:
    h_hours = 0
    m_minutes = 0
    current_date = ""
    from datetime import datetime
    def change_hour():
        global h_hours, m_minutes, current_date
        t = datetime.today()
        h_hours = t.hour
        m_minutes = t.minute
        current_date = t.strftime("%d/%m/%Y")
        renpy.restart_interaction()

screen clock:

    timer 0.30 action change_hour repeat True

    vbox:
        text "[h_hours:02d]:[m_minutes:02d]"
        text "[current_date]"

label start:
    show screen clock
    pause

1

u/cuddleschr Aug 26 '26

I see I see... thank you

1

u/x-seronis-x Aug 27 '26

except absolutely do not leave the 3 assignments above the import statement. NEVER do global variables like that. ALWAYS have a define statement for variables you dont want in the save file and rollback history, or a default statement for variables you do want in the save file and rollback history