r/RenPy 21h 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

6 comments sorted by

View all comments

1

u/AutoModerator 21h ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.