Ren'py ui - "self-voicing enabled/disabled"

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
tv-ghost
Newbie
Posts: 11
Joined: Mon Jul 23, 2018 3:47 am
Contact:

Ren'py ui - "self-voicing enabled/disabled"

#1 Post by tv-ghost »

I'm trying to adjust the popup you see when you press V for self-voicing (both the text and positioning). The only results I got for the text that comes up ("Self-voicing enabled. Press 'v'' to disable) is found in common.rpym but modifying 00preferences.rpy:504 isn't causing any changes.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Ren'py ui - "self-voicing enabled/disabled"

#2 Post by Imperf3kt »

You need to add the code from common folder of renpy install, to your game at a higher init.

I have dobe this in one project, where I changed the text to an image. After I get home from work, I can give you better instruction.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Ren'py ui - "self-voicing enabled/disabled"

#3 Post by Imperf3kt »

The part you require can be found starting at line 471 of renpy/renpy/common/00preferences.rpy

Code: Select all

    def __show_self_voicing():
        has_screen = renpy.get_screen("_self_voicing")

        if _preferences.self_voicing and not has_screen:
            renpy.show_screen("_self_voicing")
        elif not _preferences.self_voicing and has_screen:
            renpy.hide_screen("_self_voicing")

        if _preferences.self_voicing and config.self_voicing_stops_afm:
            if _preferences.using_afm_enable:
                _preferences.afm_enable = False
            else:
                _preferences.afm_time = 0

    config.interact_callbacks.append(__show_self_voicing)

init -1500 python:

    import os
    config.self_voicing_stops_afm = not ("RENPY_SELF_VOICING_AFM" in os.environ)


init -1500:

    # The screen that we use to indicate that self-voicing is enabled.
    screen _self_voicing():
        zorder 1500

        if _preferences.self_voicing == "clipboard":
            $ message = _("Clipboard voicing enabled. Press 'shift+C' to disable.")
        elif _preferences.self_voicing == "debug":
            $ message = _("Self-voicing would say \"[renpy.display.tts.last]\". Press 'alt+shift+V' to disable.")
        else:
            $ message = _("Self-voicing enabled. Press 'v' to disable.")

        text message:
            alt ""

            xpos 10
            ypos 35
            color "#fff"
            outlines [ (1, "#0008", 0, 0)]

Copy everything from the init -1500 (including the init -1500 line itself) and paste it in your project, changing the init to -1499 or closer to 0.

Make your adjustments and they'll appear in your game, but only the one you paste the changes into.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

tv-ghost
Newbie
Posts: 11
Joined: Mon Jul 23, 2018 3:47 am
Contact:

Re: Ren'py ui - "self-voicing enabled/disabled"

#4 Post by tv-ghost »

Imperf3kt wrote: Mon Feb 25, 2019 6:18 am The part you require can be found starting at line 471 of renpy/renpy/common/00preferences.rpy

Code: Select all

    def __show_self_voicing():
        has_screen = renpy.get_screen("_self_voicing")

        if _preferences.self_voicing and not has_screen:
            renpy.show_screen("_self_voicing")
        elif not _preferences.self_voicing and has_screen:
            renpy.hide_screen("_self_voicing")

        if _preferences.self_voicing and config.self_voicing_stops_afm:
            if _preferences.using_afm_enable:
                _preferences.afm_enable = False
            else:
                _preferences.afm_time = 0

    config.interact_callbacks.append(__show_self_voicing)

init -1500 python:

    import os
    config.self_voicing_stops_afm = not ("RENPY_SELF_VOICING_AFM" in os.environ)


init -1500:

    # The screen that we use to indicate that self-voicing is enabled.
    screen _self_voicing():
        zorder 1500

        if _preferences.self_voicing == "clipboard":
            $ message = _("Clipboard voicing enabled. Press 'shift+C' to disable.")
        elif _preferences.self_voicing == "debug":
            $ message = _("Self-voicing would say \"[renpy.display.tts.last]\". Press 'alt+shift+V' to disable.")
        else:
            $ message = _("Self-voicing enabled. Press 'v' to disable.")

        text message:
            alt ""

            xpos 10
            ypos 35
            color "#fff"
            outlines [ (1, "#0008", 0, 0)]

Copy everything from the init -1500 (including the init -1500 line itself) and paste it in your project, changing the init to -1499 or closer to 0.

Make your adjustments and they'll appear in your game, but only the one you paste the changes into.
Works like a charm, thank you.

Post Reply

Who is online

Users browsing this forum: Andredron