Hi all,
I'm not really getting what's happening but basically, I'm getting array values that I didn't append into the code yet when I load a save data.
This is my code:
init python:
array = [ ]
# The game starts here.
label start:
"this is an array test"
$ array.append("string")
"now array has string [array]" #It prints string,string2,string when I reload the file saved at the dialog line "this is an array test" even though I didn't put string 2 in yet
$ array.append("string2")
So for some reason, when I save the game say like at the dialog line "this is an array test", I'm getting the error where the array will string2 already in there when I get to the line to print the array strings even though I didn't reach that line yet to append 'string2' into the code? Can anyone help me explain what's going on and if there's a way so that when I load the game say at "now array has string [array]" it won't contain string2 in there?
Thanks in advance!
Persistent Array data?
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 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.
-
- Regular
- Posts: 51
- Joined: Tue Aug 23, 2011 10:19 am
- Contact:
Persistent Array data?
I have returned after a long time away. Working on a small project, hope I'll be able to show it on here soon! =D
- nyaatrap
- Crawling Chaos
- Posts: 1824
- Joined: Mon Feb 13, 2012 5:37 am
- Location: Kimashi Tower, Japan
- Contact:
Re: Persistent Array data?
Use default http://www.renpy.org/doc/html/python.ht ... -statement
The reason is explained here http://www.renpy.org/doc/html/save_load_rollback.html
The reason is explained here http://www.renpy.org/doc/html/save_load_rollback.html
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Persistent Array data?
Note: default only works with renpy 6.99.4, which is still in pre-release.
So if you aren't using 6.99.4 yet, declare you array inside the start block.
So if you aren't using 6.99.4 yet, declare you array inside the start block.
Code: Select all
label start:
$ array = []
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
- nyaatrap
- Crawling Chaos
- Posts: 1824
- Joined: Mon Feb 13, 2012 5:37 am
- Location: Kimashi Tower, Japan
- Contact:
Re: Persistent Array data?
Oh I thought it's already released because it's written in the document.trooper6 wrote:Note: default only works with renpy 6.99.4, which is still in pre-release.
-
- Regular
- Posts: 51
- Joined: Tue Aug 23, 2011 10:19 am
- Contact:
Re: Persistent Array data?
I declared it in the start block and it's working now, thank you very much!
I have returned after a long time away. Working on a small project, hope I'll be able to show it on here soon! =D
Who is online
Users browsing this forum: No registered users