Conditional Menus?

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
Nella102
Newbie
Posts: 2
Joined: Mon Oct 19, 2020 11:47 am
Contact:

Conditional Menus?

#1 Post by Nella102 » Mon Oct 19, 2020 12:54 pm

Would it be possible to have a menu with questions that are only unlocked if a variable is set to true? If so how would I do it?

User avatar
RicharDann
Veteran
Posts: 239
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Conditional Menus?

#2 Post by RicharDann » Mon Oct 19, 2020 1:09 pm

You just need to add an if statement after the choice.

Code: Select all

default beach_unlocked = True

label start:
    menu:
        "Go to the park":
            "I guess I'll go to the park."

        "Go to the beach" if beach_unlocked: #will only appear if beach_unlocked is True
            "Let's go to the beach!"
For a more detailed explanation and example see here.
The most important words a man can say are, “I will do better.”

Post Reply

Who is online

Users browsing this forum: omranpanda