Choieces and Remembering Choices

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.
Post Reply
Message
Author
Beckwith
Newbie
Posts: 4
Joined: Sun Dec 10, 2023 7:51 pm
Contact:

Choieces and Remembering Choices

#1 Post by Beckwith »

I am coding a choice into my visual novel, but I have run into an issue.

I have a menu and have 3 choices. When 1 is picked, I need it to not show up again the next time the last 2 choices come up and then no choice to come up after they choose 2 choices. Here is an example of what I am doing.

menu:
"Baseball and soccer fields":
kevin "Heall yeah."
jenn "I figured as much."

"Fraternities and sororities houses":
kevin "Sounds good to me."
jenn "Good idea."

"Library and Classrooms":
kevin "Nerd."
jenn "At least he has his priorities right."

scene ch1d1-12 with dissolve
jenn "The classrooms are nice. Hopefully we can have some personal time with our professors."
p "Yeah, it will be nice. Some of the rooms are large, so expect a lot of students."
jenn "Yeah, but that is ok."
p "Let's see the Library."
jenn "I am for that."
kevin "Ugh, another place I won't be spending my time."

scene ch1d1-13 with dissolve
jenn "I like the library, it is nice."
p "Yeah, should be a nice place to go when I need to get away from Kevin."
kevin "WHAT?!"
Jenn "Shhh."
kevin "Yeah yeah."
p "But it is nice and will be nice to spend some time here to get away from all the other things going on."
jenn "Yeah, it will be a good place when you need to study."

kevin "Where to next?"

Then here is the same question with the next 2 choices.

Then after that they just go to the last option.

enaielei
Veteran
Posts: 293
Joined: Fri Sep 17, 2021 2:09 am
Organization: enaielei
Tumblr: enaielei
Deviantart: enaielei
Github: enaielei
Skype: enaielei
Soundcloud: enaielei
itch: enaielei
Discord: enaielei#7487
Contact:

Re: Choieces and Remembering Choices

#2 Post by enaielei »

Next time utilize code blocks.
Screenshot 2023-12-13 075510.png
Screenshot 2023-12-13 075510.png (14.22 KiB) Viewed 5501 times
Use menu sets.

Code: Select all

default choices = set()

label start:
    menu:
        set choices

        "Baseball and soccer fields" if len(choices) < 2:
            kevin "Heall yeah."
            jenn "I figured as much."

        "Fraternities and sororities houses" if len(choices) < 2:
            kevin "Sounds good to me."
            jenn "Good idea."

        "Library and Classrooms" if len(choices) < 2:
            kevin "Nerd."
            jenn "At least he has his priorities right."

            scene ch1d1-12 with dissolve
            jenn "The classrooms are nice. Hopefully we can have some personal time with our professors."
            p "Yeah, it will be nice. Some of the rooms are large, so expect a lot of students."
            jenn "Yeah, but that is ok."
            p "Let's see the Library."
            jenn "I am for that."
            kevin "Ugh, another place I won't be spending my time."

            scene ch1d1-13 with dissolve
            jenn "I like the library, it is nice."
            p "Yeah, should be a nice place to go when I need to get away from Kevin."
            kevin "WHAT?!"
            Jenn "Shhh."
            kevin "Yeah yeah."
            p "But it is nice and will be nice to spend some time here to get away from all the other things going on."
            jenn "Yeah, it will be a good place when you need to study."
Notice the conditions if len(choices) < 2 which is also documented on the site that I linked.

Beckwith
Newbie
Posts: 4
Joined: Sun Dec 10, 2023 7:51 pm
Contact:

Re: Choieces and Remembering Choices

#3 Post by Beckwith »

I am trying to get it to ONLY show 2 options after 1 is up and then 1 option after 2 are chosen, but it keeps showing all 3 options, not sure where I am going wrong.

Code: Select all

    default baseballandsoccerfields = True
    default fraternitiesandsororitieshouses = True
    default libraryandclassrooms = True

Code: Select all

    menu:
        "Baseball and soccer fields" if baseballandsoccerfields:
            $ baseballandsoccerfields == False
            kevin "Heall yeah."
            jenn "I figured as much."
            
	"Fraternities and sororities houses" if fraternitiesandsororitieshouses:
            $ fraternitiesandsororitieshouses == False
            kevin "Sounds good to me."
            jenn "Finally."
            p "Looking to rush one?"
            jenn "Maybe, how about you?"
            p "Maybe, have not decided yet."
            kevin "I would join with you, man."

        "Library and Classrooms" if libraryandclassrooms:
            $ libraryandclassrooms == False
            kevin "Nerd."
            jenn "At least he has his priorities right."

Post Reply

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot]