First of all, I want to say hello as this is my first post on this forum and it is cool to see that there are people with whom I can share the same passion and that is a game dev. I am relatively new to Ren'py so I have a question regarding the in-game menu.
I would like to create an in-game menu from which the user will have to choose from, let's say three options. The tricky part is that if the user will choose option menu A after the scenes are finished the user should be redirected to the scene with the menu and there should be only two remaining option for selection. After another option is selected and the scenes are finished the user will be redirected again to the menu with the remaining option for selection. How do I translate this into a script?
Thank you
In game menu with single use choices
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.
- CSV
- Regular
- Posts: 145
- Joined: Sun Aug 31, 2014 6:58 pm
- Tumblr: csvidaldraws
- Deviantart: csvidal
- itch: csvidal
- Location: Portugal
- Contact:
Re: In game menu with single use choices
If I understood your issue correctly, then you can use something like this.
I tried to name everything so you can easily change it to suit your needs. Also, please note that I am not a programmer, so there might be better ways to achieve this effect!
Code: Select all
# The game starts here.
label start:
$ OptionARead = False
$ OptionBRead = False
$ OptionCRead = False
N "This is where the story starts."
label firstchoice:
N "There's a choice menu coming up!"
menu:
"Option A." if OptionARead == False:
$ OptionARead = True
jump sceneA
"Option B." if OptionBRead == False:
$ OptionBRead = True
jump sceneB
"Option C." if OptionCRead == False:
$ OptionCRead = True
jump sceneC
label sceneA:
N "You chose option A!"
N "Let's try to move on."
if OptionARead == True and OptionBRead == True and OptionCRead == True:
jump anotherscene
else:
jump firstchoice
label sceneB:
N "You chose option B!"
N "Let's try to move on."
if OptionARead == True and OptionBRead == True and OptionCRead == True:
jump anotherscene
else:
jump firstchoice
label sceneC:
N "You chose option C!"
N "Let's try to move on."
if OptionARead == True and OptionBRead == True and OptionCRead == True:
jump anotherscene
else:
jump firstchoice
label anotherscene:
"And now the story can move on."
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: In game menu with single use choices
Here is a better way to achieve what you want.
Code: Select all
default flowers_set = [] #variables should be declared outside of any block using default if the variable will change, define if it won't
label start:
"Your game starts."
menu flowers:
set flowers_set
"Choose a flower."
"White":
jump white
"Red":
jump red
"Yellow":
jump yellow
"Your game continues here."
"Your game is over."
return
label white:
"You look at the white flowers."
jump flowers
label red:
"You look at the red flowers."
jump flowers
label yellow:
"You look at the yellow flowers."
jump flowers
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3791
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: In game menu with single use choices
I don't understand this, how does this work?trooper6 wrote: ↑Wed Sep 26, 2018 8:38 pm Here is a better way to achieve what you want.
Code: Select all
default flowers_set = [] #variables should be declared outside of any block using default if the variable will change, define if it won't label start: "Your game starts." menu flowers: set flowers_set "Choose a flower." "White": jump white "Red": jump red "Yellow": jump yellow "Your game continues here." "Your game is over." return label white: "You look at the white flowers." jump flowers label red: "You look at the red flowers." jump flowers label yellow: "You look at the yellow flowers." jump flowers
It looks like a list, but you don't add or remove anything?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: In game menu with single use choices
It's undocumented behavior but there are a bunch of forum posts about it and (as of right now) it works. *shrug* The logical assumption is that the menu statement is "translated" into renpy.menu or whatever, and somewhere in the process there is a sort of set-checking behavior embedded.
-
- Newbie
- Posts: 7
- Joined: Wed Sep 26, 2018 3:47 pm
- Completed: VIS
- Projects: VIS
- Deviantart: madkinggames
- Contact:
Re: In game menu with single use choices
Thank you guys, I am going to try it now
-
- Newbie
- Posts: 7
- Joined: Wed Sep 26, 2018 3:47 pm
- Completed: VIS
- Projects: VIS
- Deviantart: madkinggames
- Contact:
Re: In game menu with single use choices
I am here with feedback. It worked and thank you all for the support. GG
Who is online
Users browsing this forum: Google [Bot]