HELP! Problem with simple day/day time problem

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
LongHairRkr
Newbie
Posts: 9
Joined: Fri Aug 02, 2019 1:53 am
Projects: the Neighborhood
Contact:

HELP! Problem with simple day/day time problem

#1 Post by LongHairRkr »

I'm making a simple label to make the days go in a circle and then jump back to morning. But the issue I'm having is that it will display my worldmap and cellphone icons, but it stops recognizing what day it is and displaying my day and navigation screens when the week turns back to Sunday, anyone have a solution I can try?

Thanks in advance!

Here's the code I'm dealing with ...

screen money_display: #My daily titles and dtime Icons (These work until it becomes Sunday again)

$ day_number = (day%7)
$ day_name_values = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
$ dayn = day_name_values[day_number]

$ dtime_number = (dtime%6)
$ dtime_name_values = ("Early morning", "Morning", "Afternoon", "Evening", "Night", "Late night")
$ dtimen = dtime_name_values[dtime_number]
vbox:
xalign .01 #change this value between 0 and 1 if you want to move it to a different part of the screen horizontally
yalign .01 #change this value if you want to move it to a different part of the screen vertically
hbox:
if day == 6:
if dtime == 5:
image "maps/day6.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenight.png"
if dtime == 4:
image "maps/day6.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/night.png"
image "maps/latenightdark.png"
if dtime == 3:
image "maps/day6.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/evening.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 2:
image "maps/day6.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoon.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 1:
image "maps/day6.png"
image "maps/earlymorningdark.png"
image "maps/morning.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 0:
image "maps/day6.png"
image "maps/earlymorning.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if day == 5:
if dtime == 5:
image "maps/day5.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenight.png"
if dtime == 4:
image "maps/day5.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/night.png"
image "maps/latenightdark.png"
if dtime == 3:
image "maps/day5.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/evening.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 2:
image "maps/day5.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoon.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 1:
image "maps/day5.png"
image "maps/earlymorningdark.png"
image "maps/morning.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 0:
image "maps/day5.png"
image "maps/earlymorning.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if day == 4:
if dtime == 5:
image "maps/day4.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenight.png"
if dtime == 4:
image "maps/day4.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/night.png"
image "maps/latenightdark.png"
if dtime == 3:
image "maps/day4.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/evening.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 2:
image "maps/day4.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoon.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 1:
image "maps/day4.png"
image "maps/earlymorningdark.png"
image "maps/morning.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 0:
image "maps/day4.png"
image "maps/earlymorning.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if day == 3:
if dtime == 5:
image "maps/day3.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenight.png"
if dtime == 4:
image "maps/day3.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/night.png"
image "maps/latenightdark.png"
if dtime == 3:
image "maps/day3.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/evening.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 2:
image "maps/day3.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoon.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 1:
image "maps/day3.png"
image "maps/earlymorningdark.png"
image "maps/morning.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 0:
image "maps/day3.png"
image "maps/earlymorning.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if day == 2:
if dtime == 5:
image "maps/day2.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenight.png"
if dtime == 4:
image "maps/day2.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/night.png"
image "maps/latenightdark.png"
if dtime == 3:
image "maps/day2.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/evening.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 2:
image "maps/day2.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoon.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 1:
image "maps/day2.png"
image "maps/earlymorningdark.png"
image "maps/morning.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 0:
image "maps/day2.png"
image "maps/earlymorning.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if day == 1:
if dtime == 5:
image "maps/day1.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenight.png"
if dtime == 4:
image "maps/day1.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/night.png"
image "maps/latenightdark.png"
if dtime == 3:
image "maps/day1.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/evening.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 2:
image "maps/day1.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoon.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 1:
image "maps/day1.png"
image "maps/earlymorningdark.png"
image "maps/morning.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 0:
image "maps/day1.png"
image "maps/earlymorning.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if day == 0:
if dtime == 5:
image "maps/day0.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenight.png"
if dtime == 4:
image "maps/day0.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/night.png"
image "maps/latenightdark.png"
if dtime == 3:
image "maps/day0.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/evening.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 2:
image "maps/day0.png"
image "maps/earlymorningdark.png"
image "maps/morningdark.png"
image "maps/afternoon.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 1:
image "maps/day0.png"
image "maps/earlymorningdark.png"
image "maps/morning.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"
if dtime == 0:
image "maps/day0.png"
image "maps/earlymorning.png"
image "maps/morningdark.png"
image "maps/afternoondark.png"
image "maps/eveningdark.png"
image "maps/nightdark.png"
image "maps/latenightdark.png"

label daystart: #masterbedroom events (This button also won't display when it comes back to Sunday)
scene bg black
if dtime == 5:
scene bg masterbednosheetdark
call screen masterbedroomln
pause
elif dtime == 4:
if day == 3:
scene bg masterbedroomlit
call screen masterbedroomn
pause
else:
scene bg masterbedroomdark
call screen masterbedroomn
pause
elif dtime == 3:
scene bg masterbedroomday
call screen masterbedroome
pause
elif dtime == 2:
scene bg masterbedroomday
call screen masterbedrooma
pause
elif dtime == 1:
scene bg masterbedroomday
call screen masterbedroomm
pause
else:
scene bg masterbednosheetdim
call screen masterbedroomem
pause

label sleep: #My menu to move the days from one to the next (Seems to work fine)
if firsttrip:
jump daystart
if dtime == 5:
show image "maps/peaseyhouse/bg pillows.png"
"Would you like to go to sleep?"
menu:
"Yes.":
hide image "maps/peaseyhouse/bg pillows.png"
jump dreamtime
"No.":
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
if dtime == 4:
show image "maps/peaseyhouse/bg pillows.png"
"Would you like to go to sleep?"
menu:
"1 hour":
$ dtime += 1
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"Yes.":
hide image "maps/peaseyhouse/bg pillows.png"
jump dreamtime
"No.":
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
if dtime == 3:
show image "maps/peaseyhouse/bg pillows.png"
"Would you like to take a nap?"
menu:
"Yes.":
"For how long?"
menu:
"1 hour":
$ dtime += 1
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"2 hours":
$ dtime += 2
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"all night":
hide image "maps/peaseyhouse/bg pillows.png"
jump dreamtime
"No.":
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
if dtime == 2:
show image "maps/peaseyhouse/bg pillows.png"
"Would you like to take a nap?"
menu:
"Yes.":
"For how long?"
menu:
"1 hour":
$ dtime += 1
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"2 hours":
$ dtime += 2
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"3 hours":
$ dtime += 3
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"all night":
hide image "maps/peaseyhouse/bg pillows.png"
jump dreamtime
"No.":
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
if dtime == 1:
show image "maps/peaseyhouse/bg pillows.png"
"Would you like to go back to sleep?"
menu:
"Yes.":
"For how long?"
menu:
"1 hour":
$ dtime += 1
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"2 hours":
$ dtime += 2
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"3 hours":
$ dtime += 3
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"4 hours":
$ dtime += 4
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"all day":
hide image "maps/peaseyhouse/bg pillows.png"
jump dreamtime
"No.":
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
else:
show image "maps/peaseyhouse/bg pillows.png"
"Would you like to go back to sleep?"
menu:
"Yes.":
"For how long?"
menu:
"1 hour":
$ dtime =+ 1
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"2 hours":
$ dtime += 2
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"3 hours":
$ dtime += 3
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"4 hours":
$ dtime += 4
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"5 hours":
$ dtime += 5
$ renpy.retain_after_load()
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart
"all day":
hide image "maps/peaseyhouse/bg pillows.png"
jump dreamtime
"No.":
hide image "maps/peaseyhouse/bg pillows.png"
jump daystart

(Last label doesn't seem to be using the if day >= 7: $ day == 0 command correctly. Weirdly it worked before and just stopped working for me.)
label dreamtime: #My day passage screen to transition from one day to the next and reset my targets and such doesn't seem to be doing the day passage correctly
if day >= 7:
$ day == 0
jump dreamtime
scene bg black
show karenmissionarybedroom2 with fade
"You are dreaming right now."
pause
hide karenmissionarybedroom2 with fade
$ firsttrip = False
$ dtime = 0
$ day += 1
$ renpy.retain_after_load()
if day == 6:
show image "backgrounds/Day6.png" with fade
pause
hide image "backgrounds/Day6.png" with fade
jump daystart
if day == 5:
show image "backgrounds/Day5.png" with fade
pause
if pay == 20:
$ money += 1000
if pay == 19:
$ money += 950
if pay == 18:
$ money += 900
if pay == 17:
$ money += 850
if pay == 16:
$ money += 800
if pay == 15:
$ money += 750
if pay == 14:
$ money += 700
if pay == 13:
$ money += 650
if pay == 12:
$ money += 600
if pay == 11:
$ money += 550
if pay == 10:
$ money += 500
if pay == 9:
$ money += 450
if pay == 8:
$ money += 400
if pay == 7:
$ money += 350
if pay == 6:
$ money += 300
if pay == 5:
$ money += 250
if pay == 4:
$ money += 200
if pay == 3:
$ money += 150
if pay == 2:
$ money += 100
if pay == 1:
$ money += 50
$ pay == 0
hide image "backgrounds/Day5.png" with fade
jump daystart
if day == 4:
show image "backgrounds/Day4.png" with fade
pause
hide image "backgrounds/Day4.png" with fade
jump daystart
if day == 3:
show image "backgrounds/Day3.png" with fade
pause
hide image "backgrounds/Day3.png" with fade
jump daystart
if day == 2:
show image "backgrounds/Day2.png" with fade
pause
hide image "backgrounds/Day2.png" with fade
jump daystart
if day == 1:
show image "backgrounds/Day1.png" with fade
pause
hide image "backgrounds/Day1.png" with fade
jump daystart
if day == 0:
show image "backgrounds/Day0.png" with fade
pause
hide image "backgrounds/Day0.png" with fade
jump daystart

I'm sure I'm missing something simple or over complicating something. Thanks for any help you can give

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: HELP! Problem with simple day/day time problem

#2 Post by Alex »

LongHairRkr wrote: Sun Apr 11, 2021 1:21 pm ... but it stops recognizing what day it is and displaying my day and navigation screens when the week turns back to Sunday, ...
In your screen you check the 'day' variable, but it can be greater than 7 I suppose... Try to check 'day_number' instead.

LongHairRkr
Newbie
Posts: 9
Joined: Fri Aug 02, 2019 1:53 am
Projects: the Neighborhood
Contact:

Re: HELP! Problem with simple day/day time problem

#3 Post by LongHairRkr »

Yeah, in the script my $ day variable should be 0 to 6 and then if it hits 7 it goes back to zero. The weird part is that the background is the correct one for the scene, but the screens themselves don't display when they have to have a day or dtime variable after the first week. You'd think it would work the second time the same as it worked perfectly on the first time through, but it won't.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]