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 » Sat May 28, 2011 12:19 am

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?

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

Re: conditionally show a menu item?

#2 Post by denzil » Sat May 28, 2011 4:21 am

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 » Mon May 30, 2011 1:19 am

thank you. that reference page is quite helpful.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]