You want to just jump to morning of next day? Can be simplified so we do not count our start point.
# reset time of day (so we are back at 'morning')
$ clock.time_of_day = ["morning", "noon", "evening", "night"]
$ clock.day += 1
Subnote: Maybe add a method to the class that does it and call that ... def sleep_until_morning(self):
Your question:
Short of using a more complex system, the way you are going is probably best, though just one if:else should do
if not kitchenintro:
... "cannot sleep"
else:
... do the above
Simple script for a day/night cycle, or rather a morning, noon, evening & night cycle
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.
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.
- 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: Simple script for a day/night cycle, or rather a morning, noon, evening & night cycle
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: Simple script for a day/night cycle, or rather a morning, noon, evening & night cycle
Damn I didn't think of resetting the time, your method is way better!Remix wrote: ↑Sat Aug 04, 2018 9:26 am You want to just jump to morning of next day? Can be simplified so we do not count our start point.
# reset time of day (so we are back at 'morning')
$ clock.time_of_day = ["morning", "noon", "evening", "night"]
$ clock.day += 1
Subnote: Maybe add a method to the class that does it and call that ... def sleep_until_morning(self):
Your question:
Short of using a more complex system, the way you are going is probably best, though just one if:else should do
if not kitchenintro:
... "cannot sleep"
else:
... do the above
Then if you agree about my way of doing events I guess I will keep going on it.
Thanks for the input
-
- Newbie
- Posts: 3
- Joined: Fri Jan 10, 2020 4:43 pm
- Contact:
Re: Simple script for a day/night cycle, or rather a morning, noon, evening & night cycle
Hi, I am trying to build a calendar from this code, but I need to months and years as well as days and weeks. Would I simply add month and year to the init and then define them like below?
I have tried to test this code, but I seem to be missing something for it to actually implement the month and year in the calendar. Any assistance will be greatly appreciated.
Code: Select all
init python:
class day_time(object):
def __init__(self):
self.year = 1 # set to starting year
self.month = 1 # set to starting month
self.month_names = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] # month names from start to end
self.days_count = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # number of days in each month
self.day = 1 # set this to whatever starting day is
self.weekdays = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"] # arrange these so first weekday goes first
self.time_of_day = ["Early Morning","Morning", "Noon", "Afternoon", "Evening", "Late Evening", "Night"] # add or remove to increase time of day slots
self.end_of_day = self.time_of_day[-1] # automatically picks last slot as end of day
@property
def month_number(self):
return self._month + 1
@property
def month(self):
return self.month_names[self.month]
Re: Simple script for a day/night cycle, or rather a morning, noon, evening & night cycle
Is there anyway to add hours of the day instead of morning, noon etc..?
And how can I specify choice or event that has to happen between like 10am and 2pm?
Thanks alot
And how can I specify choice or event that has to happen between like 10am and 2pm?
Thanks alot
Re: Simple script for a day/night cycle, or rather a morning, noon, evening & night cycle
I have two questions:
1. Right now script have time of day, day of week, and day count. how to count weeks (week 1, week 2, etc.)
2. how to advance time of day, so that you can advance from morning to night on text button, but you can not advance from night to morning on text button, but for example if main character go to sleep time advances from night to morning.
1. Right now script have time of day, day of week, and day count. how to count weeks (week 1, week 2, etc.)
2. how to advance time of day, so that you can advance from morning to night on text button, but you can not advance from night to morning on text button, but for example if main character go to sleep time advances from night to morning.
Re: Simple script for a day/night cycle, or rather a morning, noon, evening & night cycle
Hi!
I'm also new to python. I used the code of kivik and so far everything is working.
I want to show a HUD, where the Time and the Weekday are shown.
So far I did this:
I call screen week_day_map and screen day_time_map but both don't show up. What am I doing wrong here?
Any help or suggestion would be appreciated.
I'm also new to python. I used the code of kivik and so far everything is working.
I want to show a HUD, where the Time and the Weekday are shown.
So far I did this:
Code: Select all
screen day_time_map:
zorder 103
if [clock.time]=="morning":
add Transform("morning.png", xpos=130, ypos=62)
if [clock.time]=="noon":
add Transform("noon.png", zoom=.8)
if [clock.time]=="afternoon":
add Transform("evening.png", zoom=.8)
if [clock.time]=="evening":
add Transform("evening.png", zoom=.8)
if [clock.time]=="night":
add Transform("night.png", zoom=.8)
screen week_day_map:
zorder 103
if [clock.weekday]=="Monday":
add Transform("monday_button.png", xpos=130, ypos=12)
if [clock.weekday]=="Tuesday":
add Transform("tuesday_button.png", zoom=.8)
if [clock.weekday]=="Wednesday":
add Transform("wednesday_button.png", zoom=.8)
if [clock.weekday]=="Thursday":
add Transform("thursday_button.png", zoom=.8)
if [clock.weekday]=="Friday":
add Transform("friday_button.png", zoom=.8)
if [clock.weekday]=="Saturday":
add Transform("saturday_button.png", zoom=.8)
if [clock.weekday]=="Sunday":
add Transform("sunday_button.png", zoom=.8)
Any help or suggestion would be appreciated.
Re: Simple script for a day/night cycle, or rather a morning, noon, evening & night cycle
Okay i figured it out:darthi86 wrote: ↑Fri Jan 08, 2021 10:51 am Hi!
I'm also new to python. I used the code of kivik and so far everything is working.
I want to show a HUD, where the Time and the Weekday are shown.
So far I did this:I call screen week_day_map and screen day_time_map but both don't show up. What am I doing wrong here?Code: Select all
screen day_time_map: zorder 103 if [clock.time]=="morning": add Transform("morning.png", xpos=130, ypos=62) if [clock.time]=="noon": add Transform("noon.png", zoom=.8) if [clock.time]=="afternoon": add Transform("evening.png", zoom=.8) if [clock.time]=="evening": add Transform("evening.png", zoom=.8) if [clock.time]=="night": add Transform("night.png", zoom=.8) screen week_day_map: zorder 103 if [clock.weekday]=="Monday": add Transform("monday_button.png", xpos=130, ypos=12) if [clock.weekday]=="Tuesday": add Transform("tuesday_button.png", zoom=.8) if [clock.weekday]=="Wednesday": add Transform("wednesday_button.png", zoom=.8) if [clock.weekday]=="Thursday": add Transform("thursday_button.png", zoom=.8) if [clock.weekday]=="Friday": add Transform("friday_button.png", zoom=.8) if [clock.weekday]=="Saturday": add Transform("saturday_button.png", zoom=.8) if [clock.weekday]=="Sunday": add Transform("sunday_button.png", zoom=.8)
Any help or suggestion would be appreciated.
Code: Select all
screen day_time_map:
zorder 103
if clock.time=="morning":
add Transform("morning.png", xpos=130, ypos=62)
if clock.time=="noon":
add Transform("noon.png", zoom=.8)
if clock.time=="afternoon":
add Transform("evening.png", zoom=.8)
if clock.time=="evening":
add Transform("evening.png", zoom=.8)
if clock.time=="night":
add Transform("night.png", zoom=.8)
screen week_day_map:
zorder 103
if clock.weekday=="Monday":
add Transform("monday_button.png", xpos=130, ypos=12)
if clock.weekday=="Tuesday":
add Transform("tuesday_button.png", zoom=.8)
if clock.weekday=="Wednesday":
add Transform("wednesday_button.png", zoom=.8)
if clock.weekday=="Thursday":
add Transform("thursday_button.png", zoom=.8)
if clock.weekday=="Friday":
add Transform("friday_button.png", zoom=.8)
if clock.weekday=="Saturday":
add Transform("saturday_button.png", zoom=.8)
if clock.weekday=="Sunday":
add Transform("sunday_button.png", zoom=.8)
Who is online
Users browsing this forum: Google [Bot]