Page 1 of 1

Menu Choices

Posted: Thu Apr 24, 2014 11:18 am
by TheOneAndOnly-K
Okay, I want to do two things with menu choices...

1. To move the menu choices up, so they're not running over my text box.
2. To make certain choices available if a path/gift is unlocked.

Eg: I have asked player to decide whether they wish to join school council or not. If they agree, I'd like to open a new option in the morning for them to 'visit the office', but not skip the time period doing so.

Re: Menu Choices

Posted: Thu Apr 24, 2014 11:42 am
by TheOneAndOnly-K
Bump...

Re: Menu Choices

Posted: Thu Apr 24, 2014 12:37 pm
by Showsni
To make a conditional menu choice, just use if. Let's say that earlier in the game players could choose to learn Spanish, which set a variable $ Spanish = True (and if they chose not to it's set to $ Spanish = False). Then your menu could read:

Code: Select all

"What shall I do today?"
menu:
    "Go shopping":
        ...
    "Stay at home":
        ...
    "Go to Spain" if Spanish:
        ...
Then the last option will only show up in the menu is Spanish is True.

Re: Menu Choices

Posted: Thu Apr 24, 2014 12:42 pm
by TheOneAndOnly-K
That's why it's not working.. I put the coding in backwards XD Thanks a lot~

Re: Menu Choices

Posted: Thu Apr 24, 2014 12:50 pm
by Alex
1. In screens.rpy

Code: Select all

screen choice:

    window: 
        style "menu_window"        
        xalign 0.5
        yalign 0.5      #<=== set it to 0.3 or so to move choice menu up (rest of the code unchanged)

Re: Menu Choices

Posted: Thu Apr 24, 2014 1:12 pm
by TheOneAndOnly-K
It works, but perhaps there's a way it wont cut into the text box...?

Re: Menu Choices

Posted: Thu Apr 24, 2014 1:48 pm
by TheOneAndOnly-K
Another question:

How would I write it if, as above it was

Code: Select all

menu:
       "Yadda" if ? == True:
but with two ?'s needed to be on.

Re: Menu Choices

Posted: Thu Apr 24, 2014 2:17 pm
by Alex
You can use boolean operations - https://docs.python.org/3/library/stdtypes.html

Code: Select all

menu:
       "Yadda" if var1 == True and var2 >= 5:
As for positioning choice menu, it's all up to you how to "design" it - if you really want to show 10 or more choices you could make a two-column choice menu or put it inside a viewport to let player scroll through it.
http://lemmasoft.renai.us/forums/viewto ... =8&t=16914
http://www.renpy.org/doc/html/screens.html#viewport

Re: Menu Choices

Posted: Thu Apr 24, 2014 2:19 pm
by TheOneAndOnly-K
Thank you!~

Re: Menu Choices

Posted: Thu Apr 24, 2014 7:59 pm
by TheOneAndOnly-K
Bump!

Question: If I have an 'if' command I want to run first, how do I make it run without turning the other commands off?

Re: Menu Choices

Posted: Fri Apr 25, 2014 2:17 pm
by Alex
It works like:
- do one of possible stuffs

Code: Select all

if var == value:
    do stuff
else:
    do other stuff
or

Code: Select all

if var == value:
    do stuff
elif var == value_2:
    do stuff_2
else:
    do other stuff
- or do each of stuffs if appropriate condition is true

Code: Select all

if var_1 == value_1:
    do stuff_1
if var_2 == value_2:
    do stuff_2
if var_3 == value_3:
    do stuff_3
http://www.renpy.org/doc/html/conditional.html