Error Issue: NameError: name '_' is 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
fatalblue
Newbie
Posts: 13
Joined: Wed Jul 27, 2011 9:50 pm
Contact:

Error Issue: NameError: name '_' is not defined

#1 Post by fatalblue »

I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/park.rpy", line 8, in script
if desk == "tae":
File "game/park.rpy", line 8, in python
if desk == "tae":
NameError: name 'desk' is not defined
This is an error I constantly see myself running into as i work on my game (something I've only been doing for like 2 or 3 week only so far, yes I am a super novice^^;;) I searched the forums extensively as well as reread the tutorial, wiki, ect, played w/ the indentation & tried various other things to see if I could figure what I'm doing wrong myself but I just haven't been able to so now I wish to ask you all, the experts what I'm I doing wrong? why I'm i getting this type of error?

Code: Select all

 menu:
        "yes":
            u "hello?"
        "no":
            $ desk = "tae"
            u "i'll just take it to the front desk" 
            jump mmenu

Code: Select all

if desk == "tae":
        u "*could the phone from the library be his?*"
        u "why don't you try the library?"
        t "huh? why?"
        menu:
            "I saw it":
                u "What does your phone look like?"
                t "It's a white samsung"
                u "I found a phone like that while at the libaray a while ago. I gave it to the front desk"
                t "The library! of course! come w/ me!"
                u "hay...wait....uwahh!!!"
                jump taem_date2
            "It's a hunch":
                u "It's just a hunch..."
                t "ah...okay I'll try that"
                if dress == "tm":
                    t "ah...okay I'll try that, thank you for helping me"
                    u "Hope he finds it..."
                jump mmenu
                
    else:
        t "*sigh* I'm sorry again, excuse me"
        u "poor dude..."
        u "maybe I should do something else"
        jump mmenu
ps: this isn't the only place I'm getting this name error exactly it's just this is the most recent one to pop up & I'm kinda at wits end. I figure if someone can clarify what I'm doing wrong here with just this one I can figure out how to work out the rest myself ^^;;

thanks in advance for any help

10kNing
Regular
Posts: 51
Joined: Fri Apr 29, 2011 9:37 pm
Projects: Revenance (RPG), Mad-Love (GxB, on hold)
Location: NYC
Contact:

Re: Error Issue: NameError: name '_' is not defined

#2 Post by 10kNing »

The variable "desk" is only defined if you pick "no," so put a "$ desk =" something in the part after the "yes" option~ It has to have been defined at least once before the thing can check if it's equivalent to anything!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], decocloud, Google [Bot]