true/false statement 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
cloudyssky
Veteran
Posts: 258
Joined: Mon May 17, 2010 2:09 pm
Completed: Alone
Projects: Many failed ones
Location: Massachusetts
Contact:

true/false statement error

#1 Post by cloudyssky »

So I've been looking at this and can't seem to pinpoint what I've done wrong. First off here's the code:

Code: Select all

##blah blah
   $ upstairs_done = False
    label kitchen:
        #imagemap statement
        #a long "if result ==" statement goes here
        elif result == "Upstairs":
            if upstairs_done == False:
                $upstairs_done == True
                jump upstairs
            if upstairs_done == True:
            #scene changes
                jump bedroom
            else:
            #scene changes
                jump bedroom

#more stuff

label upstairs:
#scene changes
        jump bedroom

label bedroom:
#the bedroom then eventually can lead back to the kitchen to do everything again

Here's the issue: When the user is playing, once they go upstairs for the first time they go directly to "label upstairs" (which is supposed to happen). Once that is done, the user can return to the kitchen and then go upstairs again. What should happen then after the user has already been upstairs, is the user should skip over "label upstairs" and be taken directly to "label bedroom", but instead the user is being taken through "label upstairs" again and not going directly to "label bedroom". What's causing this?

P.S: I added the "else" statement to see if that would fix it, but it didn't work.
Projects:
Alone- (Horror/Sci-Fi) Complete! Link
Demokratiya- (Adventure/Action) I'm kind of winging it with this one. Goal is 100,000 words. Yeah, it's gonna take a while.
{Last worked on Sept/28 : Word count (coding and all) ~4500}

LordShiranai
Regular
Posts: 188
Joined: Wed Jul 07, 2010 5:49 pm
Completed: Mobile Food Madness, Super Otome Quest
Location: Pacific Northwest
Contact:

Re: true/false statement error

#2 Post by LordShiranai »

Your issue may be here:

Code: Select all

            if upstairs_done == False:
                $upstairs_done == True
It seems like you're trying to set upstairs_done to True here, but instead are doing a boolean evaluation using ==, which won't change the value of upstairs_done. You'd want to change this to =
Don't Blame Me. I Voted for Vermin Supreme.

cloudyssky
Veteran
Posts: 258
Joined: Mon May 17, 2010 2:09 pm
Completed: Alone
Projects: Many failed ones
Location: Massachusetts
Contact:

Re: true/false statement error

#3 Post by cloudyssky »

I knew it had to be something small I was missing! Can't believe I missed that! Thank you :]
Projects:
Alone- (Horror/Sci-Fi) Complete! Link
Demokratiya- (Adventure/Action) I'm kind of winging it with this one. Goal is 100,000 words. Yeah, it's gonna take a while.
{Last worked on Sept/28 : Word count (coding and all) ~4500}

Post Reply

Who is online

Users browsing this forum: Bing [Bot], DewyNebula