Adding Date to The Screen

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
kathaeris
Newbie
Posts: 15
Joined: Sun Nov 18, 2018 9:47 am
Deviantart: kathaeris
Contact:

Adding Date to The Screen

#1 Post by kathaeris » Sun Sep 13, 2020 10:13 am

I'm trying to add a simple date widget to the dialogue screen like below, I have checked other tutorials but they all seemed too complex for what I wanted, does anyone have any idea how to make one like this? :(
Attachments
cclts_textbox2.png

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

Re: Adding Date to The Screen

#2 Post by rayminator » Sun Sep 13, 2020 12:42 pm

this one way of doing it but there are other ways too

I don't know how you setting up your variables

you can do it like this

Code: Select all

text "[date][day][month]"

User avatar
Moshibit
Regular
Posts: 48
Joined: Wed Oct 16, 2019 1:58 pm
Location: Mexico
Contact:

Re: Adding Date to The Screen

#3 Post by Moshibit » Sun Sep 13, 2020 1:56 pm

The simplest thing you can do is create a screen that receives the day of the week, the date and the day. you call the screen and pass it the data you want to show. but if your game needs to control events per day you will have to implement a calendar.

This is an example of what can be done with the screen languages https://www.renpy.org/doc/html/screens.html

Code: Select all

screen today(day_week, date, day)

    frame:
        background "gui/myimage.png"
        xalign 0.98
        yalign 0.02
        xysize(450, 100)

        fixed:
            text day_week xalign 0.2 yalign 0.2
            text date  xalign 0.8 yalign 0.2
            text day  xalign 0.5 yalign 0.8
The data that you have to pass to this screen has to be strings.

You can also pass viable to the screen, but the text declarations will have to be modified like this:

Code: Select all

text "[variable]"
You can change the positions check the Position Style Properties section https://www.renpy.org/doc/html/style_pr ... properties

Just show the screen with:

Code: Select all

show screen today("Monday", "04TH", "Day 01")
and hide the screen with:

Code: Select all

hide screen today

User avatar
kathaeris
Newbie
Posts: 15
Joined: Sun Nov 18, 2018 9:47 am
Deviantart: kathaeris
Contact:

Re: Adding Date to The Screen

#4 Post by kathaeris » Sun Sep 13, 2020 9:54 pm

Thank you both so much for the help! I got it working :D

Post Reply

Who is online

Users browsing this forum: Google [Bot]