Can I "block" a label according to real time?

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
Nanahs
Veteran
Posts: 297
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Can I "block" a label according to real time?

#1 Post by Nanahs » Wed Feb 13, 2019 5:43 pm

I'm using if statements to send messages in my game according to real time.
Like this:

Code: Select all

    if month is 12 and day in [24,25]:
        jump christmasmessage
And there's an option the player can access to read those messages, in case they didn't play the game on the day they would receive them.
Like:

Code: Select all

    menu messageslist:
        "Read Christmas message":
            jump christmasmessage
            
        "Read Birthday message":
            jump birthdaymessage
The problem is that this way those messages are always available in that menu.

I was wondering if I could make them unavailable before the day they were supposed to be sent.

For example this Christmas message. Before December 24,25 you wouldn't be able to access them on:

Code: Select all

    menu messageslist:
        "Read Christmas message":
            jump christmasmessage
A text saying "This message hasn't been sent to you yet" would appear or something.

Is there something I can add with the "jump christmasmessage" on menu that "blocks" it like this?
I was reading the documments but didn't find it.

Thanks.

User avatar
Karl_C
Veteran
Posts: 232
Joined: Sun Mar 31, 2013 6:18 am
Contact:

Re: Can I "block" a label according to real time?

#2 Post by Karl_C » Wed Feb 13, 2019 11:04 pm

Try

Code: Select all

 menu messageslist: 
     "Read Christmas message" if month is 12 and day in [24,25]:
         jump christmasmessage 
If the config.menu_include_disabled variable is set to True, it will be shown as a disabled button.

In-Game Menus

User avatar
Nanahs
Veteran
Posts: 297
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: Can I "block" a label according to real time?

#3 Post by Nanahs » Thu Feb 14, 2019 7:26 am

Karl_C wrote:
Wed Feb 13, 2019 11:04 pm
Try

Code: Select all

 menu messageslist: 
     "Read Christmas message" if month is 12 and day in [24,25]:
         jump christmasmessage 
If the config.menu_include_disabled variable is set to True, it will be shown as a disabled button.

In-Game Menus
Thank you! I'll give it a try :)

Post Reply

Who is online

Users browsing this forum: Jackkel Dragon