How to show the day and the week?

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
willanik
Regular
Posts: 35
Joined: Fri Mar 24, 2017 7:44 pm
Contact:

How to show the day and the week?

#1 Post by willanik »

Hi guys,

I need some help. I am setting up a game where the story runs over several weeks.

The player goes to sleep at the end of each day so it will be easy to set up a 'day' variable that increases by 1 on the sleep action. Up at the top of my game screen I would really like to show the week number (week 1, week 2 etc) and the day (ideally as Monday, Tuesday etc).

I have seen other games that do this sort of thing but I cannot find a tutorial or any other advice on how it is set up. I know there is a fancy calendar available that has actual months and even new moons but I think that is more then I need

Can someone direct me to a guide or another good source of information?

Many thanks.

User avatar
Hijiri
Eileen-Class Veteran
Posts: 1519
Joined: Sun Mar 25, 2012 6:35 pm
Completed: Death Rule:lost code Overdrive Edition, Where the White Doves Rest-Tsumihanseishi
Projects: Death Rule: Killing System
Organization: MESI Games
IRC Nick: Hizi
Tumblr: mesigames
Skype: kurotezuka
itch: hijiri
Location: Los Angeles
Contact:

Re: How to show the day and the week?

#2 Post by Hijiri »

Here's a rough example of what you want since I have something similar in a little private project I've played around with:

Code: Select all

define gamedays = {
        "default" : ["chap/day 0.png"],
        "D-0" : ["chap/day 0.png"],
        "D-1" : ["chap/day 1.png"],
        "D-2" : ["chap/day 2.png"],
        "D-3" : ["chap/day 3.png"],
        "D-4" : ["chap/day 4.png"],
        "D-5" : ["chap/day 5.png"],
        "D-6" : ["chap/day 6.png"],.
        }
define gamechapter = {
        "default" : ["chap/ch 0.png"],
        "CH-0" : ["chap/ch 0.png"],
        "CH-1_1" : ["chap/ch 1_1.png"],
        "CH-1_2" : ["chap/ch 1_2.png"],
        "CH-1_3" : ["chap/ch 1_3.png"],
        "CH-1_4" : ["chap/ch 1_4.png"],
        "CH-1_5" : ["chap/ch 1_5.png"],
        "CH-1_6" : ["chap/ch 1_6.png"],
        "CH-1_7" : ["chap/ch 1_7.png"],
        "CH-0_u" : ["chap/ch 0_u.png"],
        }
screen daychap:
    add "chap/chapbase.png" xalign 1.0 yalign 0
    #The part on top is a background
    for d in current_gameday:
        add d:
            pos (0, 0)
    for d in current_gamechapter:
        add d:
            pos (217, 0)
##This part below is in your script, where
$ current_gameday = gamedays["D-0"]
$ current_gamechapter = gamechapter["CH-0"]
show screen daychap
##And now down here goes your script.
Image Image
"Perfection goal that always changes. Can pursue, cannot obtain."

willanik
Regular
Posts: 35
Joined: Fri Mar 24, 2017 7:44 pm
Contact:

Re: How to show the day and the week?

#3 Post by willanik »

Thanks Hijiri! I'll use this as a start and see how I go.

W

Post Reply

Who is online

Users browsing this forum: No registered users