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.
This is probably a silly question but I couldn't find enough information on other posts or Google that helped me. I'm having a hard time referencing external variables in python functions or definitions. If I have it declared on the same page, it's fine but if it's not on the same page, the game will tell me it doesn't exist. An example:
something like this would work but if default my_variable was on another .rpy page and the def print_myvar on another, it doesn't work. Do I use global? I'm not 100% versed on mixing python with ren'py language and how they interact but I need my_variable to be as global as possible because it is editable by the user and used in multiple places/functions/etc
When creating your own classes or functions, it is its own scope. So if you want to do something with a variable in that class or function, you have to either: 1) pass the variable in, 2) having that variable be global, or 3) use your own local variable.
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?)