Set button selected automatically

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
sashaaero
Regular
Posts: 45
Joined: Mon Jul 13, 2015 6:08 pm
Projects: Everlasting Cold
Organization: OverDream Development
Github: sashaaero
Skype: sashaaero
Contact:

Set button selected automatically

#1 Post by sashaaero »

Hi, everyone.
This question can be pathetic :(
But how can I automatically set the button as "selected"?

User avatar
Steamgirl
Veteran
Posts: 322
Joined: Sat Jul 28, 2012 4:39 am
Completed: My Cup of Coffee, Queen at Arms (co-wrote a battle scene)
Projects: Stranded Hearts, Emma: A Lady's Maid
Deviantart: steamgirlgame
Contact:

Re: Set button selected automatically

#2 Post by Steamgirl »

Do you mean by default? If your button has an action associated with it, such as setting a variable, it will automatically be "selected" if the variable is set to the same number as the button sets it to.

User avatar
sashaaero
Regular
Posts: 45
Joined: Mon Jul 13, 2015 6:08 pm
Projects: Everlasting Cold
Organization: OverDream Development
Github: sashaaero
Skype: sashaaero
Contact:

Re: Set button selected automatically

#3 Post by sashaaero »

Steamgirl wrote:Do you mean by default? If your button has an action associated with it, such as setting a variable, it will automatically be "selected" if the variable is set to the same number as the button sets it to.
You mean like

Code: Select all

textbutton "some name" action SetVariable("...", 12345)
?

User avatar
Steamgirl
Veteran
Posts: 322
Joined: Sat Jul 28, 2012 4:39 am
Completed: My Cup of Coffee, Queen at Arms (co-wrote a battle scene)
Projects: Stranded Hearts, Emma: A Lady's Maid
Deviantart: steamgirlgame
Contact:

Re: Set button selected automatically

#4 Post by Steamgirl »

Sort of. First you set the variable.

Code: Select all

$ variable = 12345
Now the button which has the same value will be selected by default.

Code: Select all

textbutton "Selected" action SetVariable("variable", 12345)
textbutton "Not selected" action SetVariable("variable", 98765)

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], Rhapsy