Menu that depends on true/false variables [Solved]

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
justsam
Newbie
Posts: 4
Joined: Fri Dec 03, 2021 4:33 pm
itch: launcher
Contact:

Menu that depends on true/false variables [Solved]

#1 Post by justsam » Fri Sep 16, 2022 11:21 am

I'm planning a murder mystery game. This is my second game on RenPy so I know how to do some things on it, but I was wondering if it was possible to have menu options only show up if a variable is true. For more context, I'm planning on making each clue boolean variable all set to false until the player finds them. Then, if they want to solve the murder there will be a menu that says "What happened?" and list any relevant clues that the user has found, then once they click a clue and another menu will show "why did it happen?" and again list any relevant clues that the user has found, and then the last menu is "who did it?" and the options are again relevant clues the user has found.

But is that possible to make a menu option only show up if a variable is true or will I have to make a bunch of different menus for each possibility? I would like to know before I start coding just so I don't waste time planning for things that can't happen
Last edited by justsam on Fri Sep 16, 2022 7:13 pm, edited 1 time in total.

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1882
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Menu that depends on true/false variables

#2 Post by Ocelot » Fri Sep 16, 2022 2:14 pm

Yes:

Code: Select all

default hint_found = False

label start:
    "hame start"
    menu:
        "Did you find the hint?"
        "Yes":
            $ hint_found = True
        "No":
            pass
    "some time later"
    menu:
        "Do you know what happened?"
        "Yes" if hint_found:
            "Good"
        "No":
            "Too bad."
    "The end."
    return
< < insert Rick Cook quote here > >

justsam
Newbie
Posts: 4
Joined: Fri Dec 03, 2021 4:33 pm
itch: launcher
Contact:

Re: Menu that depends on true/false variables [Solved]

#3 Post by justsam » Fri Sep 16, 2022 7:13 pm

Thank you so much!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Majestic-12 [Bot]