Hello,
I'd like to change the History screen so that I can separate lines of dialogue into different screens depending on who's talking. So I'd like to define the _history_list as a list of lists (where each list inside _history_list contains a different character's dialogue).
But, I have no idea where _history_list is defined. I've looked through every python file in the renpy folder, but the best I've been able to find is where the HistoryEntry class is defined and how it's used in the ADVCharacter class. I've also tried re-defining _history_list, but Ren'Py ignores it or calls it undefined under a different name.
Can anyone help me find this variable?
(As a sidenote, the most relevant code I'm looking at right now where _history_list is mentioned is, of course, screens.rpy under the History screen, and renpy/character.py under the ADVCharacter class under "def add_history()".)
Where is _history_list defined? [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.
- Treladon
- Regular
- Posts: 40
- Joined: Sat Dec 31, 2016 3:20 pm
- Projects: ToMaG, Feinted Game
- Organization: Kuehler-Corrada Productions
- Deviantart: Journie
- Contact:
Where is _history_list defined? [SOLVED]
Last edited by Treladon on Thu Feb 15, 2018 1:01 am, edited 1 time in total.
WIP: The Tasks of Messengers and Guardians - Progress Page Here!
-
- Regular
- Posts: 78
- Joined: Thu Feb 08, 2018 7:57 am
- Contact:
Re: Where is _history_list defined?
It's a store variable, so it's not defined anywhere you'll see in files renpy exposes to you. You can redefine it but that would likely entail making other changes to prevent anything from breaking. Anyway, it's just a list of HistoryEntry objects. You can accomplish what you're attempting by iterating through _history_list and checking the 'who' field, something like:
You could also use config.history_callbacks to maintain your own history formatted however you like.
Edit: changed the code so that it actually works. Apparently variables local to the screen are inaccessible from a generator expression.
Code: Select all
screen character_history(who):
vbox:
for i in _history_list:
if i.who == who:
text i.what
Edit: changed the code so that it actually works. Apparently variables local to the screen are inaccessible from a generator expression.
- Treladon
- Regular
- Posts: 40
- Joined: Sat Dec 31, 2016 3:20 pm
- Projects: ToMaG, Feinted Game
- Organization: Kuehler-Corrada Productions
- Deviantart: Journie
- Contact:
Re: Where is _history_list defined?
Hi, irredeemable. Thanks so much for your help! After some adjustments, it totally worked the way I wanted it. This is now the history screen for one of the NPCs:irredeemable wrote: ↑Wed Feb 14, 2018 1:11 am It's a store variable, so it's not defined anywhere you'll see in files renpy exposes to you. You can redefine it but that would likely entail making other changes to prevent anything from breaking. Anyway, it's just a list of HistoryEntry objects. You can accomplish what you're attempting by iterating through _history_list and checking the 'who' field, something like:
You could also use config.history_callbacks to maintain your own history formatted however you like.Code: Select all
screen character_history(who): vbox: for i in _history_list: if i.who == who: text i.what
Edit: changed the code so that it actually works. Apparently variables local to the screen are inaccessible from a generator expression.
Code: Select all
screen history_William_Claybourne():
tag menu
predict False
use game_menu(_("History: William Claybourne"), scroll=("vpgrid" if gui.history_height else "viewport")):
style_prefix "history"
for i in (i for i in _history_list if i.who=="William Claybourne"):
window:
xpos .1
## This lays things out properly if history_height is None.
has fixed:
yfit True
if i.who:
label i.who:
style "history_name"
## Take the color of the who text from the Character, if
## set.
if "color" in i.who_args:
text_color i.who_args["color"]
text i.what
if not (i for i in _history_list if i.who=="William Claybourne"):
label _("Dialogue history with William is empty.")
textbutton "Back" xanchor 0.0 xpos .225 ypos .905 action Show("history")
WIP: The Tasks of Messengers and Guardians - Progress Page Here!
-
- Regular
- Posts: 78
- Joined: Thu Feb 08, 2018 7:57 am
- Contact:
Re: Where is _history_list defined? [SOLVED]
No problem. Yeah it works for your version because you're not using a screen variable you're giving it a string. That generator expression (i for i in _history_list if i.who=="William Claybourne") won't work if you give it a screen variable ('who' in my example).
Who is online
Users browsing this forum: No registered users