Why don't you add a label like this:
Code: Select all
label add_journal(journal_entry_title):
$ journal.append("Journal Entry #{}".format(len(journal)+1) + " {space=15} " + journal_entry_title)
return
I've removed the font styling because you can do that on your screen using text styling, so it's silly to hard code it in.
Now if you want to add a journal entry, just do this:
Code: Select all
call add_journal("This is an entry")
call add_journal("This is another entry")
Here's how it works:
The label takes a parameter - the actual journal title which depends on what you add. The journal entry number we can work out programmatically so we won't pass it as a parameter. Once inside the label, the variable journal_entry_title becomes whatever text you pass in.
Code: Select all
label add_journal(journal_entry_title):
Next the append, let's break it down. First let's go back to what we talked about before - using string.format() to add a number into your final string:
Code: Select all
"Journal Entry #{}".format(len(journal)+1)
This is the same as what we had before: {} inside the string gets substituted with whatever is inside the format() function.
What is len(journal)+1 then?
Well len() can work out the length of a list, so we're putting our journal list in. So if your list is empty, len(journal) returns 0. Well we want the first entry to start at 1, so we'll add 1 to it. So now when there's 0 journal entry, len(journal)+1 returns 1; 1 entry it returns 2; etc. Exactly what we want going forward. It doesn't matter how many entries we put in, it'll work it out automatically.
So combining the two part, we have a string that will become "Journal Entry #1" for entry 1, #2 for entry 2 and so forth.
Finally, we'll combine everything together in our append statement, we add the spacing because that can't be influenced by the screen text styling. We're essentially adding:
"Journal Entry #1 {space=15} [whatever you put into the parameters]"
So for the example above, it'll create a list with:
call add_journal("This is an entry
Journal Entry #1 {space=15} This is an entry
Journal Entry #2 {space=15} This is another entry
Onto formatting your text on the screen. You apply text styling:
https://www.renpy.org/doc/html/style_pr ... properties
Code: Select all
for k in journal:
text k color "#000" bold True
That should output exactly what you need.