Can I clarify - do you know how for loops work in python? Sorry if it comes across the wrong way, I think maybe I'm not understanding where you're coming from, from a non-coder background and thus what I said wouldn't have made any sense!
In fact I'm going to rewrite my earlier answer in more detail on the assumption that you are unfamiliar with programming. I apologise if it comes across patronising, but I just want to make sure you get the answer you need!
Your code doesn't use the k variable in the for loop, so it'll just output whatever you've put inside the for loop block as many times as you have items in the m_journal list variable. Because you've physically put 5 lines of text inside the block (none of them uses the variable k, which is supposed to hold the journal entry), and the block is just repeating as many times as there are journal entries, with k (in theory) holding the current journal entry.
Notice how there's only one line in remix's code? And it uses the k variable to substitute what's inside:
Code: Select all
for k in conversations:
image "convo_{}".format(k)
What's happening there is the code loops through the conversations variable, which is a list - so it'll loop through it as many times as there are conversations. On each loop, it'll take the content of that particular list entry, and put it in k.
So let's say the list is [1,5,3]. First time it runs through the loop, k == 1; second loop, k == 5; third loop k == 3.
The second line of code basically says display an image here based on the following string: "convo_{}".format(k)". The {} gets replaced with what's inside format - which is k, which is 1, 5 and 3 on the corresponding loop. So the outputs will be:
"convo_1", "convo_5", "convo_3".
Note: the "string".format(k) code is used because k is an int (integer) and cannot be concatenated to a string in python, so it formats k into a string before putting it .
So to duplicate the effect, we want to keep the for loop, change the image into text, and think about what k contains. From your examples, k only contains alpha-numerals; 1, 2, 3, 4, 5 etc. It doesn't contain the actual diary entry - so you can't magically make your text read out the diary entry. The best you can get it to do is:
Code: Select all
text "This is the journal entry {}".format(k)
which will give you at best, in the [1,5,3] example:
This is the journal entry 1
This is the journal entry 5
This is the journal entry 3
If you want your screen to actually display the journal entry - you have two options. You either actually put the journal entry into your m_journal list - a list can contain any type of variables, including strings!
So you'd do something like this during the game flow:
Code: Select all
$ m_journal.append("This is the first journal entry")
$ m_journal.append("This is the fifth journal entry")
$ m_journal.append("This is an entry about monkeys hating citrus fruit for no reason")
And this in your screen:
It'll just output whatever you actually appended in the list.
There are other ways of doing this, including a way that uses int (by using python dicts), but if you're unfamiliar with coding, it may be best for another day.
I hope this makes more sense and answers your question! Reading back I think I focused on what you said about order and thought you're saying that your code isn't showing things in the right order. I thought you were showing us sort of pseudo codes instead of actual code - which is my bad assumption.
One thing that could help clarifying when asking programming questions is:
What is your input?
What is your expected output?
What is the output you actually got? - this part you just described in English and it's why I ended up misunderstanding.