This is kind of a hack and it's definitely a monkeypatch, but in combination with the stuff in the link in the previous post, you can put this into an init python block and it'll automatically disable the choices without you having to put "(disabled)" in the text, and you won't have to double up the choices.
Code: Select all
init -1 python:
# we use display.get_info() because it persists between reloads so we don't end up with an endless loop
if getattr(renpy.display.get_info(), 'oldmenu', None) is None:
renpy.display.get_info().oldmenu = renpy.exports.menu
# append " (disabled)" to any choices that fail their conditions
# while also pretending that they've all succeeded and calling the built-in menu
def menu_override(items, set_expr):
items = [ (renpy.exports.substitute(label) + (" (disabled)" if not renpy.python.py_eval(condition) else ""), "True", value)
for label, condition, value in items ]
return renpy.display.get_info().oldmenu(items, set_expr)
# intercept the built-in menu
renpy.exports.menu = menu_override
And for the sake of completion, in screens.rpy, replace:
Code: Select all
screen choice(items):
style_prefix "choice"
vbox:
for i in items:
textbutton i.caption action i.action
with (edited from the other post, which was from a while ago):
Code: Select all
screen choice:
style_prefix "choice"
vbox:
for i in items:
if i.action:
if " (disabled)" in i.caption:
textbutton i.caption.replace(" (disabled)", "")
else:
textbutton i.caption action i.action
else:
textbutton i.caption
So now you can define your menu just like any other:
Code: Select all
menu:
"1":
"sdfjhsjfhsdjd"
"2":
"sdjfhjsdhfjhsjdhfs"
"3" if False: # this will be unclickable ingame
"sfdjhsjhfhjsdj"
You'll still need to style it to grey it out, but the mechanics of it are all there.