I am trying to implement allowing the player to turn off some sounds in my game through a screen accessed by pressing a particular keystroke ("b" here).
For this I use the following init block:
which therefore calls the following label which is a screen with just two images to press to turn on or off these sounds, leading to the variable cumsoundon being True or False:
It works, but my issue is that it moves down one stack at the end on "Return", because it is not a call to a new "context".
But if, instead I use:
The setting of the variable "cumsoundon" to True or False is not passed back to the game. Therefore, I am in a bit of a conundrum and was wondering if there was a way around this if anyone knows?
For this I use the following init block:
Python:
init python:
def show_mccumsound_menu():
renpy.call("Mccumsound")
config.keymap["open_mccumsound_menu"] = ["b"]
# When key is pressed at anytime, open custom screen.
config.underlay.append(renpy.Keymap(open_mccumsound_menu=show_mccumsound_menu))
Python:
label Mccumsound:
call screen mcchoosesound
screen mcchoosesound:
modal True
imagebutton:
focus_mask True
idle "v07/mcsoundon.png"
hover "v07/mcsoundon.png"
action [SetVariable("cumsoundon", True), Hide("mcchoosesound"), Return]
imagebutton:
focus_mask True
idle "v07/mcsoundoff.png"
hover "v07/mcsoundoff.png"
action [SetVariable("cumsoundon", False), Hide("mcchoosesound"), Return]
But if, instead I use:
Python:
init python:
def show_mccumsound_menu():
renpy.call_in_new_context("Mccumsound")
config.keymap["open_mccumsound_menu"] = ["b"]