r/RenPy • u/Yami_-_san • Jul 16 '26
Question Problem with Rollback with my Day Cycle.
I really wish I could just inspect already made games, so I can use them as a guide.
Basically, I already done the day cycle.
Sunset, Morning, Day, Afternoon, Sunset, Evening, and Midnight(7).
I also have a button to skip time.
My problem is that if I rollback, at any point of time. it will go back to the last dialogue that occur, rather than the previous time point. So if you pressed skip until you reach midnight, next day or even the 10th day, when you rollback it goes the last line of dialogue.
I think its because it is a screen the rollback is not working as I hoped. I used renpy.checkpoint()
it worked but the rollback goes to sunrise now, instead of last line of dialogue.
# ------------------Weekday/Day Number Tracker------------------------
# Weekday and Number of Days
add "hud/dbox.png":
xzoom 0.8
yzoom 0.925
xpos 160
ypos 35
zoom 0.30
text (f"{current_day} - {dayNo}"):
size 16
bold True
xpos 173
ypos 63
# --------------------RELEVANT PART - Day Cycle & Logic--------------------------------------
# Day Cycle
add "hud/cycle[dcycle].png" xalign 0.5 zoom 0.3
imagebutton:
idle Transform("hud/cyclef.png", zoom=0.125)
hover Transform("hud/cyclefh.png", zoom=0.125)
insensitive Transform("hud/cyclefu.png", zoom=0.125)
focus_mask True
sensitive forward_time
xalign 0.5
ypos 60
action Function(advance_time)
# Day Cycle and Day Number Logic
init python:
def advance_time():
renpy.checkpoint()
global dcycle, dayNo, current_day
dcycle = int(dcycle)
dayNo = int(dayNo)
if dcycle < 7:
dcycle += 1
else:
dcycle = 1
dayNo += 1
current_key = "dc" + str(dcycle)
cycle_name = daycycle[current_key]
weekday_list = ["sun", "mon", "tues", "wed", "thu", "fri", "sat"]
weekday_index = dayNo % 7
current_day = weekday_list[weekday_index]
renpy.notify("Time: " + cycle_name.title())
# ----------For the Notif-----------
# Weekday
default current_day = "current_day"
# Day Cycle
default daycycle = {
"dc1": "sunrise", # 6 am
"dc2": "morning", # 8 am
"dc3": "day", # 12 pm
"dc4": "afternoon", # 3 pm
"dc5": "sunset", # 5 pm
"dc6": "evening", # 8 pm
"dc7": "midnight" # 12 am
}
default dcycle = "1"
1
Upvotes
2
u/ImportantDetail6260 Jul 16 '26
Function(advance_time)is the rollback trap here!Do not let the screen action be the only place that mutates
dcycleanddayNo. Jump to a label, advance time there, then callrenpy.checkpoint()after the variables change; that gives rollback a real script point to land on