if statement being skipped in code

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
Roycesraphim
Newbie
Posts: 2
Joined: Sun Dec 10, 2017 10:30 am
Contact:

if statement being skipped in code

#1 Post by Roycesraphim »

Hello all, long time lurker posting a question for the first time.

Two women are having a conversation and PuCo is supposed to have different responses based on what order Zoya has told her story.

the variables for each story (Neela_comments_done and Cafe_story_done ) are set to false before this conversation ever takes place in the code.

If Zoya has told either the Neela story or Cafe story (both of which work without error), those variables would be set to true.

The problem I'm having is that this entire 'if statement' tree is being skipped, it just goes down to the "Z "So, I first found myself in the waterfront market, " portion

Code: Select all

label ShopMusicArc:
#Zoya hears the music

    PuCo "Did you say...music."

    Z "Music."

    Z "It ws a song from the beginning. That song was..."

    Z "It was old when I got it. Why someone would be playing it on the radio, I don't konw."

    PuCo "People like the classics. Soon we'll be the classics."

    PuCo "Then the re-release on laser disc with higher quality."

    Z "Some people would say we already are,  idiolized and repacked as some legend you can buy a collectino of tapes about."


    if Neela_comments_done == "false":

        if Cafe_story_done == "false":

            PuCo "So, music?"

            Z "Yes, I was just so furious and embarrassed and just....." 

            Z "...trying to get away from that everyone's stupid attitudes and...."

            Z "I felt so trapped. I didn't like that feeling." 

            jump ShopmusicStoryMarket

        elif Cafe_story_done == "true":

            PuCo "So, this came after the cafe, right?"

            Z "Yes, I was just so furious and embarrassed and just....." 

            Z "...wakling, running, trying to get away from Gaile and his questions...." 

            Z "and still that other thing."

            Z "I felt so trapped, like my friend pushed me in a box and Gaile closed the lid."

            Z " I felt weak, and needed to break out."

            jump ShopmusicStoryMarket

    elif Neela_comments_done == "true":

        if Cafe_story_done == "false":

            PuCo "So, this was at the end of the day?"

            Z "Yes, I was just so furious and embarrassed and just....." 

            Z "Neela knocked me off balance and someone else came and swept my feet out from under me."

            Z "I was overwhelmed and felt so weak at that point, that I just kept moving."

            jump ShopmusicStoryMarket

        if Cafe_story_done == "true":

            PuCo "So, this was the peak of your exhausting day?"

            Z "Yes, I was just so furious and embarrassed after deeling with Neela...." 

            Z "...and at that moment wakling, running, trying to get away from Gaile and his questions." 

            Z "I felt so trapped, like Neela pushed me into a pit and Gaile was peppering me with questions from up above."

            Z "Here I was powerless and desperate to get out, so I was running."

            jump ShopmusicStoryMarket

    else:

        if Cafe_story_done == "false" and Neela_comments_done == "false":

            PuCo "So, music?"

            Z "Yes, I was just so furious and embarrassed and just....." 

            Z "...trying to get away from that everyone's stupid attitudes and...."

            Z "I felt so trapped. I didn't like that feeling." 

            jump ShopmusicStoryMarket


label ShopmusicStoryMarket

    Z "So, I  first found myself in the waterfront market, and just ... drifting with the crowd.  Trying to soak up some positive energy and get centered again."


    $ Music_killer_done = True
    $ ThreeStory_Options -= 1
    jump Threestorymenu

I had the same problem when I wrote it out as

Code: Select all

if Cafe == true and Neela == True:
    W
 if cafe == false and Neela == true:
     X
 if cafe == false and Neela == false:
     Y
if cafe == true and Neela == false:
     Z

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2397
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: if statement being skipped in code

#2 Post by Ocelot »

Show, how do you set those variables. True, true and "true" are completely different.
< < insert Rick Cook quote here > >

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: if statement being skipped in code

#3 Post by Remix »

True ... a python boolean value ... can also be shortened to just "if cafe:"
true ... a variable or object reference (basically a name for an object in python). Using this probably raises an error that Ren'py silently bypasses.
"true" ... a string

I would advise using True and False (both with capital first letter)...

Code: Select all

var = False
if var: >>> test fail
if not var: >>> test pass
var = True
if var: >>> test pass
if not var: >>> test fail
Frameworks & Scriptlets:

Roycesraphim
Newbie
Posts: 2
Joined: Sun Dec 10, 2017 10:30 am
Contact:

Re: if statement being skipped in code

#4 Post by Roycesraphim »

Thank you! I did code them as false in the main script and wrote them as strings here!

That you!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot]