Ren'Py Two unrelated questions (screen sound volume and android screenshots)

Playstorepers

Member
May 24, 2020
160
79
Hey everyone, I have two questions about renpy:

1) Is it possible to implement a different volume, while a screen is open.
For example: The player can play normally, but whenever he enters a specific menu, the volume goes down by like 80%?
Maybe it's the save screen, maybe a special screen.
It's a common feature in normal games, but I don't know, how to implement it correctly in renpy. I just know, how to lower the sound in the story, but not only while a menu is up.
My initial idea was adding the sound change to the buttons, that open up the window, but the esc button is so handy, i don't want to tinker with it. So I'd prefer a while-function or something like that.

EDIT: So I found the
on "show" action
on "hide" action
shit, but I don't know, what to type into that action and whether it's really the best way to implement my idea.


2) If you save on an android version of a game, the image of that savefile is just black. Usually it's a screenshot of your game. Does anyone know, how to fix that?

Thank you in advance.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,286
I know that you figured out the solution for the sound issue, but readers can want a little more information.

1) Is it possible to implement a different volume, while a screen is open.
For example: The player can play normally, but whenever he enters a specific menu, the volume goes down by like 80%?
Basically speaking, changing the volume is possible with the command. If you let the music on its default channel, then renpy.music.set_volume( 20 ) would reduce the music to 20% of the volume defined in the preference ; so 80% less than the actual volume. This while renpy.music.set_volume( 100 ) would restore the volume to what the player defined.
But to do it at the opening of a menu is something else. You can't just put the command into the screen, since you would need two commands. Something like
Code:
screen whatever():
   $ renpy.music.set_volume( 20 )
   [ content of the screen ]
   $ renpy.music.set_volume( 100 )
would just reduce the volume the time the screen is proceeded (few micro seconds). Once Ren'py finished to proceed it, the volume would return to its normal level.


Therefore, as you find yourself, the solution probably rely on the screen statement to achieve that. I haven't tested it, but normally this should works:
Python:
screen whatever():
    # Will be proceeded only once, when the screen is shown ; do NOT apply to 
    # the refresh. Turn down the volume to 20% of what the players defined in
    # the preference screen.
    on "show" action Function( renpy.music.set_volume, 20 )
    # Will be proceeded only once, when the screen is hidden. Turn the volume
    # back to 100% of what the player defined in the preference screen.
    on "hide" action Function( renpy.music.set_volume, 100 )

    [ content of the screen]
 
  • Like
Reactions: Playstorepers

Playstorepers

Member
May 24, 2020
160
79
I know that you figured out the solution for the sound issue, but readers can want a little more information.



Basically speaking, changing the volume is possible with the command. If you let the music on its default channel, then renpy.music.set_volume( 20 ) would reduce the music to 20% of the volume defined in the preference ; so 80% less than the actual volume. This while renpy.music.set_volume( 100 ) would restore the volume to what the player defined.
But to do it at the opening of a menu is something else. You can't just put the command into the screen, since you would need two commands. Something like
Code:
screen whatever():
   $ renpy.music.set_volume( 20 )
   [ content of the screen ]
   $ renpy.music.set_volume( 100 )
would just reduce the volume the time the screen is proceeded (few micro seconds). Once Ren'py finished to proceed it, the volume would return to its normal level.


Therefore, as you find yourself, the solution probably rely on the screen statement to achieve that. I haven't tested it, but normally this should works:
Python:
screen whatever():
    # Will be proceeded only once, when the screen is shown ; do NOT apply to
    # the refresh. Turn down the volume to 20% of what the players defined in
    # the preference screen.
    on "show" action Function( renpy.music.set_volume, 20 )
    # Will be proceeded only once, when the screen is hidden. Turn the volume
    # back to 100% of what the player defined in the preference screen.
    on "hide" action Function( renpy.music.set_volume, 100 )

    [ content of the screen]
Thank you for your answer.

It kinda works... but only kinda.
You get fucked, once you open up another screen, or press alt + f4 which incidentally is another screen.

So you need to add that shit into every screen, even the subscreens, from my understanding, since the hide action is triggered constantly. I'm going to look into it, once I wrapped up work.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
The other thing about sound is that I'm reasonably sure a relatively recent release of RenPy added a volume override to the play sound commands

I'm on a tablet right now, so cba researching as I usually would. It might require restarting the music again, but it would at least allow you to do things without overriding user preferences.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,286
So you need to add that shit into every screen, even the subscreens, from my understanding, since the hide action is triggered constantly. I'm going to look into it, once I wrapped up work.
Yeah, it only limit its action to the screen where you put it.
But if your intent is to lower the volume for the system screens, why not apply the solution to the "navigation" screen ? It's included in almost all system screens, what should make one change apply to many screens.
 
  • Like
Reactions: Playstorepers

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
My other suggestion would be not to rely on absolute numbers.
Consider storing the "normal" volume (from user preferences) in a separate variable. Then swap between that and maybe 30% of that same number.

Which will be easier if I'm correct about the volume override parameter.

For example, switching to 20 for music volume would actually be an INCREASE to my usual volume. Jumping up to 100 would just piss me off.

Ah. Ignore me. I missed the part of Anne's reply that says its a percentage change, not an absolute one.
 
Last edited:
  • Like
Reactions: Playstorepers

Playstorepers

Member
May 24, 2020
160
79
Yeah, it only limit its action to the screen where you put it.
But if your intent is to lower the volume for the system screens, why not apply the solution to the "navigation" screen ? It's included in almost all system screens, what should make one change apply to many screens.
It's kinda worse than I expected, because I don't want it to happen, if the player accesses the load screen from the main menu. The idea would be to let the mainmenu music run through another channel, I guess,which is kinda unpractical, but it looks like I have no other choice.

EDIT: And oh right, does anyone have a solution for my second problem? the one with the android screenshots? Do i have to unlock something?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,286
It's kinda worse than I expected, because I don't want it to happen, if the player accesses the load screen from the main menu.
Normally the main_menu variable should do the trick. I can't test it right now, but it's supposed to turn False when you start the game or when you load a save file. Therefore, something like this should do what you want :
Code:
    on "show" action If( main_menu is False, Function( renpy.music.set_volume, 20 ), NullAction() )
    on "hide" action If( main_menu is False, Function( renpy.music.set_volume, 100 ), NullAction() )

EDIT: And oh right, does anyone have a solution for my second problem? the one with the android screenshots? Do i have to unlock something?
Nop sorry. I really suck at Android Ren'py.
 
  • Like
Reactions: Playstorepers

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
2) If you save on an android version of a game, the image of that savefile is just black. Usually it's a screenshot of your game. Does anyone know, how to fix that?
EDIT: And oh right, does anyone have a solution for my second problem? the one with the android screenshots? Do i have to unlock something?

Best I can think to suggest is to download any Android port by the66 and unpack it to see it's code.

Maybe download the PC version of the same game and compare the two versions to see what "upgrades" the66 makes to improve the Android adaptation.
Maybe even compare the Load/Save screen code from that game and your own, to see if there's anything you've perhaps changed inadvertently.

This seems to be latest in a long list of unofficial Android ports.
https://f95zone.to/threads/love-lurker-v0-91-double-moon.55797/post-6577192

.apk files are really just .zip files, if I recall correctly. You may need to UnRen the unpacked .apk file to actually see the source code. Just keep in mind that Android apps tend to rename all the app filenames to start x-*.*.
 
  • Like
Reactions: Playstorepers

Playstorepers

Member
May 24, 2020
160
79
Best I can think to suggest is to download any Android port by the66 and unpack it to see it's code.

Maybe download the PC version of the same game and compare the two versions to see what "upgrades" the66 makes to improve the Android adaptation.
Maybe even compare the Load/Save screen code from that game and your own, to see if there's anything you've perhaps changed inadvertently.

This seems to be latest in a long list of unofficial Android ports.
https://f95zone.to/threads/love-lurker-v0-91-double-moon.55797/post-6577192

.apk files are really just .zip files, if I recall correctly. You may need to UnRen the unpacked .apk file to actually see the source code. Just keep in mind that Android apps tend to rename all the app filenames to start x-*.*.
I'll look into it next weekend, but thank you both for your help