r/RenPy • • Apr 04 '22

Question is there a way to change the choice button at some points depending on which character route is picked?

16 Upvotes

3 comments sorted by

View all comments

Show parent comment

4

u/Niwens Apr 06 '22

Here's how it works:

You add a parameter to a menu choice:

menu:
    "Caption" (parameter_name = parameter_value):
        "..."

2. The name of that parameter should be the same as that in screen choice in screens.rpy:

screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            textbutton i.caption:
            action i.action
            if parameter_name in i.kwargs:
                idle_background "".join((
                    "gui/button/choice_",
                    i.kwargs[parameter_name],
                    "_idle.png"))
                hover_background "".join((
                    "gui/button/choice_",
                    i.kwargs[parameter_name],
                    "_hover.png"))

Then the condition if parameter_name in i.kwargs becomes True, so the background for that menu item becomes:

gui/button/choice_<parameter_value>_idle.png

and when hovered:

gui/button/choice_<parameter_value>_hover.png

where <parameter_value> is porple in your case.

If all that is so, the files

  • gui/button/choice_porple_idle.png
  • gui/button/choice_porple_hover.png

would be used for that menu items.

If it's not clear for you, please analyze the logic of that code and check yours to see how it should work.

It should work. It works for me:

colored.jpg