Persistent object's crashing

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
sashaaero
Regular
Posts: 45
Joined: Mon Jul 13, 2015 6:08 pm
Projects: Everlasting Cold
Organization: OverDream Development
Github: sashaaero
Skype: sashaaero
Contact:

Persistent object's crashing

#1 Post by sashaaero »

Sup.
I modified my save logic, and after it my persistent object do weird things as erasing all data in game.

In my save menu I have this action

Code: Select all

action [FileSave(load_number, page=load_page), SaveSettings(load_number, load_page)]
And the code is

Code: Select all

if not persistent.saves:
    persistent.saves = {}
        
class CurrentSave():
    def __init__(self):
        self.timeofday = persistent.timeofday
        self.sprite_time = persistent.sprite_time
        self.music = renpy.music.get_playing()
        
    def __eq__(self, cs):
        return (self.timeofday == cs.timeofday and
        self.sprite_time == cs.sprite_time and
        self.music == cs.music)
    
class SaveSettings(Action):
    def __init__(self, num, page):
        self.num = num + page * 10
        
    def __call__(self):
        return self.save(self.num)
        
    def save(self, num):
        persistent.saves[num] = CurrentSave()

Please help.

P.S.
I did __eq__ method cause renpy said that if object wants to store in persistent object - it needs a equanity method.

Post Reply

Who is online

Users browsing this forum: Google [Bot]