Returning to menu with fewer options without loop

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
louiselapucelle
Newbie
Posts: 1
Joined: Wed Jul 01, 2020 7:04 pm
Contact:

Returning to menu with fewer options without loop

#1 Post by louiselapucelle »

Hi!

Uh, this is my first time posting here, sorry if I'm doing something wrong....
I'm not sure how to describe exactly my problem and I'm a noob with Python and RenPy so I'll try my best to explain myself. In my game I have a menu with choices and you can choose an option, do that activity, and then it returns you to the menu again to try another one. My problem is that it's looping itself and I don't know how to make one option no longer accessible once you already selected it.

I have my variables like this:

Code: Select all

label questions:

    $stargazing = True
    $katanuki_done = True
    $walking_done = True
    $drinking_done = True
    $masks_done = True
    $standing_done = True
    $why_done = True

and, for example, the first option is like this:

Code: Select all

   menu:
        h "These are the activities!"

        "Stargazing." if stargazing == True:
            $stargazing = False
            show mimi happy with dissolve
            n "Let's stargaze."
            show melody surprised with dissolve
            h "Oh! My favorite activity, huh?"
            show mimi neutral with dissolve
            h "Sure thing! Follow me."

            jump stargazing
What I want to do is display the menu choices again once you finished an activity, disabling the ones you already chose, then, once you did them all, show just an option that will lead you to the end of the game. I don't know how to code that ;; and I already tried a few options I saw on this forum, but none of them seemed to work for me. How can I fix this? ;; Can anyone help me, please? I would really appreciate it!

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Returning to menu with fewer options without loop

#2 Post by IrinaLazareva »

There are several ways. The easiest:

Code: Select all

default stepone = False
default steptwo = False
default stepthree = False

Code: Select all

label start:
    #

    menu act:
        'These are the activities!'
        'step one' if not stepone:
            $ stepone = True
            "Let's....whatever"
            jump act
        'step two' if not steptwo:
            $ steptwo = True
            #
            jump act
        'step three' if not stepthree:
            $ stepthree = True
            #
            jump act
        'to end' if stepone and steptwo and stepthree:
            # end game
            return

https://www.renpy.org/doc/html/menus.html#in-game-menus
viewtopic.php?f=8&t=53256&p=502414#p502382

You can also combine the solution with this function

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Karrion