I used to work with Java (for a bit, I'm not an advanced programmer or anything like that, but I do know quite a bit) and there was a "variable" of sorts called arrays. I know I can make them on ren'py, however I can't figure out how to change what is stored in the "compartments" or add new ones. I'm fine with not being able to add new sections (I can deal with that) however I need to be able to change what it stored.
If you know how, please tell me! I would love to be able to use this feature properly (because I have long lists of variables, and having it stored in one place would be much easier for me)!
If you know this cannot be done, also tell me.
Thank you!
-Llunet
Arrays/Lists - How to add and change stored data (Solved)
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.
- Llunet1
- Regular
- Posts: 55
- Joined: Mon Oct 21, 2013 8:56 pm
- Projects: Reminiscence, Blood
- Deviantart: llunet1
- Location: USA
- Contact:
Arrays/Lists - How to add and change stored data (Solved)
Last edited by Llunet1 on Tue Jun 24, 2014 2:46 am, edited 1 time in total.
- Llunet1
- Regular
- Posts: 55
- Joined: Mon Oct 21, 2013 8:56 pm
- Projects: Reminiscence, Blood
- Deviantart: llunet1
- Location: USA
- Contact:
Re: Arrays/Lists - How to add and change stored data (Unsolv
That link is only for sorting data... (Unless I'm totally blind and missing something)
I want to be able to change what is written in my list.
Just like:
I am able to change the variable later on... however I can't seem to be able to change for example...
Or something like that. (I thought it would be changed by doing that, which it didn't work.)
^^; However, thank you for replying.
I want to be able to change what is written in my list.
Just like:
Code: Select all
$ x = "Something"
$ x = "Something Else"
Code: Select all
$ list = ["1", "2", "3"]
$ list[0] = "3"
^^; However, thank you for replying.
Last edited by Llunet1 on Tue Jun 24, 2014 2:47 am, edited 1 time in total.
- Llunet1
- Regular
- Posts: 55
- Joined: Mon Oct 21, 2013 8:56 pm
- Projects: Reminiscence, Blood
- Deviantart: llunet1
- Location: USA
- Contact:
Re: Arrays/Lists - How to add and change stored data (Unsolv
Wait. WHOOPS.
I realized my mistake in the code.
I put two equal signs instead of one. WOW.
It works now.
Sorry ^^;
I realized my mistake in the code.
I put two equal signs instead of one. WOW.
It works now.
Sorry ^^;
Re: Arrays/Lists - How to add and change stored data (Unsolv
Glad you figured it out but if you ever get stuck again:
You can read everything about lists in Python documentation or tutorials.
Code: Select all
>>> l = list()
>>> l.append(1)
>>> l.append(2)
>>> l
[1, 2]
>>> l[0] = 100
>>> l
[100, 2]
>>> for i, v in enumerate(l):
if v == 2:
l[i] = 200
>>> l
[100, 200]
>>>
- netravelr
- Miko-Class Veteran
- Posts: 504
- Joined: Thu Jan 28, 2010 2:31 am
- Completed: Culina: Hands in the Kitchen, Culina: The Spirit of Cooking, Saving Zoey
- Projects: Love at the Laundromat
- Organization: Lakeview Interactive
- Deviantart: netravelr
- Location: USA
- Contact:
Re: Arrays/Lists - How to add and change stored data (Unsolv
Glad to hear everything's better! If your problem is solved, I think it'd be a good idea to change the subject line.
Technical Designer/Programmer
Game Design Portfolio - Project updates on my Twitter
Experienced in: C/C++/C#, Python, Unreal, Unity, and Flash
_________________
"Space can be very lonely. The greatest adventure is having someone share it with you."
- Llunet1
- Regular
- Posts: 55
- Joined: Mon Oct 21, 2013 8:56 pm
- Projects: Reminiscence, Blood
- Deviantart: llunet1
- Location: USA
- Contact:
Re: Arrays/Lists - How to add and change stored data (Unsolv
Yes, sorry. I forgot about that and just changed it now ^^;netravelr wrote:Glad to hear everything's better! If your problem is solved, I think it'd be a good idea to change the subject line.
Who is online
Users browsing this forum: Google [Bot]