Stopping all Buttons being Selected

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
PetPeeve
Regular
Posts: 70
Joined: Tue Nov 06, 2012 10:40 am
Tumblr: agamemakingblogforcoolkids
Contact:

Stopping all Buttons being Selected

#1 Post by PetPeeve »

Hi there,

I'm working on my profile screen, which has categories, then individuals.

As it is now when you go to the screen all the categories are showing their selected state.

Here is the code I'm using:

Code: Select all

screen profiles:
    default humans = False
    default angels = False
    default demons = False
    default other = False
        
    tag exmenu
    add "UI/MM/BGN.png"
    text "Profiles":
        style_group "subsubtitle"
        
    frame:
        style_group "prof"
        hbox:
            vbox:
                textbutton _("Humans"):
                    action [SetScreenVariable("humans", True), SetScreenVariable("angels", False), SetScreenVariable("demons", False), SetScreenVariable("other", False)]
                textbutton _("Angels"):
                    action [SetScreenVariable("angels", True), SetScreenVariable("humans", False), SetScreenVariable("demons", False), SetScreenVariable("other", False)]
                textbutton _("Demons"):
                    action [SetScreenVariable("demons", True), SetScreenVariable("humans", False), SetScreenVariable("angels", False), SetScreenVariable("other", False)]
                textbutton _("Other"):
                    action [SetScreenVariable("other", True), SetScreenVariable("humans", False), SetScreenVariable("angels", False), SetScreenVariable("demons", False)]
                
    if humans:
        text "Humans"
    elif angels:
        text "Angels"
    elif demons:
        text "Demons"
    elif other:
        text "Other"
It's definitely something to do with the way I'm showing variables, but I can't figure out what it is for the life of me.
Avatar by shiohh
ImageImageImageImage

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Stopping all Buttons being Selected

#2 Post by Alex »

Instead of 4 variables try to make just one and give it values like "humans", "demons", "angels", "others".
Also, see - viewtopic.php?f=8&t=26492#p322596

User avatar
PetPeeve
Regular
Posts: 70
Joined: Tue Nov 06, 2012 10:40 am
Tumblr: agamemakingblogforcoolkids
Contact:

Re: Stopping all Buttons being Selected

#3 Post by PetPeeve »

Ah, I see! Thanks a lot =)
Avatar by shiohh
ImageImageImageImage

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]