ConditionSwitch not switching in screen instance

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
User avatar
Zeekee
Regular
Posts: 61
Joined: Wed Jul 23, 2014 10:17 pm
Projects: No One But You, The Anomaly
Organization: Annexe Interactive
Skype: ytmnd111
Soundcloud: zomgaarh
Location: USAF Academy, CO
Contact:

ConditionSwitch not switching in screen instance

#1 Post by Zeekee » Sun Oct 14, 2018 2:14 pm

Hey all,

I've been working on this issue for a while now and have spent a number of hours pouring through the forums with no success.

Anyway, the issue I've been having relates to ConditionSwitch. I defined a variable that was supposed to switch between backgrounds based on minigame progress. Though one of the backgrounds will appear when the minigame first starts, the background (which is designed to change when a variable is set to True) will not change at all, even when the variable is set to true.

Ideally, I'd like to set the background for this screen based in the variable using an if/else conditional, but it seems as though that won't work. Would there be a way to change the background manually from within my screen? If so, how would I go about that?

Thanks a bunch! Here's my code for reference:

Code: Select all

define mgbg = ConditionSwitch(
            "game_success == 'True'", "GUI/minigame/COMPLETE.png",
            "True", "GUI/minigame/PROGRESS.png"
        )

Code: Select all

screen ifprompt(buffer, prompt, interact=True):
    
    modal True
    
    window:
        align (0.5, 0.5) 
        xfill True 
        yfill True 
        xpadding 24 
        ypadding 164 
        background mgbg
Then when I call the screen in-game:

Code: Select all

call screen ifprompt(buffer, prompt, interact=True)
"When people sometimes misquote me, I don't know if they understand what I'm saying."
-Tommy Wiseau

User avatar
Zeekee
Regular
Posts: 61
Joined: Wed Jul 23, 2014 10:17 pm
Projects: No One But You, The Anomaly
Organization: Annexe Interactive
Skype: ytmnd111
Soundcloud: zomgaarh
Location: USAF Academy, CO
Contact:

Re: ConditionSwitch not switching in screen instance

#2 Post by Zeekee » Sun Oct 14, 2018 4:47 pm

Fixed it, and boy do I feel like an idiot.

Just changed:

Code: Select all

game_success == 'True'
to:

Code: Select all

game_success == True
Wow, I'm ashamed for not catching this sooner :oops:
"When people sometimes misquote me, I don't know if they understand what I'm saying."
-Tommy Wiseau

Post Reply

Who is online

Users browsing this forum: Google [Bot]