EDIT: searching the forum some more, I found this thread
http://lemmasoft.renai.us/forums/viewto ... f=8&t=4894 which explains the complexities of dealing with objects being saved, loaded and/or rollbacked.
So... I'll probably have to discard my object-centric idea and go back to handle 50+ variables and repeat 10 times about 10 lines of code instead of the 10 objects with 5 attributes each and one function that I wanted >:
Oh well ^^;
-------------------------------------
I'm having problems with this myself ):
I tried using what Spiky suggested, but it doesn't really work
I looked for store.variable_name but I'm not sure how to apply it in my case D: (I thought about using store.self.attribute, but that doens't work, of course ^^; )
If I have something like:
Code: Select all
init python:
class AnObject(store.object):
def __init__(self, name):
self.name = name
#values the object is initialized with
self.att1, self.att2, self.att3 = "a", "b", "c"
def setPredef(self,predef):
if predef== "d":
self.att2, self.att3 = "d","d"
elif predef == "e":
self.att2, self.att3 = "e","e"
def changeElem(self,element,variation):
if element == "att1":
self.att1 = variation
elif element == "att2":
self.att2 = variation
elif element == "att3":
self.att3 = variation
And then I have...
Code: Select all
init:
$Object1 = AnObject("object1")
# The game starts here.
label start:
"Objects 1's att1 is [Object1.att1] (which should be -a-)"
$Object1.changeElem("att1", "lalala")
"Hmm."
"I'll save now. I changed Object1's att1 two lines ago and it should be \"lalala\"... and it actually is [Object1.att1]"
if Object1.att1 == "bluhbluh":
jump bluhbluh
elif Object1.att1 == "a":
jump ifa
label later:
"Now I'll change it to \"bluhbluh\"."
$Object1.changeElem("att1", "bluhbluh")
"Now try going back via rollback or loading the save and see what happens!"
jump end
label bluhbluh:
"Bluhbluh? Seriously? D:"
jump the_end
label ifa:
"Uhm... a? Shouldn't it be "lalala"?"
jump the_end
label the_end:
"The end!"
$renpy.full_restart()
So... I reach bluhbluh if, after reaching the change, I rollback or load the previously saved game at the beginning.
And I reach ifa if, upon restarting the game, I load the game from the main menu.
I have many objects that actually display things on the screen, so this behavior is a real trouble for me right now @_@
When drawing something, anything, USE REFERENCES!! Use your Google-fu!
Don't trust your memory, and don't blindly trust what others teach you either.
Research, observation, analysis, experimentation and practice are the key! (: