conditionally show a menu item?

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
niuzeta
Newbie
Posts: 6
Joined: Wed May 25, 2011 2:16 am
Contact:

conditionally show a menu item?

#1 Post by niuzeta »

To simulate a conversation I am trying to invoke a new menu item as one gets more information.

I have tried numerous attempts but I cannot seem to find a simple way to do this. (either code becomes spaghetti or unnecessarily long)

I was thinking of something like;

Code: Select all


$knowledge = 0
menu conversation:
 if knowledge > 0 && knowledge < 2:
  "I know this"
  $ knowledge += 1
  jump conversation
 
etc etc

is there a way to incorporate the presence of certain menu items using python boolean expressions?

denzil
Veteran
Posts: 293
Joined: Wed Apr 20, 2005 4:01 pm
Contact:

Re: conditionally show a menu item?

#2 Post by denzil »

Yes, there is way to show menu choices conditionally, it's nicely documented in the old wiki: http://www.renpy.org/wiki/renpy/doc/ref ... _Statement

Example from the wiki:

Code: Select all

menu what_to_do:
    "Go to the beach." if have_swimsuits:
        "We went to the beach together. I got to see the girls in their
         new swimsuits."
Practice makes purrrfect.
Finished projects: Broken sky .:. colorless day .:. and few more...

niuzeta
Newbie
Posts: 6
Joined: Wed May 25, 2011 2:16 am
Contact:

Re: conditionally show a menu item?

#3 Post by niuzeta »

thank you. that reference page is quite helpful.

Post Reply

Who is online

Users browsing this forum: Exiscoming