image not defined even if it is 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
glithch
Regular
Posts: 93
Joined: Sat Jul 23, 2016 5:32 am
Contact:

image not defined even if it is defined??

#1 Post by glithch »

god, i might have to start sleeping on this forum.
sorry for getting on here wih such simple questions. i seem to understand harder stuff, its just the stuff that should work dont work xd
so ok im getting the error

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00start.rpy", line 218, in script call
    python:
  File "renpy/common/00start.rpy", line 85, in script call
    python hide:
  File "renpy/common/00start.rpy", line 85, in script call
    python hide:
  File "renpy/common/00start.rpy", line 85, in script call
    python hide:
  File "renpy/common/00start.rpy", line 85, in script call
    python hide:
  File "game/script.rpy", line 229, in script
    menu:
  File "game/script.rpy", line 230, in <module>
    "both of you wear black!" if black_done == False:
NameError: name 'black_done' is not defined

this is how my code looks

Code: Select all

        r "uh, i dont know"
        $ black_done = False
        $ touchy_done = False
        $ het_done = False
label reason_choice:  
        r "for real, why did you think we are together?"  
        menu:
            "both of you wear black!" if black_done == False:
              $ black_done = True
              jump black
            "she super touchy with you!" if touchy_done == False:
              $ touchy_done = True
              jump touchy
            "i dont know! you are a boy and shes a girl!" if het_done == False:
                $ het_done = True
                jump het
why is it telling me that black_done is not defined when it is defined???
and it doesnt have trouble with any of the other (...)_done
i tried just deleting the black_done and the rest works fine, but i need that?

edit: ok so im looking now and the rest of the commands dont work either. so there must have been something wrong with the definition even if i cant see what

User avatar
78909087
Veteran
Posts: 277
Joined: Sat Aug 16, 2014 2:33 pm
Completed: Dungeons and Don't Do It, Wake Up
Projects: Lethe
IRC Nick: Pacermist
Contact:

Re: image not defined even if it is defined??

#2 Post by 78909087 »

Have you defined the python variables in an init?
I am not friends with the sun.
Image

glithch
Regular
Posts: 93
Joined: Sat Jul 23, 2016 5:32 am
Contact:

Re: image not defined even if it is defined??

#3 Post by glithch »

78909087 wrote:Have you defined the python variables in an init?
umm not sure what is init
i wrote this

Code: Select all

$ black_done = False
        $ touchy_done = False
        $ het_done = False
at the top

edit: ok i looked around and figured it out x-x
its weird because neither the tutorial nor the wiki entry about choices like that mentioned init.
but i got it thank you!

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: image not defined even if it is defined??

#4 Post by trooper6 »

Current best practices is not to define your variables in an init, but to use the default statement like so:

Code: Select all

default black_done = False
default touchy_done = False
default het_done = False

label start:
    "blah blah blah"
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
78909087
Veteran
Posts: 277
Joined: Sat Aug 16, 2014 2:33 pm
Completed: Dungeons and Don't Do It, Wake Up
Projects: Lethe
IRC Nick: Pacermist
Contact:

Re: image not defined even if it is defined??

#5 Post by 78909087 »

trooper6 wrote:Current best practices is not to define your variables in an init.
Jeez I keep forgetting this... Old habits die hard.
I am not friends with the sun.
Image

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: image not defined even if it is defined??

#6 Post by trooper6 »

78909087 wrote:
trooper6 wrote:Current best practices is not to define your variables in an init.
Jeez I keep forgetting this... Old habits die hard.
I like the way the new default works, and I like it aesthetically on the page...so I'm happy to bring it up. Also, the new using define for persistent variables...so nice!
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

glithch
Regular
Posts: 93
Joined: Sat Jul 23, 2016 5:32 am
Contact:

Re: image not defined even if it is defined??

#7 Post by glithch »

trooper6 wrote:Current best practices is not to define your variables in an init, but to use the default statement like so:

Code: Select all

default black_done = False
default touchy_done = False
default het_done = False

label start:
    "blah blah blah"
oh! i like that more. ill make sure to use it next time. at this point it would be too much messing around to change it

Post Reply

Who is online

Users browsing this forum: No registered users