A question with a voice in the history screen

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.
Post Reply
Message
Author
User avatar
Andredron
Miko-Class Veteran
Posts: 535
Joined: Thu Dec 28, 2017 2:37 pm
Completed: Kimi ga nozomu renpy-port(demo), Albatross Koukairoku(demo)
Projects: Sisters ~Natsu no Saigo no Hi~(renpy-port)
Location: Russia
Contact:

A question with a voice in the history screen

#1 Post by Andredron » Tue Jul 05, 2022 3:21 pm

Once upon a time, I wrote how to make a separate button to play a voice in history.

viewtopic.php?f=8&t=57526&p=522497#p522497

Thanks to Mr. Python for explaining what and how.

I have another problem now, I still can't figure out how to make a separate phrase with a button.

And so that it is included only in those phrases where there is a voice message. Tell me please

Code: Select all

screen history():
    tag menu
    predict False
    frame:
        background black2
        left_margin 80
        right_margin 80
        top_margin 50
        bottom_margin 50
 
        left_padding 50
        right_padding 100
        top_padding 75
        bottom_padding 50

        vpgrid:
            style_prefix "history"
            cols 1
            yinitial 1.0
            draggable True
            mousewheel True
            scrollbars "vertical"
            ymaximum 800
            for h in _history_list:
                frame: 
                    background None 
                    left_margin 80
                    right_margin 80
                    top_margin 50
                    bottom_margin 50
 
                    left_padding 50
                    right_padding 100
                    top_padding 75
                    bottom_padding 50
                    
                    has fixed:
                        yfit True

                    if h.who:
                        label h.who:
                            style "history_name"
                            if "color" in h.who_args:
                                text_color h.who_args["color"]
                    $ what = renpy.filter_text_tags(h.what, allow=gui.history_allow_tags)
                    text what 
                    
        if not _history_list:
            label _("ヒストリーはありません。")
            
    textbutton _("戻る"):
        style "return_button"
        action Return()        

Code: Select all

if h.voice and h.voice.filename:
     textbutton "Replay" action Play("voice", h.voice.filename)
I'm writing a Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18

Help me to register in QQ International

Honest Critique

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]