[Solved] Remembering choices not working

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
Hollace
Newbie
Posts: 13
Joined: Sat Jul 01, 2017 7:27 am
Deviantart: HollaceDay
Contact:

[Solved] Remembering choices not working

#1 Post by Hollace » Fri Jul 28, 2017 9:22 am

I've been trying to make my game really broad with a lot of endings with it. The only struggle I am having with this right now is that it doesn't wanna remember user choices like it should. I've searched up plenty of things on how to get it to work, but it just won't do the trick. Currently I got these codes (in order):

Code: Select all

 "Through mating calls and dancing rituals.":
            
            $ Kimya_Lunch = True
            hide kimya tearing up aws
            hide alfred angry aws
            show kimya surprised aws at left
            show alfred normal aws at right
            stop music fadeout 3.0

Code: Select all

$ Cafeteria_Task = True
    
    NA "Your teacher let you off earlier so you'd be on time for preparing in the cafeteria."
    
    scene bg cafeteria with fade
    
    NA "You step into the cafeteria... huh..."
    
    NA "There seems to be no one th--"

    LI "Hey! Sweeetieee over hereee!~"
    
    NA "You turn to where the voice is coming from."

Code: Select all

    if Kimya_Lunch:
        
        NA "You walk into the very busy cafeteria and take a seat somewhere in the back."
        
        NA "You notice Kimya looking around as if she's lost."
        
        menu:
            
            "Call for her":
                
                "lol i'll write this once im done with the normal run"
                
            "Give her the finger.": 
                
                NA "You give Kimya the finger when she turned and noticed you."
                
                NA "She looks really confused and on the edge of crying as she walks away to sit alone."

    else:
        
        if Cafeteria_Task:
            
            NA "You were playing on your phone as people were storming into the cafeteria."
           
        else:
            
            NA "You walk into the very busy cafeteria and take a seat somewhere in the back."
and here is the traceback:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 1473, in script
    
  File "game/script.rpy", line 1473, in <module>
    
NameError: name 'Kimya_Lunch' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 1473, in script
    
  File "C:\Program Files\renpy-6.99.12.4-sdk\renpy\ast.py", line 1656, in execute
    if renpy.python.py_eval(condition):
  File "C:\Program Files\renpy-6.99.12.4-sdk\renpy\python.py", line 1749, in py_eval
    return py_eval_bytecode(code, globals, locals)
  File "C:\Program Files\renpy-6.99.12.4-sdk\renpy\python.py", line 1743, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/script.rpy", line 1473, in <module>
    
NameError: name 'Kimya_Lunch' is not defined

Windows-7-6.1.7601-SP1
Ren'Py 6.99.12.4.2187
Axiom High 1.0
Last edited by Hollace on Sun Jul 30, 2017 7:07 am, edited 1 time in total.
I'm a freelance 2D character artist, check out my works on the websites listed here:
https://linktr.ee/HollaceDay

User avatar
Milkymalk
Miko-Class Veteran
Posts: 747
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Remembering choices not working

#2 Post by Milkymalk » Fri Jul 28, 2017 10:20 am

If Kimya_Lunch is not set to True, it is not automatically False. You have to set a variable to SOMETHING before you are allowed to check it.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Hollace
Newbie
Posts: 13
Joined: Sat Jul 01, 2017 7:27 am
Deviantart: HollaceDay
Contact:

Re: Remembering choices not working

#3 Post by Hollace » Sun Jul 30, 2017 7:07 am

Milkymalk wrote:
Fri Jul 28, 2017 10:20 am
If Kimya_Lunch is not set to True, it is not automatically False. You have to set a variable to SOMETHING before you are allowed to check it.
I had to think for a little on what you meant, but now I notice what I was doing wrong, oh how embarrassing :oops: thank you for helping out!
I'm a freelance 2D character artist, check out my works on the websites listed here:
https://linktr.ee/HollaceDay

Post Reply

Who is online

Users browsing this forum: Google [Bot]