I'm using persistent data to store several values on my game.
On my computer the code using persistent data works fine but when I distribute the game and play it on another computer I get an error 'NoneType' object has not attribute '__getitem__'.
It seems the persistent data is not being initialized or something...?
Any tips?
[solved] Persistent Data
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.
[solved] Persistent Data
Last edited by Kaen on Sat Aug 16, 2014 6:54 pm, edited 1 time in total.
Re: Persistent Data
Looks like, you need to set the default value for this kind of variable before checking or using its value (like for normal variable). Should look likeIn this case the default value will be set only if no value was set at all.
Code: Select all
init:
if not persistent.my_var:
$ persistent.my_var = some_value
Re: Persistent Data
Humm thank you Alex I'll try that.
@edit
The sugestion resolved the problem!
@edit
The sugestion resolved the problem!
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]