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.
I lately noticed, that dict-variables inside of Ren'Py aren't ordered as they are in Python at least, they don't seem to work as they should. I've written a little game editor in Python (Python 3.10) that is using json files to exchange data between the editor and the Ren'Py game. To read the data in RenPy I am using json.loads which doesn't seem to have any problem. The problem only occurs when I read the dict with a loop something like:
python:
for i in dictTypeVar:
renpy.say(None, "element: [i])
I get it in a random order.
I also tried to check if the dict type inside of Ren'Py would be the problem or the json.reads but I couldn't even create a dict inside of Ren'Py instead of a dict I get a <class 'renpy.python.RevertableDict'> which also isn't ordered, so I am a bit clueless here. Is the only way really that I number and sort the dict inside of Ren'Py, because in Python it doesn't seem to have any problem to be given out in the same order as it got created?
Last edited by felsenstern on Fri Nov 26, 2021 4:18 am, edited 1 time in total.
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it
Ren'Py currently runs using Python 2.7 internally, and the Python 3.x implementation has been ongoing for a while if I understand correctly. Until that support is part of the main Ren'Py release, it's best to treat Python statements in Ren'Py as a hybrid of the two and try to use Python that works in both. Since ordered dicts are part of Python 3.x, Ren'Py doesn't natively support them yet.
Main Website
Includes information about and links to many of my current and past projects.
Major Game Projects
[Nightshade] Eldritch Academy, Eldritch University, Blooming Nightshade, Flowering Nightshade, Life as Designed
[Team Despair] Corpse Party D2 series
---
Yes, I've Read The F*cking Manual
Yes, I've used the f*cking search function
Yes, I've used a site search
No, I don't need a reminder that search functions exist
No, I don't need your astonished outbreak that I couldn't find the information
No, I don't need your answer if you can't just give it without all the BS around it