Save list problem

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
Uchiha Echinox
Newbie
Posts: 14
Joined: Fri Feb 13, 2015 9:17 am
Contact:

Save list problem

#1 Post by Uchiha Echinox » Sun Jun 04, 2017 5:38 pm

how to make renpy save data from list?
Ex:
list = [0,1,2,3]
Now if a change list [0] = 3 and save. After i exit the game and load the save file, list [0] will be equal with 0 not 3, way?
And how to save a list after i change the value?

User avatar
PyTom
Ren'Py Creator
Posts: 15669
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Save list problem

#2 Post by PyTom » Tue Jun 06, 2017 5:25 pm

You can't create it in an init block. Also, list is a reserved name. But if you do:

Code: Select all

default my_list = [ 0, 1, 2, 3 ]
And later on:

Code: Select all

$ my_list[0] = 3
It'll just work.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Uchiha Echinox
Newbie
Posts: 14
Joined: Fri Feb 13, 2015 9:17 am
Contact:

Re: Save list problem

#3 Post by Uchiha Echinox » Thu Jun 08, 2017 4:22 pm

Thx

Post Reply

Who is online

Users browsing this forum: Google [Bot]