Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- screen choice(items, background=None):
- style_prefix "choice"
- if background != None:
- # This adds a specific background image behind the choices.
- # By default, there will be no background unless you pass a menu argument.
- # 'background' must be a string matching an image filename (in game/images), OR the name of an image you defined elsewhere in your Ren'Py project.
- add "[background]" xalign 0.5 ypos 405 yanchor 0.5 # Positioning matches the default "choice_vbox", feel free to change.
- vbox:
- $ visible_items = [i for i in items if i.kwargs.get("condition", True)]
- for i in visible_items:
- $ color = i.kwargs.get("color", None)
- $ hover = i.kwargs.get("hover", None)
- $ tooltip_text = i.kwargs.get("tooltip_text", None)
- $ disabled_tooltip_text = i.kwargs.get("disabled_tooltip_text", None) # NEW: Display a different tooltip message for disabled choices.
- textbutton i.caption:
- # If the choice button is clickable and not disabled, apply custom colors and give it the regular action to progress through the choice menu.
- if i.kwargs.get("sensitive", True):
- if color != None:
- text_color color
- if hover != None:
- text_hover_color hover
- action i.action
- # If you supplied a tooltip_text kwarg for a particular choice option, display the tooltip.
- if tooltip_text != None:
- tooltip tooltip_text
- alt i.caption + " " + tooltip_text # Self-voicing, if enabled, should state the choice option text and then the tooltip text
- # If the choice button is disabled, style it as such and make it do nothing when clicked.
- else:
- # Scroll down to edit these styles.
- style "disabled_choice_button"
- text_style "disabled_choice_button_text"
- action NullAction()
- # If you supplied a disabled_tooltip_text kwarg for a particular choice option, display the tooltip.
- if disabled_tooltip_text != None:
- tooltip disabled_tooltip_text
- alt i.caption + " " + disabled_tooltip_text
- $ tooltip = GetTooltip()
- if tooltip:
- nearrect:
- focus "tooltip"
- prefer_top True
- alt "" # This will prevent the tooltip from being repeated when you're no longer hovering it, since that's being automatically handled above
- frame: # Feel free to customize the appearance of this tooltip.
- xalign 1.0
- background "#0008"
- xmaximum 500
- text tooltip size 20 color "#fff"
Advertisement
Add Comment
Please, Sign In to add comment