(solved) Problem in voice playback in renpy 8

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: 719
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

(solved) Problem in voice playback in renpy 8

#1 Post by Andredron »

Hello, I have a problem with voice playback.

When I use the menu, the voices play smoothly.

But when I used the code - call screen, then the voices are not played and the quick_menu is disabled,
Tell me what I'm doing wrong

Code: Select all

label start:

	###The voice works
     voice "voice/005.ogg"
     nez "When you wake up, come downstairs for breakfast."
 
     scene black with Dissolve(1.5)
     pause 1.5
     scene bgm02 with Dissolve(1.5)
     pause 2.5
     scene bgm03 with Dissolve(1.5)
     pause 2.5
 
     menu:
         "Escape from":
             $ stage = 1
 
     call screen itag2

etag.rpy

Code: Select all

screen itag2:
    tag etag
    if change == 0:
        add "images/etag2d.png"
    else:
        add "images/etag2n.png"
    fixed:
        textbutton _("{outlinecolor=#ffffff}To the back room") xalign 0.34 yalign 0.3 action [Hide("itag2"),Jump("d_kom")]
        textbutton _("{outlinecolor=#ffffff}Bedroom") xalign 0.3 yalign 0.4 action [Hide("itag2"),Jump("sp_kom")]
        textbutton _("{outlinecolor=#ffffff}To the first room") xalign 0.25 yalign 0.5 action [Hide("itag2"),Jump("per_kom")]
        textbutton _("{outlinecolor=#ffffff}To the second room") xalign 0.20 yalign 0.6 action [Hide("itag2"),Jump("vtr_kom")]
        textbutton _("{outlinecolor=#ffffff}To the bathroom") xalign 0.20 yalign 0.7 action [Hide("itag2"),Jump("van_kom")]
        textbutton _("{outlinecolor=#ffffff}To 1st floor") xalign 0.8 yalign 0.9 action [Hide("itag2"),ShowMenu("itag1")]

screen itag1:
    tag etag
    if change == 0:
        add "images/etag1d.png"
    else:
        add "images/etag1n.png"
    fixed:
        if stage > 1:
            textbutton _("{outlinecolor=#ffffff}To the kitchen") xalign 0.4 yalign 0.5 action [Hide("itag1"),Jump("kuh_kom")]
        textbutton _("{outlinecolor=#ffffff}To the living room") xalign 0.8 yalign 0.5 action [Hide("itag1"), Jump("gost_kom")]   ### While prescribing the code for this location, where basically the problem with the voice got out.
        textbutton _("{outlinecolor=#ffffff}To 2nd floor") xalign 0.1 yalign 0.4 action [Hide("itag1"), ShowMenu("itag2")]
        if stage > 2:
            textbutton _("{outlinecolor=#ffffff}outside") xalign 0.5 yalign 0.95 action [Hide("itag1"),Jump("ulicha")]

        
comata.rpy

Code: Select all

label gost_kom:
    if days == 1:
	
        scene telo02
        $ renpy.movie_cutscene('ep02.webm')
        
        ### quick_menu not work
        au "............"

        scene telo03
        pause 1.0

	###All subsequent voices do not work here
        voice "voice/006.ogg"
        nez "Finally arrived."

         scene body04
         pause 1.6
         show rot_05
	
	###voices not work
         voice "voice/007.ogg"
         nez "Sonya{w=1.0}{nw}"

         show mor03
         $store._history = False
         nez "Sonya{fast}"

        $ store._history = True
Last edited by Andredron on Fri Jun 24, 2022 3:49 am, edited 1 time in total.

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Problem in voice playback in renpy 8

#2 Post by m_from_space »

I think one long-term problem in your code is, that you call a screen, but never return from it, but directly jump into a label from inside it. This will probably fill the return stack over time if you call more screens from those labels. I don't think you should put your game logic inside screens, but inside the usual renpy code and show and call screens depending on what's happening there.

I also think you shouldn't use "ShowMenu()" as part of your game, since it is used for game menu entries like the main menu or preferences or custom ones, but not in-game menus. Use "Show()" instead.

I'm not sure why your quick_menu doesn't show up though, maybe because of ShowMenu(), since the game assumes you're in the main menu and not in a game.

My suggestion for your game logic would be like this:

Code: Select all

label start:
    ...
    call screen itag2
    jump expression _return
    ...

screen itag2:
    ...
    textbutton "Go to the store" action Hide('itag2'),Return("store")
    textbutton "Go to the hospital" action Hide('itag2'),Return("hospital")

label store:
    "You are in the store."
    ...

label hospital:
    "you are in the hospital"
    ...

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2404
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Problem in voice playback in renpy 8

#3 Post by Ocelot »

m_from_space wrote: Thu Jun 23, 2022 4:40 pm I think one long-term problem in your code is, that you call a screen, but never return from it, but directly jump into a label from inside it. This will probably fill the return stack over time if you call more screens from those labels.
That not exacly right. calling screen is not like calling label, in a sence that it does not involve call stack. It just a shorthand for showing screen and forcing an interaction. Jumping from called screens is a valid vay of ending interaction.
m_from_space wrote: Thu Jun 23, 2022 4:40 pm I also think you shouldn't use "ShowMenu()" as part of your game, since it is used for game menu entries like the main menu or preferences or custom ones, but not in-game menus. Use "Show()" instead.
ShowMenu call screen in menu, not game context, which might cause some problems, but I do not think, that it is the cause for voice files not playing, since after hiding it you should return into game again.
< < insert Rick Cook quote here > >

User avatar
Andredron
Miko-Class Veteran
Posts: 719
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Problem in voice playback in renpy 8

#4 Post by Andredron »

m_from_space wrote: Thu Jun 23, 2022 4:40 pm I think one long-term problem in your code is, that you call a screen, but never return from it, but directly jump into a label from inside it. This will probably fill the return stack over time if you call more screens from those labels. I don't think you should put your game logic inside screens, but inside the usual renpy code and show and call screens depending on what's happening there.

I also think you shouldn't use "ShowMenu()" as part of your game, since it is used for game menu entries like the main menu or preferences or custom ones, but not in-game menus. Use "Show()" instead.

I'm not sure why your quick_menu doesn't show up though, maybe because of ShowMenu(), since the game assumes you're in the main menu and not in a game.

My suggestion for your game logic would be like this:

Code: Select all

label start:
    ...
    call screen itag2
    jump expression _return
    ...

screen itag2:
    ...
    textbutton "Go to the store" action Hide('itag2'),Return("store")
    textbutton "Go to the hospital" action Hide('itag2'),Return("hospital")

label store:
    "You are in the store."
    ...

label hospital:
    "you are in the hospital"
    ...
Thank you, the show option worked, and the rest of the code worked as it should (A voice appeared, and quick_menu)
It's been a long time since I've printed the code, and I've forgotten a lot.

https://vk.com/andredron_1?w=wall189145553_5098 - video what happened to launch the voice, etc.

User avatar
m_from_space
Miko-Class Veteran
Posts: 975
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Problem in voice playback in renpy 8

#5 Post by m_from_space »

Ocelot wrote: Thu Jun 23, 2022 4:52 pmThat not exacly right. calling screen is not like calling label, in a sence that it does not involve call stack. It just a shorthand for showing screen and forcing an interaction. Jumping from called screens is a valid vay of ending interaction.
Well, I tested it and when you jump out of a called screen the return stack still consists of an item, which makes sense. It would be weird if you call something and never return. Of course nothing bad will happen until you later in your game "return" and suddenly you are back at the point where you called the screen (if the game ends afterwards, no problem of course).

Calling a screen is like calling a label. The interaction pauses at the point you call the screen and resumes when you return. If you never return, nothing bad will happen (the same as never returning from a label), but the return stack still has the information of the call.


edit:
No I just realized I made a mistake testing it, haha. :D

So it seems it is valid after all.

Post Reply

Who is online

Users browsing this forum: Ocelot, snotwurm