Calendar showing correctly

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
richycapy
Regular
Posts: 51
Joined: Mon May 27, 2019 8:53 pm
Organization: EN Productions
Location: Mexico
Contact:

Calendar showing correctly

#1 Post by richycapy » Mon Jun 17, 2019 7:10 pm

Hi!

Base on this script:
viewtopic.php?f=8&t=25098

So I modify your script for my game, since it has some features I dont requiere, and I needed time of the day, so I have this:

Code: Select all

init python:
    class Calendar(object):
        def __init__(self, week=1, timeofdaycounter=0):
            self.week = week
            self.timeofdaycounter = timeofdaycounter
            self.daycount_from_gamestart = 0
            self.days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
            self.timeofdayname = ["Morning", "Noon", "Afternoon", "Evening", "Night"]

        @property
        def game_day(self):
            return self.daycount_from_gamestart + 1

        def dayname(self):
            daylistidx = self.daycount_from_gamestart % len(self.days)
            return self.days[daylistidx]

        def timeofday(self):
            return self.timeofdayname[self.timeofdaycounter]

        def nexttime(self):
            if self.timeofdaycounter < 4:
                self.timeofdaycounter += 1
            else:
                self.timeofdaycounter = 0

        def nextday(self, days=1):
            self.daycount_from_gamestart += days
            self.timeofdaycounter = 0

screen calendar:
    modal True
    zorder 100
    vbox:
        align(1.0, 0)
        spacing 10
        text ("Day: [calendar.game_day]")
        text ("Day name: [calendar.dayname]")
        text ("Time of day: [calendar.timeofday]")

label start:
$ calendar = Calendar(1, 0)

    show screen calendar
    call screen room

I get this:
Image

Its shows the count day correctly but the other two shows weird text...

Can you help me?

I want to have the calendar showing the whole time, but hide it when characters are talking

Thanks! :D

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Calendar showing correctly

#2 Post by Remix » Mon Jun 17, 2019 8:02 pm

Looks like you need to add
@property
just before the two methods in question
Frameworks & Scriptlets:

User avatar
richycapy
Regular
Posts: 51
Joined: Mon May 27, 2019 8:53 pm
Organization: EN Productions
Location: Mexico
Contact:

Re: Calendar showing correctly

#3 Post by richycapy » Mon Jun 17, 2019 8:20 pm

Remix wrote:
Mon Jun 17, 2019 8:02 pm
Looks like you need to add
@property
just before the two methods in question
Awesome!!! Thanks for the help!!

Post Reply

Who is online

Users browsing this forum: Bing [Bot]