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.
Hello, I'm a little new to Ren'py, and I need a little help. I'm using a menu and flags to remove the choices once they've been picked, but I can't get a final option to pop up once all of them have been picked.
For example, once library, general store, bar and diner, and walk around have been chosen, I want the option of 'Go to cabin' to pop up. Any ideas?
label lookaroundmenu:
menu:
nar "Where should you go to first?"
"The Library." if library_visited_done == False:
$ library_visited_done = True
jump thelibrary
"The General Store." if generalstore_visited_done == False:
$ generalstore_visited_done = True
jump generalstore
"The Bar and Diner." if baranddiner_visited_done == False:
$ baranddiner_visited_done = True
jump baranddiner
"Walk around." if walkaround_done == False:
$ walkaround_done = True
jump walkaround
label thelibrary:
nar "You walked to the rather small library, interested in if it had anything instore for you."
jump lookaroundmenu
label generalstore:
nar "You walked up the short steps to the general store, taking note of the fresh red paint on the porch. Maybe they were renovating a bit?"
jump lookaroundmenu
label baranddiner:
nar "Your stomach had been growling not too long ago. Maybe something to eat would satisfy you?"
jump lookaroundmenu
label walkaround:
nar "You choose to walk around, interested in the sights."
nar "You found there to be a town hall, which might actually have some answers about this places history."
jump lookaroundmenu
label chooseagain:
nar "You've already done that. Try again."
jump lookaroundmenu
return
label lookaroundmenu:
if library_visited_done:
if generalstore_visited_done:
if baranddiner_visited_done:
if walkaround_done:
$ gotocabin = True
else:
pass
else:
pass
else:
pass
else:
pass
menu:
nar "Where should you go to first?"
"The Library." if library_visited_done == False:
$ library_visited_done = True
jump thelibrary
"The General Store." if generalstore_visited_done == False:
$ generalstore_visited_done = True
jump generalstore
"The Bar and Diner." if baranddiner_visited_done == False:
$ baranddiner_visited_done = True
jump baranddiner
"Walk around." if walkaround_done == False:
$ walkaround_done = True
jump walkaround
"Go to cabin." if gotocabin == True:
jump gotocabin
Much easier to do Remix's line and I would go with that. @warmsundae You can use and and or on if conditions so you don't have to write the code like you did. This suffices.
There's an undocumented feature in menus that'll remove choices automatically.
(first found it mentioned by Ocelot over in this thread.)
So you can potentially write something like this:
## Use default to declare some variables to be used in the script.
default visited=[]
default jogged=False
label menu_loop:
menu:
## this variable holds a list of the choices chosen and hides them.
set visited
"The Library.":
call thelibrary2
jump menu_loop
"The General Store.":
call generalstore2
jump menu_loop
"The Bar and Diner.":
call baranddiner2
jump menu_loop
"Walk around." if not jogged: ## if statements still work too.
call walkaround2
jump menu_loop
"or jog around!" if not "Walk around." in visited: ## also this.
$jogged=True
"You found the town's town hall and got some good exercise too."
jump menu_loop
## The game continues down here if there's no jump statement,
## or when the above menu is out of choices.
menu:
"Go to cabin.":
"You head back to the cabin."
## this return ends the game if the call stack is empty.
return
## Note that if you use the same 'set name_here' again with another menu it
## would have the problem of hiding choices that were picked before.
## So either use a new variable everytime or reset it with this: $visited=[]
label thelibrary2:
"You walked to the rather small library, interested in if it had anything instore for you."
return
label generalstore2:
"You walked up the short steps to the general store, taking note of the fresh
red paint on the porch. Maybe they were renovating a bit?"
return
label baranddiner2:
"Your stomach had been growling not too long ago. Maybe something to eat would satisfy you?"
return
label walkaround2:
"You choose to walk around, interested in the sights."
"You found there to be a town hall, which might actually have some answers about this places history."
return