Problem with defining.
Problem with defining.
Hello. I got a problem. I've been writing my game and I added $ Christ_pts = 0 The engine does not see it and says "Christ_pts" is not defined. What am I doing wrong? PS. Spelling is correct, and all of the $s are in the same vertical line, and the rest works.
-
- Regular
- Posts: 169
- Joined: Sun Jun 04, 2017 12:05 pm
- Completed: Too many, check signature
- Deviantart: mikolajspy
- Location: Wrocław, Poland
- Contact:
Re: Problem with defining.
You need to add
somewhere (for example at the top of script.rpy), and when you want to change it, then:
https://www.renpy.org/doc/html/python.h ... -statement
PS: I think that questions like these should be in "Questions and Annoucments" section of forum.
Code: Select all
default Christ_pts = 0
Code: Select all
$ Christ_pts += 1 #adds 1 to variable
PS: I think that questions like these should be in "Questions and Annoucments" section of forum.
Re: Problem with defining.
Thank you, everything works now.
- SypherZent
- Veteran
- Posts: 362
- Joined: Fri Sep 02, 2016 3:14 am
- Completed: Multiverse Heroes, Space Hamster in Turmoil
- Location: Puerto Rico
- Contact:
Re: Problem with defining.
The Ren'Py engine used to allow the methodology of
1) define variable prior to label start
2) at label start, changing the variable causes the engine to internally recognize it
^ This methodology no longer works since Ren'Py v6.99.13 for me.
Is this intended, or is this a bug in Ren'Py new version?
Should it be absolutely necessary to use default from now on, as define no longer works as it used to? I have been searching documentation but it doesn't seem like "default" is support to eliminate the old usage of "define" to create variables. I'm having odd behavior with this one. I can switch to "default" and it will work, but this seems like unintended functionality (the old method breaking), and I figured I'd ask if it is intentional or not, that the old method broke?
Thanks.
1) define variable prior to label start
2) at label start, changing the variable causes the engine to internally recognize it
^ This methodology no longer works since Ren'Py v6.99.13 for me.
Is this intended, or is this a bug in Ren'Py new version?
Should it be absolutely necessary to use default from now on, as define no longer works as it used to? I have been searching documentation but it doesn't seem like "default" is support to eliminate the old usage of "define" to create variables. I'm having odd behavior with this one. I can switch to "default" and it will work, but this seems like unintended functionality (the old method breaking), and I figured I'd ask if it is intentional or not, that the old method broke?
Thanks.
Last edited by SypherZent on Thu Dec 07, 2017 9:48 am, edited 1 time in total.
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Problem with defining.
According to PyTom in this thread here: viewtopic.php?p=464232#p464232
You should use default for variables that change, and reserve define that things that won’t change like image definitions or character definitions.
You should use default for variables that change, and reserve define that things that won’t change like image definitions or character definitions.
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
*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
- SypherZent
- Veteran
- Posts: 362
- Joined: Fri Sep 02, 2016 3:14 am
- Completed: Multiverse Heroes, Space Hamster in Turmoil
- Location: Puerto Rico
- Contact:
Re: Problem with defining.
Oh, I had not seen that. Thanks for sharing, trooper6!
That helps a ton!
That helps a ton!
Creator of Multiverse Heroes & Space Hamster in Turmoil
Want me to code your game?
Check my services thread!
Want me to code your game?
Check my services thread!
Who is online
Users browsing this forum: No registered users