Page 1 of 1

[Solved] Remembering choices not working

Posted: Fri Jul 28, 2017 9:22 am
by Hollace
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

Re: Remembering choices not working

Posted: Fri Jul 28, 2017 10:20 am
by Milkymalk
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.

Re: Remembering choices not working

Posted: Sun Jul 30, 2017 7:07 am
by Hollace
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!