if statement help

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
wolf_lover92
Newbie
Posts: 11
Joined: Tue Mar 29, 2011 6:43 pm
Contact:

if statement help

#1 Post by wolf_lover92 » Sat Jul 09, 2011 2:26 pm

so, what I want to do is if the player chooses a previous option, a line of dialogue will show up later- easy right?
well, i have three different scenarios in which a line may or may not show up in the same place as the other 2 scenario's lines. I want it so that if, by chance, the player chooses all three connected answers, all three lines will show up.
here's my script:

Code: Select all

    
label home:
    a "What a long day! I'm glad to be home."
    "I set my backpack down on the bench as usual, and scratch Tanner under the chin."
    "..."
    if meeting == "love_a":
        "I can't help but think of Aaron... I can't believe he stayed with me all that time even though he had places to be."

    if meeting == "love_m":
        "Thinking of Mamoru makes me glad, too. I still wonder why he ran off like that, though..."

    if meeting == "love_b":
        "Then Blaine runs through my mind. That rugged kindness like unpolished tigerseye..."
    
    a "This is going to be much harder than I expected..."
    "What should I do before I go to bed?"
    

User avatar
Alex
Lemma-Class Veteran
Posts: 2490
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: if statement help

#2 Post by Alex » Sat Jul 09, 2011 2:35 pm

You see, you have "meeting" variable and you can change its value, but it would have only one value. Try to use 3 different variables to check if a text line should be shown or not.

Code: Select all

label start:
    $ love_a = False
    $ love_m = False
    $ love_b = False
    # some code, where you set one or more of this vars to "True"
    
    if love_a:
        "I can't help but think of Aaron... I can't believe he stayed with me all that time even though he had places to be."

    if love_m:
        "Thinking of Mamoru makes me glad, too. I still wonder why he ran off like that, though..."

    if love_b:
        "Then Blaine runs through my mind. That rugged kindness like unpolished tigerseye..."

wolf_lover92
Newbie
Posts: 11
Joined: Tue Mar 29, 2011 6:43 pm
Contact:

Re: if statement help

#3 Post by wolf_lover92 » Sat Jul 09, 2011 2:52 pm

worked like a charm- thanks!
thats what I get for trying to overcomplicate things, i guess :oops:

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]