I tried to add voice replay buttons in the history mode in my game and discovered strange thing.
If the "Voice sustain" preference is on, the replay buttons would not appear in history mode.
(apparently, because h.voice.filename is None in every voice object)
Code: Select all
screen history():
tag menu
## Avoid predicting this screen, as it can be very large.
predict False
use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport")):
style_prefix "history"
for h in _history_list:
window:
## This lays things out properly if history_height is None.
has fixed:
yfit True
if h.who:
label h.who:
style "history_name"
## Take the color of the who text from the Character, if
## set.
if "color" in h.who_args:
text_color h.who_args["color"]
if h.voice.filename is None:
text h.what
else:
$ print "voice:"
$ print h.voice.filename
$ print "next:"
$ print "---"
textbutton h.what action Play("voice", h.voice.filename)
#text h.what
if not _history_list:
label _("The dialogue history is empty.")
https://github.com/renpy/renpy/issues/1228
The test project is in the attachment. How to reproduce:
1. Run "the_question" project from the launcher.
2. Click 5 times on screen.
3. Check game's console window, there should be "voice/voice2.ogg" line.
4. Open history window - no clickable replay buttons there.