This is really cool. Would it be possible to use this effect along with dialogue bleeps (since both of those effects use the callback parameter)? If so, what would be the best way to combine them? Thanks!
Viewing post in Renpy Auto Highlight comments
In another .rpy file, I have a dictionary that maps character names (the string that is used for the cb_name parameter when defining a Character) to the path of their respective bleep files, which looks something like this:
## name_callback in game/00auto-highlight.rpy uses this dictionary ## to determine what bleeps to use per character define bleeps_dict = {"ss" : "audio/bleep023.ogg", "vl" : "audio/bleep003.ogg", "ap" : "audio/bleep006.ogg"}
And in 00auto-highlight.rpy, I tweaked the name_callback function to look like this (please note that I defined a separate audio channel just for text bleeps):
def name_callback(event, interact=True, name=None, **kwargs): global speaking_char if event == "begin": speaking_char = name ## text bleeps if name in bleeps_dict: if event == "show": renpy.music.play(bleeps_dict[name], channel="bleeps", loop=True) elif event == "slow_done" or event == "end": renpy.music.stop(channel="bleeps", fadeout=1.0)
If there is a character who shouldn't use bleeps (I defined a separate Character object for my MC's thoughts, for example), then the "if name in bleeps_dict" line above can be changed to something like:
if name in bleeps_dict and name != "name_of_silent_character":
If there are several character who don't speak, it might be easier to define a list of names of silent characters and then use "...and name not in silent_characters".
I think this is all I needed to do. If you have any issues, please feel free to let me know!! ♡
(Also I'm really sorry if the code formatting above is a bit nasty to read with the indentations)
I'm happy to help!! I hope it works for your project.
I forgot to mention in my last reply that I defined a separate audio channel for the text bleeps (which affects the changes to the name_callback function). That's why I have a channel named "bleeps" in the code. This can be changed to any audio channel (premade or custom) where bleeps can work.
Please feel free to let me know if you have any more questions about my implementation!! <3 <3