How do you make menu choices available with if statements?

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
User avatar
zoranac
Newbie
Posts: 11
Joined: Fri Aug 31, 2012 4:39 pm
Projects: Forest's Sorrow
Contact:

How do you make menu choices available with if statements?

#1 Post by zoranac »

I have a game that tracks the phone numbers of various girls and at this one point, gives the player a choice of which one to call.
the problem is this format of the code doesn't work. It complains about the "if" statement.

Code: Select all

menu:
            if knum == True:
                "Call Kyra":
                    jump callkyra
            if enum == True:
                "Call Emi":
                    jump callemi      
            if snum == True:
                "Call Skyler":
                    jump callskyler
            if fnum == True:
                "Call Faith":
                    jump callfaith   
            if rnum == True:
                "Call Rose":
                    jump callrose
I want to know if there is a way of doing this without listing all the possible combinations...

thanks

User avatar
Minnfae
Regular
Posts: 106
Joined: Mon Dec 07, 2009 5:01 am
Projects: Undecided
Contact:

Re: How do you make menu choices available with if statement

#2 Post by Minnfae »

You have to write the if statement after the choice.

Code: Select all

menu:
                "Call Kyra" if knum:
                    jump callkyra
                "Call Emi" if enum:
                    jump callemi      
                "Call Skyler" if snum:
                    jump callskyler
                "Call Faith" if fnum:
                    jump callfaith   
                "Call Rose" if rnum:
                    jump callrose
My avatar art is a freebie by SilverHyena. Thanks a lot!

User avatar
zoranac
Newbie
Posts: 11
Joined: Fri Aug 31, 2012 4:39 pm
Projects: Forest's Sorrow
Contact:

Re: How do you make menu choices available with if statement

#3 Post by zoranac »

I'll Try this out! Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users