Hi guys,
I'm trying to learn Ren'py but got stuck with this issue for 2 days.
I wanted to make a menu choice show or not depending of the time of the day.
For the time I used a object, see below:
init python:
class Calendar(object):
def __init__(self, Weekday, Day, Hours, Minutes, DayCounter):
self.Weekday = Weekday
self.Day = Day
self.Hours = Hours
self.Minutes = Minutes
self.DayCounter = DayCounter
property
def Output(self):
return self.Weekday[self.Day] + " " + str(self.Hours).zfill(2)+ ":" + str(self.Minutes).zfill(2)
property
def DayCount(self):
return str(self.DayCounter)
property
def Hour(self):
return str(self.Hours)
def AddTime(self, Hours, Minutes):
self.Hours += Hours
self.Minutes += Minutes
if self.Minutes > 59:
self.Minutes -= 60
self.Hours += 1
if self.Hours > 23:
self.Hours -=24
self.Day += 1
self.DayCounter +=1
if self.Day > 6:
self.Day = 0
Now I wanted to use it like this:
label .classroom:
scene Classroom
menu:
"Take class" if calendar.Hour == 8:
"Class block"
"Wait":
$ calendar.AddTime(1, 0)
jump .classroom
"Leave":
$ calendar.AddTime(0, 5)
jump .schoolcorridor
Am I doing something wrong? "Take class" option doesn't show regardless of what I try.
Would appreciate any help.
I'm trying to learn Ren'py but got stuck with this issue for 2 days.
I wanted to make a menu choice show or not depending of the time of the day.
For the time I used a object, see below:
init python:
class Calendar(object):
def __init__(self, Weekday, Day, Hours, Minutes, DayCounter):
self.Weekday = Weekday
self.Day = Day
self.Hours = Hours
self.Minutes = Minutes
self.DayCounter = DayCounter
property
def Output(self):
return self.Weekday[self.Day] + " " + str(self.Hours).zfill(2)+ ":" + str(self.Minutes).zfill(2)
property
def DayCount(self):
return str(self.DayCounter)
property
def Hour(self):
return str(self.Hours)
def AddTime(self, Hours, Minutes):
self.Hours += Hours
self.Minutes += Minutes
if self.Minutes > 59:
self.Minutes -= 60
self.Hours += 1
if self.Hours > 23:
self.Hours -=24
self.Day += 1
self.DayCounter +=1
if self.Day > 6:
self.Day = 0
Now I wanted to use it like this:
label .classroom:
scene Classroom
menu:
"Take class" if calendar.Hour == 8:
"Class block"
"Wait":
$ calendar.AddTime(1, 0)
jump .classroom
"Leave":
$ calendar.AddTime(0, 5)
jump .schoolcorridor
Am I doing something wrong? "Take class" option doesn't show regardless of what I try.
Would appreciate any help.