Page 1 of 1

conditionally show a menu item?

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

Re: conditionally show a menu item?

Posted: Sat May 28, 2011 4:21 am
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."

Re: conditionally show a menu item?

Posted: Mon May 30, 2011 1:19 am
by niuzeta
thank you. that reference page is quite helpful.