So far I only had instances of objects and got the saving work by deriving from store.object. But does this also work for static values which are not constants? I'm planning on making a static class because else only one instance would be needed and there would be several points where I would have to import it with global.
Or is it just a bad idea to operate with static classes in Ren'Py or Python?
saving static values/classes
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.
- Ayutac
- Regular
- Posts: 150
- Joined: Thu Oct 18, 2012 2:23 pm
- Projects: Pokémon Dating Sim
- Organization: A Breeze Of Science
- Deviantart: Ubro
- Location: Mayence, Germany
- Contact:
saving static values/classes
Up next: An original, open source, text-based Dating Sim. Stay tuned ;)
Re: saving static values/classes
It's not a very useful idea I expect, there is little to be gained by using using a static class in Python. If you decide to use one, make sure it is declared in a label, not init since it's values are not meant to be constants (they will be overwritten even if you inherit from store.object otherwise). So in short, in order to get variables in your static class to save you'll either have to declare it in in label or write a save/load function to store/load the data somewhere where it's safe.
I never tried this myself, but I do expect it to work like this.
I never tried this myself, but I do expect it to work like this.
Who is online
Users browsing this forum: Google [Bot], _ticlock_

