Make options in menu unelectable/grayed out?
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.
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.
Make options in menu unelectable/grayed out?
I was wondering if there's a way to make menu options unclickable, but still appear/be visible? Help is appreciated, thanks in advance
Re: Make options in menu unelectable/grayed out?
I have seen this question pop up a few times and have had a similar interest in having more control over a menu so I started working on some code. I posted a basic version in the Cookbook section that may or may not be helpful -> http://lemmasoft.renai.us/forums/viewto ... 51&t=25460
-
- Regular
- Posts: 25
- Joined: Thu Feb 13, 2014 9:45 am
- Contact:
Re: Make options in menu unelectable/grayed out?
I already did something similar in another topic. I believe the same approach can help make this work, too:
Open your project's screens.rpy file and replace the part which starts with "screen choice" and ends right before "init -2 python" with the code above.
Then, when you want to show an unclickable option, just add " (disabled)" in its text like this:
Code: Select all
screen choice:
window:
style "menu_window"
xalign 0.5
yalign 0.5
vbox:
style "menu"
spacing 2
for caption, action, chosen in items:
if action:
if " (disabled)" in caption:
$ caption = caption.replace(" (disabled)", "")
button:
action None
style "menu_choice_button"
text caption style "menu_choice"
else:
button:
action action
style "menu_choice_button"
text caption style "menu_choice"
else:
text caption style "menu_caption"
Then, when you want to show an unclickable option, just add " (disabled)" in its text like this:
Code: Select all
menu:
"Choice 1": # This is a normal choice
# Stuff resulting from Choice 1
"Choice 2 (disabled)": # This will be unclickable and appear as "Choice 2"
pass # The contents of this block won't actually be used
Re: Make options in menu unelectable/grayed out?
Hello guys.
I am sorry about the stupid question. Is this method is still work? Whatever I do, it doesn't work for me. I've tried many variations of this method, but the choice is still selecteble.
Maybe I make something wrong. Off course I can use
define config.menu_include_disabled = True
But I don't need it for all choises with variables.
I just change code in screen choice:
and add " (disabled)" in choises
But nothing heppen, choise still selecteble.
I am sorry about the stupid question. Is this method is still work? Whatever I do, it doesn't work for me. I've tried many variations of this method, but the choice is still selecteble.
Maybe I make something wrong. Off course I can use
define config.menu_include_disabled = True
But I don't need it for all choises with variables.
I just change code in screen choice:
Code: Select all
screen choice:
window:
style "menu_window"
xalign 0.5
yalign 0.5
vbox:
style "menu"
spacing 2
for caption, action, chosen in items:
if action:
if " (disabled)" in caption:
$ caption = caption.replace(" (disabled)", "")
button:
action None
style "menu_choice_button"
text caption style "menu_choice"
else:
button:
action action
style "menu_choice_button"
text caption style "menu_choice"
else:
text caption style "menu_caption"
Code: Select all
hm "It's evening, what would I do?"
menu:
"Watch TV - not available in the current version (disabled)":
pass
"Go to bed early":
hm "I'm so tired, I'd better go to bed."
stop music fadeout 1.0
scene i34 with dissolve
pause
return
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Make options in menu unelectable/grayed out?
The current way of doing things is to use conditionals on the choices and set config.menu_include_disabled to True
Code: Select all
define config.menu_include_disabled = True
default allow_choice = False
label start:
"It's evening, what would I do?"
menu:
"Watch TV - not available in the current version" if allow_choice:
pass
"Go to bed early":
"I'm so tired, I'd better go to bed."
return
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: Make options in menu unelectable/grayed out?
Thanks to the66, I found the problem, why not work for me. I used his code.
Code: Select all
screen choice(items):
style_prefix "choice"
vbox:
for i in items:
$ disabled = i.kwargs.get("disabled", False)
textbutton i.caption action i.action sensitive not disabled
menu:
"Option 1":
"bla"
"Option 2" (disabled=True):
"bla"
-
- Newbie
- Posts: 12
- Joined: Tue Jun 16, 2020 11:56 am
- Contact:
Re: Make options in menu unelectable/grayed out?
Can you please show an example of where and how to change the value of allow_choice for one option, then reset it for the others? I tried to do it after the first quote choice (where you currently have "if allow choice") but it's not working.Remix wrote: ↑Thu Mar 19, 2020 9:07 pm The current way of doing things is to use conditionals on the choices and set config.menu_include_disabled to True
Code: Select all
define config.menu_include_disabled = True default allow_choice = False label start: "It's evening, what would I do?" menu: "Watch TV - not available in the current version" if allow_choice: pass "Go to bed early": "I'm so tired, I'd better go to bed." return
Also, how would we swap in a "disabled button" graphic for disabled choices?
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], decocloud