Ren'Py Menu choice, with sub answers and required choices.

UncleNanard

I am to music what Kanye West is to adult games.
Game Developer
Jul 1, 2017
1,390
1,414
Hello guys, i m playing with Renpy.

I have a problem on a menu with choice.
I don't really know how to explain :p

I want to make dialog with choice.

But i want something like this :

Code:
Menu :

    "Look in the room"
        "I m looking in the room, i see nothing"

    "Call for help"
        i m screaming for help nobody respond"
This is easy BUT i need when the player click on "Look in the room" or "Call for help" to came back in the first menu with different choice like that :

Code:
If player has clicked on Look in the room:
    Menu :
        "Look in the room again"
            "I m looking in the room again, i see a window"

        "Call for help" (nothing change compared to the first menu)
            "i m screaming for help" (nothing change compared to the first menu)
            
OR

if player has clicked on Call for help:
    Menu:
        "Look in the room" (nothing change compared to the first menu)
            "I m looking in the room, i see nothing" (nothing change compared to the first menu)

        "Call for help louder"
            "i m screaming louder, someone respond me"
And for the end, i need to make some choice required like that :

Code:
If player has clicked on "Look in the room again":
    Menu:
        "Look in the room better"
            "I m looking in the room for the third time, i see nothing more" (This phrase is looping if the player spam on "Look in the room better" BUT now the game can continue if the player choice Call for Help, if the player don"t search 3 time he can spam Call for help the game don't continue)
        
        "Call for help
            "i m screaming for help"
I m sorry it"s hard for me to explain :(

maybe like that :

Code:
menu :
    -choice 1 (unlock choice 1.2)
    -choice 2 (unlock choice 2.2)

menu :
    -choice 1.2 (unlock choice 1.3)
    -choice 2.2 (unlock choice 2.3)

menu :
    -choice 1.3 looping if spam but unlock the possibility to go further
    -choice 2.3 looping if the 1.3 is lock, go further is 1.3 is unlock
If it's to hard to understand i can make fake menu in Renpy and take a screenshots.

Thanks for your help guys, and sorry for my English and my explanations :(
 

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,040
3,115
well you are missing something

you are missing the ":" and jump/call or pass

Python:
Menu :

    "Look in the room":
        "I m looking in the room, i see nothing"
        jump/call to label or pass

    "Call for help":
        "i m screaming for help nobody respond"
        jump/call to label or pass
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,130
14,809
But i want something like this :
[...]
BUT i need when the player click on "Look in the room" or "Call for help" to came back in the first menu with different choice like that :
Then just condition the choice, as said by the documentation.

Python:
default roomLooked = 0
default calledForHelp = False

menu whatever:
    "Look in the room" if roomLooked == 0:
        "I'm looking in the room, I see nothing."
        $ roomLooked = 1
        jump whatever
    "Look again in the room" if roomLooked == 1:
        "I'm looking in the room again, I see a window."
        $ roomLooked = 2
        jump whatever
    "A last look in the room" if roomLooked == 2:
        "I'm looking in the room for the third time, I see nothing more."
        jump whatever

    "Call for help" if calledForHelp == 0:
        "I'm screaming for help, nobody respond."
        $ calledForHelp = 1
        jump whatever
    "Call for help louder" if calledForHelp == 1:
        "I'm screaming louder, someone respond me."
        $ calledForHelp = 2
        jump whatever
    "Call for help" if calledForHelp == 2:
        "I'm screaming for help."
        jump whatever

    "Fly away":
        jump somewhereElse

Alternatively you can rely on the feature.
It lead to conditions that are a little more complex, since they rely on the exact text of the different choices, but limit the variables to only one by menu ; or even to one for all menus if they aren't embedded.

Python:
default genericMenuSet = Set()

label someLabel:
    $ genericMenuSet = Set()

menu whatever:

    set genericMenuSet

    "Look in the room" if not "Look in the room" in genericMenuSet :
        "I'm looking in the room, I see nothing."
        jump whatever
    "Look again in the room" if "Look in the room" in genericMenuSet and not "Look again in the room" in genericMenuSet:
        "I'm looking in the room again, I see a window."
        jump whatever
    "A last look in the room" if "Look again in the room" in genericMenuSet :
        "I'm looking in the room for the third time, I see nothing more."
        jump whatever

    "Call for help" if not "Call for help." in genericMenuSet:
        "I'm screaming for help, nobody respond.":
        jump whatever
    "Call for help louder" if "Call for help." in genericMenuSet and not "Call for help louder" in genericMenuSet:
        "I'm screaming louder, someone respond me."
        jump whatever
    "Call for help" if "Call for help louder" in genericMenuSet:
        "I'm screaming for help."
        jump whatever

    "Fly away":
        jump somewhereElse
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,559
2,175
As I see it, there are two possible solutions.


First, the simplest - use multiple menus:

Don't return to the same menu:, and instead have different menu: statements that look almost identical to the player when they are playing.

I'm thinking something like:

Python:
label start:

    scene black with fade


label first_time_in:

    menu:

        "Look in the room":
            "I m looking in the room, I see nothing."
            jump look_in_room1

        "Call for help":
            "I'm screaming for help. Nobody responds."
            jump first_time_in

        "Something else":
            jump get_out_of_this_loop
     

label look_in_room1:

    menu:

        "Look in the room again":
            "I'm looking in the room again, I see a window."
            jump look_in_room2

        "Call for help":
            "I'm screaming for help. Nobody responds."
            jump look_in_room1

        "Something else":
            jump get_out_of_this_loop


label look_in_room2:
 
    menu:

        "Look in the room better":
            "I keep searching the room. I find nothing I haven't already seen."
            jump look_in_room2

        "Call for help":
            "I'm screaming for help. Nobody responds."
            jump look_in_room2

        "Something else":
            jump get_out_of_this_loop


label get_out_of_this_loop:

    # blah, blah, more code.

This doesn't fit your exact requirements (since it doesn't do anything with the 2nd scream), but it's close enough for the purposes of an example.

Just because you have a menu in your head that feels like it needs to be the same menu, doesn't mean it has to be. What matters is what the player sees.


Secondly - use variables to control the menu choices:

RenPy has a thing within a menu: statement that will let you show or hide a menu choice based on an if statement added after the "choice" text. If the result of the if check is True, the menu choice will be shown - if it is False, it isn't.

You could use this to pick which of your various choices are shown to the player.

I'm thinking something like:

Python:
default room_state = 0
default already_screamed = False


label start:

    scene black with fade


label just_before_room_menu:

    $ room_state = 0
    $ already_screamed = False


label room_menu:

    menu:

        "Look in the room" if room_state == 0:
            "I m looking in the room, I see nothing."
            $ room_state = 1
            jump room_menu

        "Look in the room again" if room_state == 1:
            "I'm looking in the room again, I see a window."
            $ room_state = 2
            jump room_menu

        "Look in the room better" if room_state == 2:
            "I keep searching the room. I find nothing I haven't already seen."
            jump room_menu

        "Call for help" if already_screamed == False:
            "I'm screaming for help. Nobody responds."
            $ already_screamed = True
            jump room_menu

        "Call for help louder" if already_screamed == True:
            "I'm screaming louder, hoping someone will respond to me."
            jump room_menu

        "Something else":
            jump get_out_of_this_loop
     

label get_out_of_this_loop:

    # blah, blah, more code.

As Anne says, there's also menuset. But I'm guessing that if you're struggling with creating a menu like this in the first place, menuset is going to feel too complex for you.

I'll also quickly point out what Ray also pointed out... a lot of your statements are coded wrongly. You're missing colons at the end of menu choices and you're also using a capital "M" at the start of "Menu:" - RenPy is a case sensitive language, you can't just capitalise things randomly.

As with anything within RenPy, there are other solutions. But I figure the two examples I've given should keep you on the right track.

More details about menu: here :
More details about if: here :
An introduction I wrote about variables a while ago : https://f95zone.to/threads/newbie-guide-to-basic-variables-in-renpy.22709/

Obviously the second solution is the better and preferred way of doing it. It's only second in my list because it needs an extra understanding of both variables and adding if: statements to menu choices.


Edit:

Just one final thought... You're putting an awful lot of extra work for something most players will only see for a few seconds and will barely remember. I understand that little touches like this can improve the overall quality of a game. I guess I'm just saying to think about how much time a player will see it compared with the amount of extra time it will take you to deliver it.
 
Last edited:

moskyx

Engaged Member
Jun 17, 2019
3,864
12,419
Following 79flavors final thought, from a player's perspective I wouldn't want to be forced to click 3 times on a useless option before being allowed to proceed by clicking on the other one. If I click once and nothing happens, I'll then click the other option - and according to OP's original idea, nothing will happen either, except now the options are worded in a slightly different way. As I'm stuck, I'll click again on one of the options to get the very same result (nothing). At this point there's a serious chance of me quitting the game, frustrated and annoyed. I get that frustration is exactly the feeling you want to convey as the MC is trapped somewhere and you want the player's to feel that oppressive feeling, but I don't think annoyment is something you would want your players to experience with your game...

If I were the OP, I'd just write a few lines in the "look the room" option, saying you look and look and find nothing and you're feeling more and more anxious... And then offer again the menu but with the only option to call for help, again with a few lines in which your MC is getting louder and louder (and more and more anxious) until someone finallly hears him. And of course, calling for help should be an available solution from the start, so the player doesn't need to look the room before getting out. You can add points to some variable if you looked first before crying for help, or set a flag (a true/false variable to remember that choice and add some flavour text later on, or even during the "calling for help" option), so that this menu is actually meaningful in the story. As it's planned now, I don't really see its attractive
 

UncleNanard

I am to music what Kanye West is to adult games.
Game Developer
Jul 1, 2017
1,390
1,414
Thanks everybody for your help.

I think you are right for the multiple choice, but it's because i try to remake an old game for training, and the game is like that.

Maybe i will try to evolve this old system.
Probably like that :

-choice 1 (when clicked the choice disappears)
-choice 2 (when clicked the choice disappears)
When choice 1 and 2 are clicked choice 3 appears for go further.

I will try, but that don't respect the original game, but i think it's to hard for me.
 

UncleNanard

I am to music what Kanye West is to adult games.
Game Developer
Jul 1, 2017
1,390
1,414
I think i did it guys. With your help.

Code:
label start :

    default room_look = 0
    default room_call = 0
    default room_out = 0
  

    label just_before_room_menu:

        $ room_look = 0
        $ room_call = 0
        $ room_out = 0
        $ look = False
        $ call = False
        $ out = False
        $ all = False



    label room_menu:

        menu:

            "Look" if room_look == 0:
                "look"
                $ room_look = 1
                jump room_menu

            "Look" if room_look == 1:
                "look again"
                $ room_look = 2
                jump room_menu

            "Look" if room_look == 2:
                "look loop"
                $ look = True
                jump room_menu

            "call" if room_call == 0:
                "call"
                $ room_call = 1
                jump room_menu

            "call" if room_call == 1:
                "call again"
                $ room_call = 2
                jump room_menu

            "call" if room_call == 2:
                "call loop"
                $ out = True
                jump room_menu

            "out" if room_out == 0:
                "out"
                $ room_out = 1
                jump room_menu

            "out" if room_out == 1:
                "can't go out"
                $ room_out = 2
                $ out = True
                jump room_menu

            "out" if room_out == 2:
                "don't know how to go out"
                $ room_out = 2
                $ out = True
                jump room_menu
Now i need to find how i can make :

Code:
"Out" if look = True, call = True, Out = True:
    "i found a window, i hear someone, i try to go out"
    "The winodw is open, i'm out"
    jump out_of_this_shitty_loop
i think i need something who say if look + call + out are TRUE: all = True
So with all = true i can make a choice for going out.

But i don't know how to code that, i go looking the doc.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,559
2,175
Firstly, default lines go before the label start:. Usually at (or very near) the top of your script file.

As for the other thing, you want .
In this case and:

Python:
    menu:
        "Out" if room_look == True and room_call == True and room_out == True:

There are shorter ways to write it, but this long hand way is easier to understand while you're just starting out.

Also make sure you don't mix up == and =.
== is a logical check, whereas = is a value assignment. If you put something like if room_call = True, that's wrong and would actually change the value of room_call to True, even though it's part of an if statement.
 
  • Like
Reactions: UncleNanard

UncleNanard

I am to music what Kanye West is to adult games.
Game Developer
Jul 1, 2017
1,390
1,414
Firstly, default lines go before the label start:. Usually at (or very near) the top of your script file.

As for the other thing, you want .
In this case and:

Python:
    menu:
        "Out" if room_look == True and room_call == True and room_out == True:

There are shorter ways to write it, but this long hand way is easier to understand while you're just starting out.

Also make sure you don't mix up == and =.
== is a logical check, whereas = is a value assignment. If you put something like if room_call = True, that's wrong and would actually change the value of room_call to True, even though it's part of an if statement.
OMG i love you so much, all i want is working !!!
I will add you and everybody who helped me in the credit in my never released game <3
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,130
14,809
Following 79flavors final thought, from a player's perspective I wouldn't want to be forced to click 3 times on a useless option before being allowed to proceed by clicking on the other one.
I agree on that.
It can works if it's to add some depth by declining a non vital information. By example, looking at a painting for the first time will give the information you need, while looking a second time could be something like "oh, I haven't seen [whatever]. Whoever painted this really cared about the smallest details".
But the important information should be available right from the first time. And once there's nothing more to see, just remove the choice.

Even pure "professional" point'n'click don't act like this. Either it give you the information, or tell you that you need something to interact with "this".
Whatever how complex can be your game mechanisms, you should always avoid to confuse the player or, worse, make him feel uselessly lost. This especially apply for adult games, where players will be either interested by the story, or by the lewd, but almost never by the game mechanisms. Whatever the reason we play the game, if we wanted a challenge, we would have played a "regular" game. If we choose an adult one, it's to pass time while enjoying doing it.


[...] At this point there's a serious chance of me quitting the game, frustrated and annoyed.
Personally I would probably look at the code, but wouldn't be less annoyed. In the end, I would probably think that the author felt the need to artificially increase the time needed to play his game, what is rarely a good omen and tend to make me stop playing.


If I were the OP, I'd just write a few lines in the "look the room" option, saying you look and look and find nothing and you're feeling more and more anxious...
"There's something here... I know it, I feel it ! Why can't I find it ?"
 

UncleNanard

I am to music what Kanye West is to adult games.
Game Developer
Jul 1, 2017
1,390
1,414
I agree on that.
It can works if it's to add some depth by declining a non vital information. By example, looking at a painting for the first time will give the information you need, while looking a second time could be something like "oh, I haven't seen [whatever]. Whoever painted this really cared about the smallest details".
But the important information should be available right from the first time. And once there's nothing more to see, just remove the choice.

Even pure "professional" point'n'click don't act like this. Either it give you the information, or tell you that you need something to interact with "this".
Whatever how complex can be your game mechanisms, you should always avoid to confuse the player or, worse, make him feel uselessly lost. This especially apply for adult games, where players will be either interested by the story, or by the lewd, but almost never by the game mechanisms. Whatever the reason we play the game, if we wanted a challenge, we would have played a "regular" game. If we choose an adult one, it's to pass time while enjoying doing it.




Personally I would probably look at the code, but wouldn't be less annoyed. In the end, I would probably think that the author felt the need to artificially increase the time needed to play his game, what is rarely a good omen and tend to make me stop playing.




"There's something here... I know it, I feel it ! Why can't I find it ?"
Yes you are right, but i already explained why. I try to remaster and old game. And his like that.

Anyway, i m very excited guys. My project is around 40% i can't wait to share it <3

Thanks for your help.
 

UncleNanard

I am to music what Kanye West is to adult games.
Game Developer
Jul 1, 2017
1,390
1,414
Guys i m uploading my first project and i will try to share it if the mods accept.
I m so excited ! Thanks for your help.
 
  • Like
Reactions: Lou111