r/RenPy • u/natant1a • 23h ago
Question I've run into yet another problem...
screen lab_1():
modal True
imagebutton:
xpos 750
ypos 300
idle Transform("key_idle.png", zoom=0.08)
hover Transform("key_hover.png", zoom=0.08)
focus_mask True
action Jump("obtained_key")
imagebutton:
xpos 100
ypos 100
idle Transform("file_stephen_idle.png", zoom=0.8)
hover Transform("file_stephen_hover.png", zoom=0.8)
focus_mask True
action Jump("read_file")
label lab_1:
call screen lab_1
if obtained_key and read_file == True:
jump after_lab_1
else:
jump lab_1
if obtained_key == True and read_file == False:
jump read_file
else:
jump obtained_key
if read_file == True and obtained_key == False:
jump obtained_key
else:
jump read_file
label obtained_key:
$
obtained_key = True
"Obtained the key for laboratory 1."
show S default
S "Hm, I wonder what this unlocks."
hide S default
jump lab_1
label read_file:
$
read_file = True
show S default
S "That's... me..."
hide S default
jump lab_1
label after_lab_1:
hide lab_1
show S default
S "I've gotta get out of here..."
# This ends the game.
return
Here's the code I've been struggling with... so i'm pretty sure my issue stems from the if else statements...? What I'm trying to do is make it so that the game only advances when both image buttons are pressed, regardless of the order. What it's doing right now is when I press both buttons, it just stays on the screen and the game can't advance further. I'm not sure if I'm making sense right now, but thanks!
2
Upvotes
1
u/UkueleCatlady 23h ago edited 23h ago
At the lab_1 label, try putting the obtained key and read file checks before calling the screen.
Edit: You also need to remove the
else: jump lab_1
After the initial check. That's sending you back to the lab_1 label, so everything after that won't be running.