[Solved] How to create code for setting up a day to a week schedule (like morning, noon, evening, night, monday-sunday)?

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
Trafagal
Regular
Posts: 100
Joined: Mon Apr 29, 2019 9:32 am
Contact:

[Solved] How to create code for setting up a day to a week schedule (like morning, noon, evening, night, monday-sunday)?

#1 Post by Trafagal » Fri Feb 04, 2022 10:53 pm

Hi Community,

I have seen some games where when player click a few locations, the day will change from morning to night.
May I ask does anyone able to provide some sample codes for setting up a day to a week schedule (like morning, noon, evening, night, monday-sunday) in renpy?

When the player selected the a location = event, I would like the menu bar which has the image for Morning/Noon/Night to change together with the background of Morning/Noon/Night, and also the player's color.
summertime sega.png
game and date.JPG
Last edited by Trafagal on Wed Feb 09, 2022 8:29 am, edited 1 time in total.
Check out some of my stuffs here:https://linktr.ee/theartofjoshlab

Art Portfolio: https://www.instagram.com/theartofjoshlab/

Working on a personal Visual Novel~

rayminator
Miko-Class Veteran
Posts: 754
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: How to create code for setting up a day to a week schedule (like morning, noon, evening, night, monday-sunday)?

#2 Post by rayminator » Sat Feb 05, 2022 12:26 am

this will help you
map.png
map.png (17.32 KiB) Viewed 315 times

Code: Select all

screen TopBar():

    hbox:
        xalign 0.003
        spacing 10

        if month == 1:
            $ mm = _("Jan")
        elif month == 2:
            $ mm = _("Feb")
        elif month == 3:
            $ mm = _("March")
        elif month == 4:
            $ mm = _("Apirl")
        elif month == 5:
            $ mm = _("May")
        elif month == 6:
            $ mm = _("June")
        elif month == 7:
            $ mm = _("July")
        elif month == 8:
            $ mm = _("August")

        text "[mm]":
            size 30
            color "#0099cc"
            outlines [(3, "#000000", 0, 0)]
            font "font/Lobster-Regular.ttf"

        text " ":
            size 30
            color "#0099cc"
            outlines [(3, "#000000", 0, 0)]
            font "font/Lobster-Regular.ttf"

        if daytime == 0:
            $ dds = _("Morning")
        elif daytime == 1:
            $ dds = _("Afternoon")
        elif daytime == 2:
            $ dds = _("Evening")
        elif daytime == 3:
            $ dds = _("Night")

        if day == 0:
            $ bb = _("Sunday")
        elif day == 1:
            $ bb = _("Monday")
        elif day == 2:
            $ bb = _("Tuesday")
        elif day == 3:
            $ bb = _("Wed")
        elif day == 4:
            $ bb = _("Thursday")
        elif day == 5:
            $ bb = _("Friday")
        elif day == 6:
            $ bb = _("Saturday")


        text "[bb]":
            size 30
            color "#0099cc"
            outlines [(3, "#000000", 0, 0)]
            font "font/Lobster-Regular.ttf"

        text " ":
            size 30
            color "#0099cc"
            outlines [(3, "#000000", 0, 0)]
            font "font/Lobster-Regular.ttf"

        text "[dds]":
            size 30
            color "#0099cc"
            outlines [(3, "#000000", 0, 0)]
            font "font/Lobster-Regular.ttf"

User avatar
Trafagal
Regular
Posts: 100
Joined: Mon Apr 29, 2019 9:32 am
Contact:

Re: How to create code for setting up a day to a week schedule (like morning, noon, evening, night, monday-sunday)?

#3 Post by Trafagal » Sat Feb 05, 2022 7:47 pm

rayminator wrote:
Sat Feb 05, 2022 12:26 am
this will help you
map.png

Code: Select all

screen TopBar():

    hbox:
        xalign 0.003
        spacing 10

        if month == 1:
            $ mm = _("Jan")
        elif month == 2:
            $ mm = _("Feb")
        elif month == 3:
            $ mm = _("March")
        elif month == 4:
            $ mm = _("Apirl")
        elif month == 5:
            $ mm = _("May")
        elif month == 6:
            $ mm = _("June")
        elif month == 7:
            $ mm = _("July")
        elif month == 8:
            $ mm = _("August")

        text "[mm]":
            size 30
            color "#0099cc"
            outlines [(3, "#000000", 0, 0)]
            font "font/Lobster-Regular.ttf"

        text " ":
            size 30
            color "#0099cc"
            outlines [(3, "#000000", 0, 0)]
            font "font/Lobster-Regular.ttf"

        if daytime == 0:
            $ dds = _("Morning")
        elif daytime == 1:
            $ dds = _("Afternoon")
        elif daytime == 2:
            $ dds = _("Evening")
        elif daytime == 3:
            $ dds = _("Night")

        if day == 0:
            $ bb = _("Sunday")
        elif day == 1:
            $ bb = _("Monday")
        elif day == 2:
            $ bb = _("Tuesday")
        elif day == 3:
            $ bb = _("Wed")
        elif day == 4:
            $ bb = _("Thursday")
        elif day == 5:
            $ bb = _("Friday")
        elif day == 6:
            $ bb = _("Saturday")


        text "[bb]":
            size 30
            color "#0099cc"
            outlines [(3, "#000000", 0, 0)]
            font "font/Lobster-Regular.ttf"

        text " ":
            size 30
            color "#0099cc"
            outlines [(3, "#000000", 0, 0)]
            font "font/Lobster-Regular.ttf"

        text "[dds]": 
            size 30
            color "#0099cc"
            outlines [(3, "#000000", 0, 0)]
            font "font/Lobster-Regular.ttf"
Thank you so much ! I have been looking for this for sometime.
Check out some of my stuffs here:https://linktr.ee/theartofjoshlab

Art Portfolio: https://www.instagram.com/theartofjoshlab/

Working on a personal Visual Novel~

Post Reply

Who is online

Users browsing this forum: Bing [Bot], enaielei, Google [Bot]