AttributeError: ‘StoreModule’ object has no attribute ‘_history'

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
emz911
Regular
Posts: 103
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

AttributeError: ‘StoreModule’ object has no attribute ‘_history'

#1 Post by emz911 »

Hi all, two of my players have encountered this following error when loading (I believe mainly on and after Quick Load, which is activated by pressing the shortcut key “L”):
Error Screenshot
Error Screenshot
AttributeError: ‘StoreModule’ object has no attribute ‘_history'

I traced down to Line 156 in 00library.rpy but am not quite sure where this '_history' variable came from. Any clue? Help is very appreciated!
Last edited by emz911 on Mon Jan 13, 2020 8:20 pm, edited 1 time in total.

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: AttributeError: ‘StoreModule’ object has no attribute ‘_history”

#2 Post by IrinaLazareva »

It's hard to say without the code.
First, Check line 2363 of script.rpy (as well as the line above and the line below).
Also maybe you have variable with reserved name, for example, "extend"...

User avatar
emz911
Regular
Posts: 103
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: AttributeError: ‘StoreModule’ object has no attribute ‘_history”

#3 Post by emz911 »

IrinaLazareva wrote: Mon Jan 13, 2020 9:35 am It's hard to say without the code.
First, Check line 2363 of script.rpy (as well as the line above and the line below).
Also maybe you have variable with reserved name, for example, "extend"...
Line 2365 is a "show screen" statement and 2363 is a "call screen" statement which I use all the time, it just starts the simulation part of the game. I looked through the reserved name list and don't believe I used the same variable names...

More information:
They say they get this error when they S/L too many times (mostly quick save and quick load), and when they get this error, they can't continue the game even after ignoring it.
My only clue of what is triggering this error is that my game's first version included a long list of default variables, but those default variables led to bugs (for example, loading a game caused a default variable to reset), so I deleted these default variables afterwards and updated a new game version without them (now they're all defined under init with the same name). May this error be because those saves had the old default variables? But what does that have to do with new quick saves and new quick loads? I can't wrap my head around that and the "_history" attribute. Also, I tested the game out a lot of times after updating and deleting the default variables, no errors appeared, so I don't really expect the error to have to do with this, but this is the only thing I can think of. Perhaps this has nothing to do with it?

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: AttributeError: ‘StoreModule’ object has no attribute ‘_history'

#4 Post by gas »

You can retain variables after load...
https://www.renpy.org/doc/html/save_loa ... after-load
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
emz911
Regular
Posts: 103
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: AttributeError: ‘StoreModule’ object has no attribute ‘_history'

#5 Post by emz911 »

gas wrote: Tue Jan 14, 2020 2:17 am You can retain variables after load...
https://www.renpy.org/doc/html/save_loa ... after-load
Hi, I don’t quite understand how this function works... does this work like persistent values where a newly started game saves the value of the last played game? Or does it have to do with saving and loading different gameplays? If saving a save slot stores all variables already, what does this do? Would you mind explaining a bit more? Thanks!!

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: AttributeError: ‘StoreModule’ object has no attribute ‘_history'

#6 Post by gas »

Renpy saves are not exactly "freezes": they save "one step back in time", the last content of the rollback cache, and execute from that point onward when you load.
One thing that's not saved is the state of variables WHILE interacting with a screen (that's mean in the same "step" of the rollback cache).

You call the screen, you modify a variable, while you are in the screen you save. Well, that variable value is not saved. It will be saved after the screen (the next step in the rollback cache), not in the meanwhile.
That's why you've seen your defaults got a reset after loading.

Every time you call a screen that could change game data (more probably, when you call a screen that modify many things and imply many clicks), you should first call retain_after_load.
So the game save the state of such variables the very moment you save instead of using the last checkpoint status.
This is not a default behaviour for a lot of technical and design reasons.

Using 'default' declarations and retain after load should solve your first problem and very likely the second one too.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
emz911
Regular
Posts: 103
Joined: Fri Jun 23, 2017 2:23 pm
Contact:

Re: AttributeError: ‘StoreModule’ object has no attribute ‘_history'

#7 Post by emz911 »

gas wrote: Tue Jan 14, 2020 5:37 am Renpy saves are not exactly "freezes": they save "one step back in time", the last content of the rollback cache, and execute from that point onward when you load.
One thing that's not saved is the state of variables WHILE interacting with a screen (that's mean in the same "step" of the rollback cache).

You call the screen, you modify a variable, while you are in the screen you save. Well, that variable value is not saved. It will be saved after the screen (the next step in the rollback cache), not in the meanwhile.
That's why you've seen your defaults got a reset after loading.

Every time you call a screen that could change game data (more probably, when you call a screen that modify many things and imply many clicks), you should first call retain_after_load.
So the game save the state of such variables the very moment you save instead of using the last checkpoint status.
This is not a default behaviour for a lot of technical and design reasons.

Using 'default' declarations and retain after load should solve your first problem and very likely the second one too.
Wow, understood. I’ll go home and test this out! Thank you for the explanation!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Ocelot