If statement not defined error

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
seafoamsky
Newbie
Posts: 6
Joined: Sun Jan 28, 2018 11:25 pm
Contact:

If statement not defined error

#1 Post by seafoamsky »

I'm trying to make an if statement so that a previous dialogue choice influences dialogue later in the game. However, I keep getting an error message that the first if statement has not been defined, and not the other two.

My original dialogue choice menu:

Code: Select all

menu:
    
    "Who ARE you people?!":
        jump whoARE
        
    "What was all that just now?":
        jump whatwasallthat
        
    "Were you talking about games to them just now?":
        jump talkingaboutgames
And the if statement I am attempting to make:

Code: Select all

    if whoARE:
        mc "{cps=20}What did Nene mean by you guys \"Looking for excitement in your lives\"? How do you do that with video games?"
        
    if whatwasallthat:
        mc "{cps=20}Nene said she was trying to persuade me for something earlier... Why exactly do you need more members for a video game club in a high school?"
        
    if talkingaboutgames:
        mc "{cps=20}Nene was acting kind of weird when I asked her if you guys were whispering about games earlier, said something about the best games in the world? And also, were you whispering about games earlier, or something else?" 
Please help soon if you can!

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3792
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: If statement not defined error

#2 Post by Imperf3kt »

If / else are for python use. What I think you want is a Ren'Py choice menu.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
seafoamsky
Newbie
Posts: 6
Joined: Sun Jan 28, 2018 11:25 pm
Contact:

Re: If statement not defined error

#3 Post by seafoamsky »

I'm not trying to make a choice menu, i'm trying to make it so the earlier choice will change the dialogue said in this particular part.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3792
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: If statement not defined error

#4 Post by Imperf3kt »

Same thing applies.

Try it like this:
Keep the top code and replace the 'if' in your bottom code with "label" - removing all indentation.

Or, add a "default" variable before the start label and change it using python.

Code: Select all

default my_variable = "none"
label start:
    menu:
    
        "Who ARE you people?!":
            $ my_variable = "who?"
            jump new_label
        
        "What was all that just now?":
            $ my_variable = "what?"
            jump new_label
        
        "Were you talking about games to them just now?":
            $ my_variable = "games"
            jump new_label

label new_label:
    "[my_variable]"
If this still isn't what you are after, you'll need to give a different example of what you want to accomplish.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
seafoamsky
Newbie
Posts: 6
Joined: Sun Jan 28, 2018 11:25 pm
Contact:

Re: If statement not defined error

#5 Post by seafoamsky »

Unfortunately, this is not quite what I needed, but I resolved the issue anyways. Thank you for pointing me in the right direction.

User avatar
DragonKnight
Regular
Posts: 51
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: If statement not defined error

#6 Post by DragonKnight »

scene cat2
with dissolve0
c "Just be true to yourself. But take it rather slow. It'll all work out."
if $ m_love >= 13:
c "Espically your wife"
i "What do you mean \"it'll all work out?\" How can I trust something that literally told me it was a hallucination?"
c "I don't know. You're the crazy one. Figure it out."
c "I'll see you again soon."
c "Maybe..."
Maybe you can solve this, I can get the if statement to work.
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3792
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: If statement not defined error

#7 Post by Imperf3kt »

Code: Select all

scene cat2
with dissolve0
    c "Just be true to yourself.  But take it rather slow.  It'll all work out."
    if m_love >= 13:
        c "Espically your wife"
    i "What do you mean \"it'll all work out?\"  How can I trust something that literally told me it was a hallucination?"
    c "I don't know.  You're the crazy one.  Figure it out."
    c "I'll see you again soon."
    c "Maybe..."
Maybe you can solve this, I can get the if statement to work.
You had a space in "with dissolve0"
You also don't need the $ when checking python variables.

You did "default" the variable before the start label, right?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
DragonKnight
Regular
Posts: 51
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: If statement not defined error

#8 Post by DragonKnight »

Thank you!!!
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

Post Reply

Who is online

Users browsing this forum: decocloud, DewyNebula