Custom dialogue boxes not being cleared when scene or menu statements are used
Posted: Tue Jul 19, 2022 7:29 am
Alright, so, first of all, I barely even remember how my partner and I cobbled this code together, but basically we made and/or found something that enables dialogue boxes to have scrolling background images on them. Only problem is that the dialogue box never really goes away on its own, which I'd like it to do when changing scenes or showing menu items, just like how the default dialogue box works.
(For the record, I have absolutely no idea why "renpy.restart_interaction()" is even there or what it does, but I'm afraid to touch it.)
I can make it hide by adding this to it:
...but this causes other problems. I only want it to hide when a scene or menu statement is used, but I don't know how to make that happen. Intuition would leave me to believe that those statements hide some sort of layer or image tag when used, but I don't know which, or if that's even how it works. I've looked through all the script files and I can't find where the scene or menu statements are defined, I have no idea how they actually work or what the basic differences between my dialogue box and the default one are.
What are the scene and menu statements doing that causes the default dialogue box to go away, and how might I apply that to my own? Or, alternatively, is there some sort of syntax I could use to basically go:
?
Code: Select all
transform maskpos:
pos (0.0, 0.75)
transform dialoguepan:
align (0.0, 1.0)
block:
offset (0, 0)
linear 3.0 offset (-150, 80)
repeat
init:
default speaking_char = None
python:
from functools import partial
def chartextbg(char, event, *args, **kwargs):
if event == "begin":
if store.speaking_char != char:
renpy.show("images/gui/" + char + "_bg.png", tag='dialoguelayer', layer='screens', what=AlphaMask(Fixed(At("images/gui/" + char + "_bg.png", dialoguepan)), At("images/gui/dialoguemask.png", maskpos)))
renpy.restart_interaction()
store.speaking_char = char
define e = Character("Emily", callback=partial(chartextbg, "Emily"), image='e')
I can make it hide by adding this to it:
Code: Select all
if event == "end":
renpy.hide('dialoguelayer', layer='screens')
What are the scene and menu statements doing that causes the default dialogue box to go away, and how might I apply that to my own? Or, alternatively, is there some sort of syntax I could use to basically go:
Code: Select all
if [scene statement happens] or [menu statement happens]:
renpy.hide('dialoguelayer', layer='screens')
store.speaking_char = None