Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- init python:
- class Game_Time:
- PERIODS = ("Morning", "Noon", "Afternoon", "Evening", "Night")
- MONTHS = ("WEEK1", "WEEK2", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
- WEEK_DAYS = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
- MONTHS_DAYS = (7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7)
- def __init__(self, now = 0):
- self.period = 0
- self.day = 0
- self.week = 0
- self.week_day = 0
- self.month = 0
- self.month_day = 0
- self.now = now
- self.update()
- def advance(self, n = 1):
- self.now += n
- self.update()
- def update(self):
- self.period = self.now % len(Game_Time.PERIODS)
- self.day = self.now / len(Game_Time.PERIODS)
- self.week_day = self.day % 7
- self.week = self.day / 7
- day = self.day
- self.month = 0
- while day >= Game_Time.MONTHS_DAYS[self.month]:
- day -= Game_Time.MONTHS_DAYS[self.month]
- self.month += 1
- self.month_day = day + 1
- def period_name(self):
- return Game_Time.PERIODS[self.period]
- def week_day_name(self):
- return Game_Time.WEEK_DAYS[self.week_day]
- def month_name(self):
- return Game_Time. MONTHS[self.month]
- def date_name(self):
- return self.week_day_name() + ", " + self.month_name() + " " + str(self.month_day)
- label start:
- label time_start:
- $ time = Game_Time()
- label time_loop:
- $ date = time.date_name()
- $ period = time.period_name()
- $ month = time.month_name()
- $ weekday = time.week_day_name()
- "Today is [date]. It is [period]. AND [month]"
- "Today is [weekday] [period] [month]"
- menu:
- "Next period":
- $ time.advance()
- "Next day":
- $ time.advance(len(Game_Time.PERIODS))
- "Next week":
- $ time.advance(len(Game_Time.PERIODS) * 7)
- jump time_loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement