Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
So I'm coding a visual novel, and at one part you have 3 options that disappear after you select them. How can I jump to the next part of the story after all of the options have been selected?
menu flowers:
"White" if white:
$ white = 0
jump white
"Red" if red:
$ red = 0
jump red
"Yellow" if yellow:
$ yellow = 0
jump yellow
#what do I do after this?
All you need to do is add an if test after the menu to test for all selected choices. Also using the call statement allows you to easily get back to the menu once the player has finished a particular choice's route.
label flowers:
menu flowers:
"White" if white:
$ white = 0
call white
"Red" if red:
$ red = 0
call red
"Yellow" if yellow:
$ yellow = 0
call yellow
if white == 0 and red == 0 and yellow == 0:
jump continue
else:
jump flowers
label continue:
Last edited by dGameBoy101b on Thu Sep 13, 2018 8:09 am, edited 1 time in total.
label 3d:
$ flowers_set = []
menu flowers:
set flowers_set
"White":
call white
"Red":
call red
"Yellow":
call yellow
if len(flowers_set) < 3:
jump flowers
# implicitly, if the length of flowers_set is 3 or greater, it will fall through to the label cs
# if the script is organized differently, you can also add an explicit else jump cs
label cs:
"stuff"
default flowers_set = []
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
Very importantly, I wouldn't call the white/red/yellow...I'd jump, so that you can jump to the menu rather than return (which would put you at the end of the menu, not repeat it).
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?)
I wouldn't call the white/red/yellow...I'd jump, so that you can jump to the menu rather than return
By calling the flower text you can easily access the same text again from somewhere else without worrying about where it is beinging called from as it will just return to where it was called like so.
That the call returns where you came from is exactly why you shouldn't use it in this instance.
You had to create a secondary menu that repeats the first menu with one of the options taken out. My version just uses one menu. It is much more efficient. The way you set up your code, the set function is never used because you never return back to the top of the original menu.
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?)
trooper6 wrote: ↑Mon Aug 13, 2018 10:58 pm
That the call returns where you came from is exactly why you shouldn't use it in this instance.
You had to create a secondary menu that repeats the first menu with one of the options taken out. My version just uses one menu. It is much more efficient. The way you set up your code, the set function is never used because you never return back to the top of the original menu.
My previous code was not demonstrating how to repeat a menu only how the sub labels of the first menu can be recalled from another part of the code if, for instance, the main character encounters a similar bed of flowers.