Page 1 of 1

ConditionSwitch not switching in screen instance

Posted: Sun Oct 14, 2018 2:14 pm
by Zeekee
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)

Re: ConditionSwitch not switching in screen instance

Posted: Sun Oct 14, 2018 4:47 pm
by Zeekee
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: