If Statments on Choice Menu?

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
Red_Bobcat
Newbie
Posts: 5
Joined: Tue Apr 06, 2021 8:57 am
Contact:

If Statments on Choice Menu?

#1 Post by Red_Bobcat » Thu May 13, 2021 9:12 am

Hello. I'm designing a game where a character must find clues and items to overcome obstacles, for instance they come across a locked door with a keypad and have to search a room to find the entry code. However, I want to list every item and clue the character has currently found for every obstacle, and for the player to have to figure out which is the correct one to use.

Problem is, I don't want to list every possible answer ever and every possible clue ever for every challenge. Is there a way to have a choice menu pop up, but for the choices within it to be varied depending on actions the player has already taken.

For example:
Player walks into a room with a pair of scissors, an empty bottle and a bucket.
There is a locked door which they click on.
They are given the choice to use the scissors, bottle and bucket on the door but none work.
They use the scissors to open a deck and retrieve a code, but break the scissors in the process.
They click on the door again and this time the bottle and bucket are listed again, the scissors are not but the code now is

Basically the old point and click forumla

Any idea how to code this? I tried IF statments in the Choice Menu but couldn't get it to work at all.

Thank you

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1077
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: If Statments on Choice Menu?

#2 Post by Ocelot » Thu May 13, 2021 9:28 am

https://www.renpy.org/doc/html/menus.html

Make sure that you have nessesary variables declared and properly set by your script.
< < insert Rick Cook quote here > >

Red_Bobcat
Newbie
Posts: 5
Joined: Tue Apr 06, 2021 8:57 am
Contact:

Re: If Statments on Choice Menu?

#3 Post by Red_Bobcat » Thu May 13, 2021 10:08 am

Oh wow, this is almost exactly what I had in mind, thank you.

Is there a way to change the order in which the choices in the menu are displayed, based upon the order a player has items in their inventory? So if you had the bucket first in your inventory, it would be the top option, but if you moved it to the third inventory spot it would be third in the menu

Thank you again

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1077
Joined: Tue Aug 23, 2016 10:35 am
Skype: miinipaa
Contact:

Re: If Statments on Choice Menu?

#4 Post by Ocelot » Thu May 13, 2021 10:23 am

Well, yes, but you would have to eschew using menu statement and instead do everything RenPy does under the hood manually.
A good start would be display_menu function. You will have to create a list of choices manually from your invertory content and pass it to the function.

https://www.renpy.org/doc/html/statemen ... splay_menu
< < insert Rick Cook quote here > >

Red_Bobcat
Newbie
Posts: 5
Joined: Tue Apr 06, 2021 8:57 am
Contact:

Re: If Statments on Choice Menu?

#5 Post by Red_Bobcat » Thu May 13, 2021 10:37 am

Is there... perhaps a tutorial on how to do that for a beginner? Or is that wishful thinking haha? I want to learn how to do it, but am not sure where I'd start and reading these documentations is a bit like reading another language for me

Post Reply

Who is online

Users browsing this forum: No registered users