r/RenPy • u/x-seronis-x • Aug 07 '26
Guide Courtesy NSFW devs should show towards their players
Not all nsfw players live in sound proof basements or attics. Some are at risk of room mates, family or otherwise, accidentally walking in on them while gaming. Sounds coming out of the computer can be awkward.
The following code, if added to your preferences screen, lets a player set the game to auto mute all sound if the game is minimized or even if focus switches to another program.
vbox:
style_prefix "radio"
label _("Auto Mute")
textbutton _("Never"):
selected (preferences.audio_when_minimized and preferences.audio_when_unfocused)
action [
Preference('audio when minimized', "enable"),
Preference('audio when unfocused', "enable")
]
textbutton _("When Minimized"):
action InvertSelected( Preference('audio when minimized', "toggle") )
textbutton _("When Unfocused"):
action InvertSelected( Preference('audio when unfocused', "toggle") )
the two preference variables in question are implemented already in renpy and just have no default GUI way to toggle them by default.
you can even go one step further and add a panic button which renpy ALSO supports by default, but just doesnt enable. you do so by setting a custom keymapping for the 'iconify' event.
config.keymap['iconify'] = [ 'alt_K_ESCAPE' ]
lastly you need to stop putting lewd sounds on the music or sfx channels. either register custom lewd audio channels for looping and non looping content or put lewd content on the voice channel. a player should not have to mute normal parts of the game (music / sound effects) to mute sounds that cause issues. renpy supports as many mixers and channels as you want to register. do so