Going back and forth between options without using rollback?

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
dvorah
Newbie
Posts: 1
Joined: Sun Dec 11, 2016 9:27 pm
Tumblr: saibotss
Deviantart: dvorahh
Location: Texas
Contact:

Going back and forth between options without using rollback?

#1 Post by dvorah »

I'm a a noob still when it comes to Ren'Py and these forums, so I'm really sorry if there's a specific name to this or if it's been answered already, etc. I'm not sure how to explain it exactly, so please forgive me. But for context, my game has periods within it where you're given the choice to talk to different people and earn points and whatnot. I would like to add in the ability for the player to be able to leave conversations at any time to go talk to the other available options. For example, if the player is given a menu with the choices of people 'A' 'B' 'C' and 'D', and they choose to talk to person 'B' first, but then decide to leave the conversation before it's supposed to end, I would like for them to have the other people available to talk to as well, while still retaining any decisions or points received from their conversation with person B. However, I would want person B to not be available to talk to anymore, as they already spoke to them. Is there specific coding to achieve this? Apologies if this doesn't make sense I will try to elaborate as best as I can.

Spiky Caterpillar
Veteran
Posts: 253
Joined: Fri Nov 14, 2008 7:59 pm
Completed: Lots.
Projects: Black Closet
Organization: Slipshod
Location: Behind you.
Contact:

Re: Going back and forth between options without using rollb

#2 Post by Spiky Caterpillar »

There's more than one way to do it, but here's a snippet from Wolf Hall, with some of the text trimmed and comments added for clarity:

Code: Select all

    william "Any other questions?"
    # First, create a new empty list to store the menu choices in.
    $ chose_intro_questions = []
    label intro_other_questions:
    menu:
        # A menu choice with an if statement is only shown if the condition is true.
        "What are the rules about dating?" if 'dating' not in chose_intro_questions:
            # Mark the question chosen
            $ chose_intro_questions.append('dating')
            william uniform1 teasing "I see where you've set your priorities!"
            # Loop back to menu start, removing this question, unless this is
            # the SECOND question asked, in which case we keep going.
            if len(chose_intro_questions)<2:
                jump intro_other_questions
        "When can I get to the dungeons?" if 'dungeon' not in chose_intro_questions:
            $ chose_intro_questions.append('dungeon')
            william uniform1 neutral "You won't have a real dungeon exam for a month or so, but you can go down on weekends to practice your spells on dummy targets."
            william "You have to learn a few spells first, or there's no point."
            # Loop back to menu start, removing this question, unless this is
            # the SECOND question asked, in which case we keep going.
            if len(chose_intro_questions)<2:
                jump intro_other_questions
        "What's the best color of magic?" if 'color' not in chose_intro_questions:
            $ chose_intro_questions.append('color')
            william uniform1 winking "Whatever suits you best."
            # Loop back to menu start, removing this question, unless this is
            # the SECOND question asked, in which case go we keep going.
            if len(chose_intro_questions)<2:
                jump intro_other_questions
    show william uniform1 surprise
    "Whatever else he was going to say is interrupted by a shriek of girlish outrage from the hall."
Nom nom nom nom nom LEAVES.

Post Reply

Who is online

Users browsing this forum: Google [Bot]