Disabling/Enabling Menu Items/Options
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.
Disabling/Enabling Menu Items/Options
Hi,
Me and my partner are attempting to make a game (obviously XD)
However, I am curious. How would one go about disabling options?
For example, let's say I completed Dark One and I return to the main menu. What I see now would be:
Dark 1
Dark 2
Now Dark 2 is available. How do I make it that while Dark 1 appears as an option, I cannot access it anymore (essentially disable it/grey out)? Please show examples of the code and make the explanation clear (even with details one would dismiss as casual knowledge in programming, as me and my partner are not computer programmers and are essentially newbies at this)?
Thank you
(Just a side note, this question was on my other thread, but I am uncertain of how this system works and whether people will see a reply to myself? > . <)
Me and my partner are attempting to make a game (obviously XD)
However, I am curious. How would one go about disabling options?
For example, let's say I completed Dark One and I return to the main menu. What I see now would be:
Dark 1
Dark 2
Now Dark 2 is available. How do I make it that while Dark 1 appears as an option, I cannot access it anymore (essentially disable it/grey out)? Please show examples of the code and make the explanation clear (even with details one would dismiss as casual knowledge in programming, as me and my partner are not computer programmers and are essentially newbies at this)?
Thank you
(Just a side note, this question was on my other thread, but I am uncertain of how this system works and whether people will see a reply to myself? > . <)
- PetPeeve
- Regular
- Posts: 70
- Joined: Tue Nov 06, 2012 10:40 am
- Tumblr: agamemakingblogforcoolkids
- Contact:
Re: Disabling/Enabling Menu Items/Options
Assuming you are using textbuttons (Although you can do something similar with imagemaps and imagebuttons) this goes in the screens.rpy on the menu you want it on.
Then at the end of Dark One make sure you have a persistent.
And of course label the two seperate starts so it goes to the right place.
Code: Select all
if not persistent.dark01:
textbutton _("Dark 1") action Start('dark01')
if persistent.dark01:
textbutton _("Dark 2") action Start('dark02')
Code: Select all
$ persistent.dark01 = True
Code: Select all
label dark01: #THIS IS THE IMPORTANT BIT
"This is dark one."
return
label dark02: #THIS IS THE IMPORTANT BIT
"This is not dark one"
return
Avatar by shiohh
Re: Disabling/Enabling Menu Items/Options
Sorry if I confused you, but I am not using text buttons at all XD I am in the script thing, which means that I have for example:
if persistent.LuluDark_2 == True:
menu:
"Dark 1":
jump DarkLulu1
"Dark 2":
jump DarkLulu2
The thing is I want to be able to disable DarkLulu1 (meaning you cannot access it anymore), as it is already completed. How would one go about doing that (please use examples of codes if you can)? Thanks
if persistent.LuluDark_2 == True:
menu:
"Dark 1":
jump DarkLulu1
"Dark 2":
jump DarkLulu2
The thing is I want to be able to disable DarkLulu1 (meaning you cannot access it anymore), as it is already completed. How would one go about doing that (please use examples of codes if you can)? Thanks
- PetPeeve
- Regular
- Posts: 70
- Joined: Tue Nov 06, 2012 10:40 am
- Tumblr: agamemakingblogforcoolkids
- Contact:
Re: Disabling/Enabling Menu Items/Options
Oh, that's even easier.
So if the DarkLulu1 event is complete the button will no longer come up this way...
I believe that to make the option stay there, and just be grey, you just need to define the insensitive style somewhere (probably best in the options screen).
Something like this
Edit: P.S. When you put code on the forum it is best to use the code style so you maintain your spaces
Code: Select all
menu:
"Dark 1" if not persistent.LuluDark_1:
jump DarkLulu1
"Dark 2":
jump DarkLulu2
I believe that to make the option stay there, and just be grey, you just need to define the insensitive style somewhere (probably best in the options screen).
Something like this
Code: Select all
style.menu_choice.insensitive_color = "#808080"
style.menu_choice_button.insensitive_color = "#ffffff"
Avatar by shiohh
Re: Disabling/Enabling Menu Items/Options
For some reason it isn't working? Could you possibly clarify? Maybe I did something wrong (I just copied what you did into the thing, probably I missed something> . <)?
Here is how the code looks like in script (without the parts you added) (we are just in a testing phase right now and this is not the final product):
Here is how the code looks like in script (without the parts you added) (we are just in a testing phase right now and this is not the final product):
Code: Select all
label start:
play music "Diabolik Lovers Anime Music.mp3"
scene Blood Moon Background
menu:
"Lulu Nohikari's Route":
jump LuluRoute
label LuluRoute:
scene Blood Moon Background
play music "Lulu's Theme Song.mp3"
if persistent.LuluDark_1 == True:
menu:
"Main Prologue":
jump LuluRoute
"Dark":
jump DarkLulu
if persistent.LuluDark_2 == True:
menu:
"Main Prologue":
jump LuluRoute
"Dark":
jump DarkLulu
else:
menu:
"Main Prologue":
jump MainProloguelulu
label MainProloguelulu:
scene Mansion Background
play music "Rain and Thunder Sound Effect.mp3"
$ persistent.LuluDark_1 = False
$Points = 0
$ Kside = Character(_('Lulu Nohikari'), color="#FFFFFF", window_left_padding=160, show_side_image=Image("LuluN.jpg", xalign=0.0, yalign=1.0), what_slow_cps=20, ctc= "ctc", ctc_position="fixed")
Kside "____I hear the rain;"
Kside "How nice."
menu:
"Apple":
$ Points += 5
$ persistent.LuluDark_1 = True
jump LuluRoute
"Oranges":
$ Points -= 5
$ persistent.LuluDark_1 = True
jump LuluRoute
label DarkLulu:
if persistent.LuluDark_1 == True:
menu:
"Dark 1":
jump Dark1Lulu
if persistent.LuluDark_2 == True:
menu:
"Dark 1":
jump DarkLulu
"Dark 2":
jump Dark2Lulu
label Dark1Lulu:
play music "Amanda - Aisha Duo.mp3"
scene Background
$ persistent.LuluDark_1 = True
$ persistent.LuluDark_2 = False
show Kanato Sakamaki
k "If you don't give me cake, Teddy will devour your soul!"
show Subaru Sakamaki at right
S "Tch, you hysteric. Why don't you get your own cake."
menu:
"Apple":
$ Points += 5
$ persistent.LuluDark_1 = False
$ persistent.LuluDark_2 = True
jump LuluRoute
"Oranges":
$ Points -= 5
$ persistent.LuluDark_1 = False
$ persistent.LuluDark_2 = True
jump LuluRoute
label Dark2Lulu:
play music "Amanda - Aisha Duo.mp3"
scene Background
show Kanato Sakamaki
$ persistent.LuluDark_2 = True
k "If you don't give me cake, Teddy will devour your soul!"
show Subaru Sakamaki at right
S "Tch, you hysteric. Get your own cake."
menu:
"Apple":
$ Points += 5
$ persistent.LuluDark_2 = False
jump Endings
"Oranges":
$ Points -= 5
$ persistent.LuluDark_2 = False
jump Endings
label Endings:
if Points >= 10:
"Best Ending"
return
if Points < 10:
"Worst Ending"
return
Last edited by Siri on Tue May 24, 2016 6:09 am, edited 1 time in total.
- PetPeeve
- Regular
- Posts: 70
- Joined: Tue Nov 06, 2012 10:40 am
- Tumblr: agamemakingblogforcoolkids
- Contact:
Re: Disabling/Enabling Menu Items/Options
Please put the code in between the code tags because I can't see your indents, which makes it difficult to fix.
Edit:
Is this the bit where you want the menu to be enabled/disabled?
Edit:
Is this the bit where you want the menu to be enabled/disabled?
Code: Select all
label DarkLulu:
if persistent.LuluDark_1 == True:
menu:
"Dark 1":
jump Dark1Lulu
if persistent.LuluDark_2 == True:
menu:
"Dark 1":
jump DarkLulu
"Dark 2":
jump Dark2Lulu
Avatar by shiohh
Re: Disabling/Enabling Menu Items/Options
Sorry cx I am a bit new here, but yes here would be where I want it to be (meaning I would like Dark 1 to now be disabled as it is completed):
Thank you so much
Code: Select all
if persistent.LuluDark_2 == True:
menu:
"Dark 1":
jump DarkLulu
"Dark 2":
jump Dark2Lulu
- PetPeeve
- Regular
- Posts: 70
- Joined: Tue Nov 06, 2012 10:40 am
- Tumblr: agamemakingblogforcoolkids
- Contact:
Re: Disabling/Enabling Menu Items/Options
Ok, so to simply remove the option, replace that with:
If you want the option to stay on the screen and be unclickable, it gets a little more complicated.
Instead, use
Then in screens.rpy find the bit of code that says
and replace it with
Hopefully I've made it easy enough for you to do it =) Also, it might be a good idea to clear your persistent from the Ren'py dashboard before you test it.
Code: Select all
label DarkLulu:
menu:
"Dark 1" if not persistent.LuluDark_1:
jump Dark1Lulu
"Dark 2" if persistent.LuluDark_1:
jump Dark2Lulu
Instead, use
Code: Select all
label DarkLulu:
menu:
"Dark 1" if not persistent.LuluDark_1:
jump Dark1Lulu
"Dark 2 (disabled)" if not persistent.LuluDark_1:
pass
"Dark 2" if persistent.LuluDark_1:
jump Dark2Lulu
Code: Select all
for caption, action, chosen in items:
if action:
button:
action action
style "menu_choice_button"
text caption style "menu_choice"
else:
text caption style "menu_caption"
Code: Select all
for caption, action, chosen in items:
if action:
if " (disabled)" in caption:
$ caption = caption.replace(" (disabled)", "") #This replaces the (disabled) in your menu so it doesn't come up
button:
action None # This means that even if you click the disabled button nothing will happen
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"
Avatar by shiohh
Re: Disabling/Enabling Menu Items/Options
It works Thank you so much for your help, I couldn't have done it without you.
Since you have been greatly helpful, perhaps you could help me with another matter?
Is there any way to make it so that the text box looks like the link (including the Speaker part as a permeant part of the text box (the name of the speaker itself changing with the general code))?
http://nicoblog.org/wp-content/uploads/ ... 42ef_o.jpg
Also, could we get the menu screen to look something like this (doesn't have to be exact or anything, but somewhat) (also replace the people with like text boxes/menu options of Main Prologue, Dark, etc. etc. cx):
http://cdn.wikimg.net/strategywiki/imag ... select.png
Furthermore, could we change to box of the menus choices (for example if you are choosing between apples and oranges) to look slightly different (like below at 3: 43):
https://www.youtube.com/watch?v=Efr9x2L_9G8
You can work with the code that we have above (other than the disabled feature implemented, it has remained the same) Sorry if this seems a bit much and thanks a lot in advance
Since you have been greatly helpful, perhaps you could help me with another matter?
Is there any way to make it so that the text box looks like the link (including the Speaker part as a permeant part of the text box (the name of the speaker itself changing with the general code))?
http://nicoblog.org/wp-content/uploads/ ... 42ef_o.jpg
Also, could we get the menu screen to look something like this (doesn't have to be exact or anything, but somewhat) (also replace the people with like text boxes/menu options of Main Prologue, Dark, etc. etc. cx):
http://cdn.wikimg.net/strategywiki/imag ... select.png
Furthermore, could we change to box of the menus choices (for example if you are choosing between apples and oranges) to look slightly different (like below at 3: 43):
https://www.youtube.com/watch?v=Efr9x2L_9G8
You can work with the code that we have above (other than the disabled feature implemented, it has remained the same) Sorry if this seems a bit much and thanks a lot in advance
Last edited by Siri on Tue May 24, 2016 7:03 am, edited 1 time in total.
- PetPeeve
- Regular
- Posts: 70
- Joined: Tue Nov 06, 2012 10:40 am
- Tumblr: agamemakingblogforcoolkids
- Contact:
Re: Disabling/Enabling Menu Items/Options
Do you just want the name in a separate window?
Because that can easily be done just by adding 'show_two_window = True" when you define your characters.
For example:
To make it look exactly like that, that would take some customizing. Have a look at https://www.renpy.org/wiki/renpy/doc/co ... appearance
And also viewtopic.php?f=8&t=9233
Because that can easily be done just by adding 'show_two_window = True" when you define your characters.
For example:
Code: Select all
define q = Character('Quinn', show_two_window=True)
And also viewtopic.php?f=8&t=9233
Avatar by shiohh
Re: Disabling/Enabling Menu Items/Options
I will be looking at those (as they appear to answer my question), but the only thing they do not appear to address is:
-- the change to box of the menus choices (for example if you are choosing between apples and oranges) to look slightly different (like below at 3: 43):
https://www.youtube.com/watch?v=Efr9x2L_9G8
-- the menu screen to look something like this (doesn't have to be exact or anything, but somewhat) (also replace the people with like text boxes/menu options of Main Prologue, Dark, etc. etc. cx):
http://cdn.wikimg.net/strategywiki/imag ... select.png
How would one go about doing that? Thanks a lot
-- the change to box of the menus choices (for example if you are choosing between apples and oranges) to look slightly different (like below at 3: 43):
https://www.youtube.com/watch?v=Efr9x2L_9G8
-- the menu screen to look something like this (doesn't have to be exact or anything, but somewhat) (also replace the people with like text boxes/menu options of Main Prologue, Dark, etc. etc. cx):
http://cdn.wikimg.net/strategywiki/imag ... select.png
How would one go about doing that? Thanks a lot
- PetPeeve
- Regular
- Posts: 70
- Joined: Tue Nov 06, 2012 10:40 am
- Tumblr: agamemakingblogforcoolkids
- Contact:
Re: Disabling/Enabling Menu Items/Options
Have a look at this: http://fuckyeahrenpy.tumblr.com/post/97 ... me-choices\
Actually, since you seem super new to Ren'py, I would recommend checking out http://renpyhandbook.tumblr.com/code-tutorials as well, there is lots of useful stuff on there.
Actually, since you seem super new to Ren'py, I would recommend checking out http://renpyhandbook.tumblr.com/code-tutorials as well, there is lots of useful stuff on there.
Avatar by shiohh
Re: Disabling/Enabling Menu Items/Options
Thank you so much, you have been really helpful with providing information and resources (you noticed that I was extremely new to renpy, I am (1 week newbie pretty much) XD I guess it was rather obvious cx)
Who is online
Users browsing this forum: Kocker