Triggering events in certain dates.

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
User avatar
Zeroized
Regular
Posts: 33
Joined: Sat Mar 23, 2013 12:33 am
Contact:

Triggering events in certain dates.

#1 Post by Zeroized »

Greetings.
I'm currently developing a game in Ren'py, and the idea of having certain events for christmas, new year, and halloween appeared.
How can I create an event that triggers only on those dates? I mean, not in game-time, but in real time. Like a special message if you play the game on December 25th or January 1st.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Triggering events in certain dates.

#2 Post by xavimat »

You can try this:

Code: Select all

init python:
    from datetime import datetime
    
label start:
    $ now = datetime.now()
    $ now = str(now)
    $ now = now[5:10]
    
    "Today is [now]."
    if now == "12-25":
        "Merry Christmas!"
    elif now == "01-01":
        "Happy New Year!"
    else:
        ":( Neither Christmas nor New Year ..."
    return
But I won't work too much on events that are so difficult to find.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Zeroized
Regular
Posts: 33
Joined: Sat Mar 23, 2013 12:33 am
Contact:

Re: Triggering events in certain dates.

#3 Post by Zeroized »

I think that worked, because at least the game is not spitting errors, and the event is locked.
Thanks for your help.

Post Reply

Who is online

Users browsing this forum: Google [Bot]