Sorry if this question has been asked before, but gawd knows I'd be searching forever to find the answer...Anyway, I'm new at using Ren'Py, and I was just wondering if someone could tell me if there's a way for the game to remember the choices that were made earlier in the game. Not like so a statement can be made, but like if there's a list of places you can go, you pick one, later on go back to that list of places and it remembers the places you've been and doesn't give you those choices. I hope that makes sense ^ . ^;;
Thank you ^ . ^
Help with Choices
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
-
- Eileen-Class Veteran
- Posts: 1153
- Joined: Mon Jul 07, 2003 4:57 pm
- Completed: Elven Relations, Cloud Fairy, When I Rule The World
- Tumblr: alextfish
- Skype: alextfish
- Location: Cambridge, UK
- Contact:
Re: Help with Choices
So the normal way to remember choices is to set variables, with a "$ varname = value" command, which you can then test with "if" commands:
However, for the specific thing you're wanting to do (giving a menu several times, but removing the choices you've already selected), Ren'Py offers a special way to do that, using the "set" parameter to the "menu" command. I'll illustrate it with some code from Elven Relations - note the "set EarlyPartyChoices" inside the menu. That makes Ren'Py leave out items you've already seen.
Code: Select all
menu:
"Choice A":
jump choicea
"Choice B":
jump choiceb
label choicea:
$ seenchoice = "A"
jump aftermenu
label choiceb:
$ seenchoice = "B"
jump aftermenu
label aftermenu:
"You selected choice %(seenchoice)s!"
if seenchoice == "A"
"(And choice A is my favourite too.)"
Code: Select all
label E4_3_menu1:
"Who should I go to talk to?"
$ EarlyPartyChoices = [ ]
jump E4_3_menu
label E4_3_menu2:
if E43totalseen >= 5:
jump E4_3_after
else:
"Who should I go talk to next?"
jump E4_3_menu
label E4_3_menu:
$ E43totalseen += 1
menu:
set EarlyPartyChoices
"Kei at the food table":
jump E4_3_Kei
"Makoto at the bar":
$ E43Makoto = True
jump E4_3_Makoto
"Asilana on the dance floor":
$ E43Asilana = True
jump E4_3_Asilana
"Tohko by the drinks":
$ E43Tohko = True
jump E4_3_Tohko
"Yurika standing by the wall":
$ E43Yurika = True
jump E4_3_Yurika
Last edited by chronoluminaire on Tue Aug 07, 2007 7:41 am, edited 1 time in total.
I released 3 VNs, many moons ago: Elven Relations (IntRenAiMo 2007), When I Rule The World (NaNoRenO 2005), and Cloud Fairy (the Cute Light & Fluffy Project, 2009).
More recently I designed the board game Steam Works (published in 2015), available from a local gaming store near you!
More recently I designed the board game Steam Works (published in 2015), available from a local gaming store near you!
Re: Help with Choices
Thank you so much! o wo I'll give it a try and hopefully it'll work - w-
-
- Miko-Class Veteran
- Posts: 576
- Joined: Fri May 07, 2004 9:40 am
- Completed: GO! Magical Boy (2006), Angelic Orbs (soundtrack)
- Projects: Cyberlin (in progress)
- Location: Finland
- Contact:
Re: Help with Choices
You can have it even more simple by putting the variables directly into the menu, e.g.
Code: Select all
menu:
"Choice A":
$ seenchoice = "A"
"Choice B":
$ seenchoice = "B"
"You selected choice %(seenchoice)s!"
Who is online
Users browsing this forum: No registered users