How to use multiple choice boxes?

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
MiraiZura
Regular
Posts: 33
Joined: Sat Sep 15, 2018 8:06 pm
Projects: How stories die.
Contact:

How to use multiple choice boxes?

#1 Post by MiraiZura »

Hello, I have a multiple choice boxes, one for each choice. For example the first one is green the second one is red and the third one is blue. Currently I know how to replace the choice boxes with only one kind of choice box and so all the boxes will be in the exact same color(for example green). How do I use multiple versions of choice boxes?(so that each choice will be in a different color)

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

Re: How to use multiple choice boxes?

#2 Post by Alex »

You need to modify the choice screen. For example, you can set background image for the choice button, like

Code: Select all

image red:
    Solid("#c00")
image blue:
    Solid("#00c")

define bg_colors = ["red", "blue"]*5 #there would be a list of 10 elements (must correspond with the maximum possible amount of choices in a menu)

screen choice(items):
    style_prefix "choice"

    vbox:
        for ind, i in enumerate(items):
            textbutton i.caption action i.action background bg_colors[ind]

User avatar
MiraiZura
Regular
Posts: 33
Joined: Sat Sep 15, 2018 8:06 pm
Projects: How stories die.
Contact:

Re: How to use multiple choice boxes?

#3 Post by MiraiZura »

Ok, thank you very much.

Post Reply

Who is online

Users browsing this forum: Google [Bot]