Page 1 of 1

If Statments on Choice Menu?

Posted: Thu May 13, 2021 9:12 am
by Red_Bobcat
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

Re: If Statments on Choice Menu?

Posted: Thu May 13, 2021 9:28 am
by Ocelot
https://www.renpy.org/doc/html/menus.html

Make sure that you have nessesary variables declared and properly set by your script.

Re: If Statments on Choice Menu?

Posted: Thu May 13, 2021 10:08 am
by Red_Bobcat
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

Re: If Statments on Choice Menu?

Posted: Thu May 13, 2021 10:23 am
by Ocelot
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

Re: If Statments on Choice Menu?

Posted: Thu May 13, 2021 10:37 am
by Red_Bobcat
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