Lists are persistent?

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
User avatar
Evildumdum
Regular
Posts: 191
Joined: Sun Jan 18, 2015 8:49 am
Projects: ApoclypseZ
Contact:

Lists are persistent?

#1 Post by Evildumdum »

So i have a tile based battle engine, it runs on many many lists and works fine thus far.

One teensy weensy issue. All the lists seem to be persistent. If the player quits to main menu and starts a new game, instead of reverting to the lists set out in the init and init python blocks, they continue from the old playthrough.

My colleague who is working on the other half of the game tells me he is having a similar problem with all sorts of variables.

Any insight into this problem is greatly appreciated and any solutions sorely needed.

Thanks

Evildumdum
"If at first you don't succeed, try hitting it with a shoe."

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Lists are persistent?

#2 Post by papiersam »

All the lists seem to be persistent
Really? I wish that was the case way back when I was just beginning Renpy coding and needed to utilise persistent data.

That aside, I don't recall lists being persistent (under the assumption that 'persistent' means it saves without manually saving to file). Also;
My colleague who is working on the other half of the game tells me he is having a similar problem with all sorts of variables.
I'm thinking that maybe these lists/variables are associated with a class/object/type of data that Renpy saves, causing the issue. So, something like:

Code: Select all

$var = ['hamster', 'panda', 'phoenix']
should not be persistent, while:

Code: Select all

$persistent.var = ['hamster', 'panda', 'phoenix']
is.

Try deleting persistent data from the Renpy UI and testing it out, to get a clearer picture of what's going on.

Hope that helps.

User avatar
Evildumdum
Regular
Posts: 191
Joined: Sun Jan 18, 2015 8:49 am
Projects: ApoclypseZ
Contact:

Re: Lists are persistent?

#3 Post by Evildumdum »

Yes, Most of the lists contain class instances. Many many class instances. However the problem occurs when the game is not saved and a new game is initiated. The game on both my side and my colleagues is almost entirely run with the use of OOP.
"If at first you don't succeed, try hitting it with a shoe."

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Lists are persistent?

#4 Post by nyaatrap »

Code: Select all

 If the player quits to main menu and starts a new game, instead of reverting to the lists set out in the init and init python blocks, they continue from the old playthrough.
Yes. That's why there's the default statement and instruction that you have to instantiate objects after start/load.
You should code either of:
1. Instantiate objects directly after start, not only in init.
2. Use the default statement instead of init.

Post Reply

Who is online

Users browsing this forum: Google [Bot]