Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Choice Kwargs Self-Voicing Fix - Pastebin.com
[go: Go Back, main page]

aurawave

Choice Kwargs Self-Voicing Fix

May 5th, 2026 (edited)
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. screen choice(items, background=None):
  2. style_prefix "choice"
  3.  
  4. if background != None:
  5. # This adds a specific background image behind the choices.
  6. # By default, there will be no background unless you pass a menu argument.
  7. # '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.
  8. add "[background]" xalign 0.5 ypos 405 yanchor 0.5 # Positioning matches the default "choice_vbox", feel free to change.
  9.  
  10. vbox:
  11. $ visible_items = [i for i in items if i.kwargs.get("condition", True)]
  12. for i in visible_items:
  13. $ color = i.kwargs.get("color", None)
  14. $ hover = i.kwargs.get("hover", None)
  15. $ tooltip_text = i.kwargs.get("tooltip_text", None)
  16. $ disabled_tooltip_text = i.kwargs.get("disabled_tooltip_text", None) # NEW: Display a different tooltip message for disabled choices.
  17.  
  18. textbutton i.caption:
  19. # If the choice button is clickable and not disabled, apply custom colors and give it the regular action to progress through the choice menu.
  20. if i.kwargs.get("sensitive", True):
  21. if color != None:
  22. text_color color
  23. if hover != None:
  24. text_hover_color hover
  25. action i.action
  26. # If you supplied a tooltip_text kwarg for a particular choice option, display the tooltip.
  27. if tooltip_text != None:
  28. tooltip tooltip_text
  29. alt i.caption + " " + tooltip_text # Self-voicing, if enabled, should state the choice option text and then the tooltip text
  30.  
  31. # If the choice button is disabled, style it as such and make it do nothing when clicked.
  32. else:
  33. # Scroll down to edit these styles.
  34. style "disabled_choice_button"
  35. text_style "disabled_choice_button_text"
  36. action NullAction()
  37. # If you supplied a disabled_tooltip_text kwarg for a particular choice option, display the tooltip.
  38. if disabled_tooltip_text != None:
  39. tooltip disabled_tooltip_text
  40. alt i.caption + " " + disabled_tooltip_text
  41.  
  42. $ tooltip = GetTooltip()
  43.  
  44. if tooltip:
  45. nearrect:
  46. focus "tooltip"
  47. prefer_top True
  48. alt "" # This will prevent the tooltip from being repeated when you're no longer hovering it, since that's being automatically handled above
  49.  
  50. frame: # Feel free to customize the appearance of this tooltip.
  51. xalign 1.0
  52. background "#0008"
  53. xmaximum 500
  54. text tooltip size 20 color "#fff"
Advertisement
Add Comment
Please, Sign In to add comment