name not defined

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
Destiny
Veteran
Posts: 468
Joined: Thu Jun 14, 2012 2:00 pm
Projects: Cards of Destiny, Sky Eye
Location: Germany
Contact:

name not defined

#1 Post by Destiny »

Error I get:
NameError: name 'park_1_done' is not defined

Place where the error happens:
if park_1_done == True:

Ergo what would be the initiallizing one to that?
$ park_1_done = False
at the beginning under Label start?
Something else?

(I swear, this all worked before Ren'Py updated?! xD")
Image
Cards of Destiny (WIP) / Sky Eye (WIP)

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: name not defined

#2 Post by SundownKid »

More like:

Code: Select all

init:
    $ park_1_done = False

User avatar
Destiny
Veteran
Posts: 468
Joined: Thu Jun 14, 2012 2:00 pm
Projects: Cards of Destiny, Sky Eye
Location: Germany
Contact:

Re: name not defined

#3 Post by Destiny »

Ok, worked, even though I have a big different problem right now .__.

The game now still doesn't like the variable, but instead of asking for a definition, it gives a error, then makes the game loop infinitely, followed by ignoring all input (I have a image map, but suddenly, all buttons go only to one spot):
Click for video (the loop is shown, not the "all buttons go to the same place")

The traceback of the error seen in the video is this:
traceback.txt
(965 Bytes) Downloaded 19 times
The exact spots of the code are:
536 till 555

Code: Select all

label example:
    
    call screen example_imagemap
    
    $ result = _return
    
    if result == "park":
        call park
    elif result == "untere_etage":
        call untere_etage
    elif result == "schwimmbad":
        call schwimmbad
    elif result == "dach":
        call dach
    elif result == "obere_etage":
        call obere_etage
    elif result == "sporthalle":
        call sporthalle
    elif result == "dereks_zimmer":
        call dereks_zimmer
and

label schule_3:

936 till 951

Code: Select all

scene bg zimmer abend
play music "Music/a - Mary - PeerGynt_Lobogris_-_You_Make_Me_Crazy__Jam_.mp3"
show m l
if sporthalle_2_done = True: 
        m b "It makes me so nervous to run."
        r s "I thought you were used to it?"
        m b "No, I\'m not used to being watched running by two good looking guys."
        r c s "................................"
        show r b
        extend "\nYou\'re talking garbage again."
        m l "Waah, you got bright red! \nCuuuuuuuuute!"
        r b "Ah, keep your mouth shut!"
        m l "Ok, ok."
        jump gespräch_2
My guess would be the following:
I have the image map 6 times (all sending to a different label, there are no problems at those spots as far as I can tell) and - upon returning - the supporting character (the female) reacts depending on where the character had been.
She will also react depending on if he had been there before or not (she will make a different notion, if it is park_done_2 = True then when it is park_done_1 = True)
My guess is, that the game is unable to cope with the fact, that "park_done_1 = True" appears six times in the script (as she can react to it six times)? o_o
Could that be a possible reason? If yes, what would be good to do to avoid this repeating session ._.
Image
Cards of Destiny (WIP) / Sky Eye (WIP)

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: name not defined

#4 Post by xela »

You post is too long and a bit confusing.

Code: Select all

if sporthalle_2_done = True:
This code is invalid, you also don't have to compare values to booleans in Python/Ren'Py script.

Code: Select all

if sporthalle_2_done:
or

Code: Select all

if not sporthalle_2_done: # If False
will do nicely.
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: Google [Bot]