I have a problem where I'm calling a screen to display variables and buttons, and long story short: I click a button to move to a new location, and my time advances 120 minutes (the combined total of all my time updates for my buttons). It would appear that, when I jump to new location and make my screen calls, it displays my time properly, but on the call, the action of my text buttons all gets performed.
How do I correct this/prevent this from happening? Why would the actions from my buttons be getting done without clicking them?
I expect to click the text button, have timeofday increase by that much time via the clock(amount) function. I'd also love the screens to refresh on clicking that, but that'll be my follow-up (couldn't figure out how to get renpy.restart_interaction() to work).
Code: Select all
init 2 python:
###########################
# Routines #
###########################
def clock(amount):
global timeofday
global day
global daydisplay
global dayname
timeofday = timeofday + int(amount)
if timeofday > 1440:
timeofday = timeofday - 1440
day = day + 1
daydisplay = dayname [((day-1)%7)]
return
elif timeofday < 0:
timeofday = 0
return
else:
timeofday = timeofday
return
screen headsupdisplay:
zorder -1
$clockhour = int(timeofday/60)
$clockmin = timeofday - (clockhour * 60)
$money_k = int(money)
add "genuitop"
vbox xpos 1700 ypos 10:
hbox xpos 40 ypos 10:
if clockhour < 10:
text "{=clock_text}0[clockhour]"
else:
text "{=clock_text}[clockhour]"
if clockmin < 10:
text "{=clock_text}:0[clockmin]"
else:
text "{=clock_text}:[clockmin]"
hbox xpos 40 spacing 5:
vbox:
textbutton "{=clock_button_text}5" action clock(5)
vbox:
textbutton "{=clock_button_text}10" action clock(10)
vbox:
textbutton "{=clock_button_text}15" action clock(15)
vbox:
textbutton "{=clock_button_text}30" action clock(30)
vbox:
textbutton "{=clock_button_text}60" action clock(60)
vbox xalign .5 ypos 10:
text "{=stats_text}[daydisplay], Day [day]"
vbox xalign .5 ypos 50:
text "{=stats_text}[location]"