Questions on choices and menues

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Post Reply
Message
Author
Yonorang
Newbie
Posts: 4
Joined: Mon Apr 14, 2008 2:23 pm
Contact:

Questions on choices and menues

#1 Post by Yonorang »

Hello everyone!
I'm still pretty new to Ren'Py and trying to figure out how
how to getting it to do, what I want to do. German being
the only language I can use fluently is another thing, but
that is a whole different matter ^^;.

As for what this topic is about:
Currently I'm trying too script various kind of menues that
are interdependent and that are affected by choices earlier
made in the game.
For example let's say that there are two options, no.1 being
that I attend the P.E. lesson and no.2 that I play the piano
instead. The second menu contains 3 options, one being
that I take a shower.
How do I hide this option, if I did not take option no.1 in
the first menu?

On the game I'm planning to do:
The protagonist of this game is a psychometre, who is able
to obtain information on an object and anything that was
in contact with it by meerly touching it. Depending on the
player's choice the protagonist is drawn into an adventure,
which will not only unveil the mysteries of the past but also
influence his surroundings.

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Questions on choices and menues

#2 Post by PyTom »

Menus choices support an if clause that can be used to check a flag. For example, you could have the found_hidden_room flag, and then check it like:

Code: Select all

menu:
    "Where should I go?"
    "Bedroom":
         jump bedroom
    "Bathroom":
         jump bathroom
    "Hidden room" if found_hidden_room:
         jump hidden_room
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Yonorang
Newbie
Posts: 4
Joined: Mon Apr 14, 2008 2:23 pm
Contact:

Re: Questions on choices and menues

#3 Post by Yonorang »

Thanks for the fast reply!
And what do I have to do if I want to hide
the "Hidden room"-option, when the prota-
gonist has not found that room, yet?

User avatar
rioka
Royal Manga Tutor
Posts: 1255
Joined: Fri Jul 16, 2004 12:21 pm
Completed: Amgine Park, Garden Society: Kykuit, Metropolitan Blues (art)
Location: somewhere in NY
Contact:

Re: Questions on choices and menues

#4 Post by rioka »

You don't have to do anything. Just as long as the protagonist hasn't found the hidden room, the player won't see that option. It will only appear when it is found because that if clause is basically saying, "show this option only if the hidden room as been found". If it hasn't been found, it won't show up.

User avatar
Deji
Cheer Idol; Not Great at Secret Identities
Posts: 1592
Joined: Sat Oct 20, 2007 7:38 pm
Projects: http://bit.ly/2lieZsA
Organization: Sakevisual, Apple Cider, Mystery Parfait
Tumblr: DejiNyucu
Deviantart: DejiNyucu
Location: Chile
Contact:

Re: Questions on choices and menues

#5 Post by Deji »

I have a related question!
I've serached around, but i'm not sure about how to do this...

I have a menu with several questions you can ask a character

Code: Select all

menu:
    "question1?":
        #ask question1
    "question2?":
        #ask question2
    "question3?":
        #ask question3
    "question4?":
        #ask question4
Now, what I want to do is that after asking the question and getting the responses, the menu is displayed again, but without the question you already asked.

so after you ask , say, question2,
your choices are
question1
question3
question4

How do I do this? ^^;
Image
Tumblr | Twitter
Forever busy :')
When drawing something, anything, USE REFERENCES!! Use your Google-fu!
Don't trust your memory, and don't blindly trust what others teach you either.
Research, observation, analysis, experimentation and practice are the key! (:

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Questions on choices and menues

#6 Post by Jake »

Deji wrote: Now, what I want to do is that after asking the question and getting the responses, the menu is displayed again, but without the question you already asked.
[...]
How do I do this? ^^;
Set up some variables which hold true/false values depending on whether or not a particular question has been asked yet or not. It's probably best to set them all to false just before the menu if you're going to re-use the same ones throughout.

Then, just do the same if trick as above, for each question, and in label for each question set the variable for that question to 'true', e.g.

Code: Select all

$ q1asked = False
$ q2asked = False
$ q3asked = False
$ q4asked = False

menu:
    "question1?" if q1asked == False:
        jump q1
    "question2?" if q2asked == False:
        [...]

q1:
    $ q1asked = True
    [...]
Server error: user 'Jake' not found

User avatar
Deji
Cheer Idol; Not Great at Secret Identities
Posts: 1592
Joined: Sat Oct 20, 2007 7:38 pm
Projects: http://bit.ly/2lieZsA
Organization: Sakevisual, Apple Cider, Mystery Parfait
Tumblr: DejiNyucu
Deviantart: DejiNyucu
Location: Chile
Contact:

Re: Questions on choices and menues

#7 Post by Deji »

Thanks a lot =D!
in the end I made it like this:

Code: Select all

$ qmade = 0
$ q1asked = False
$ q2asked = False
$ q3asked = False
$ q4asked = False

label many_questions:
menu:
    "question1?" if q1asked == False:
        $ qmade +=1
        jump q1
    "question2?" if q2asked == False:
        [...]

q1:
    $ q1asked = True
    #lalala
    if qmade > 3:
         jump end_of_questions
    else:
         jump many_questions

    [...]
Image
Tumblr | Twitter
Forever busy :')
When drawing something, anything, USE REFERENCES!! Use your Google-fu!
Don't trust your memory, and don't blindly trust what others teach you either.
Research, observation, analysis, experimentation and practice are the key! (:

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Questions on choices and menues

#8 Post by monele »

Wasn't there a way to do that by providing an empty list that would fill automatically as you picked choices? I can't find it on the wiki o_O;...

chronoluminaire
Eileen-Class Veteran
Posts: 1153
Joined: Mon Jul 07, 2003 4:57 pm
Completed: Elven Relations, Cloud Fairy, When I Rule The World
Tumblr: alextfish
Skype: alextfish
Location: Cambridge, UK
Contact:

Re: Questions on choices and menues

#9 Post by chronoluminaire »

Yes, Elven Relations used this option. It doesn't appear to be documented on the The Ren'Py Language reference page, or anywhere else on the wiki.

The way to do it is to add a line saying "set variable_name" into your menu statement. You need to define the variable variable_name to be equal to [] before the menu happens. The code can look like this: (note the line "set talk_set" just after the "menu:" line)

Code: Select all

  $ talk_set = []
  jump talk_menu

label talk_menu:
  menu:
    set talk_set
    "Talk to A":
      jump A
    "Talk to B":
      jump B
    "Talk to C":
      jump C
  "That's all the talking for today."
  jump done

label A:
  "I have a conversation with A."
  jump talk_menu
label B:
  "I have a conversation with B."
  jump talk_menu
label C:
  "I have a conversation with C."
  jump talk_menu
label done:
  $ renpy.full_restart()
Of course, Deji's way still works, and although it's more code, it's also more flexible. There's nothing saying you have to use the set parameter; it just makes it simpler to do what you're after, if that's all you need.
I released 3 VNs, many moons ago: Elven Relations (IntRenAiMo 2007), When I Rule The World (NaNoRenO 2005), and Cloud Fairy (the Cute Light & Fluffy Project, 2009).
More recently I designed the board game Steam Works (published in 2015), available from a local gaming store near you!

User avatar
Deji
Cheer Idol; Not Great at Secret Identities
Posts: 1592
Joined: Sat Oct 20, 2007 7:38 pm
Projects: http://bit.ly/2lieZsA
Organization: Sakevisual, Apple Cider, Mystery Parfait
Tumblr: DejiNyucu
Deviantart: DejiNyucu
Location: Chile
Contact:

Re: Questions on choices and menues

#10 Post by Deji »

yay! thanks chronoluminaire =D
I think I'll end up using a combination of both, because I still need the counter for the questions asked for something else =3
Image
Tumblr | Twitter
Forever busy :')
When drawing something, anything, USE REFERENCES!! Use your Google-fu!
Don't trust your memory, and don't blindly trust what others teach you either.
Research, observation, analysis, experimentation and practice are the key! (:

Post Reply

Who is online

Users browsing this forum: No registered users