Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Actually, I just have to call my bleeps function within name_callback. In hindsight, I should've pieced that together much faster...

The effect is pretty cool. Thank you so much for the resource!

hello! i know this is a total shot in the dark on a very old comment but i am right now stuck on this very issue - i can't figure out how to call the bleeps function within name_callback. is there any chance you have a bit of old code to share?

(6 edits) (+1)

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)

(2 edits)

this is incredibly helpful, wow!! thank you so much for getting back to me, especially on such an old comment of yours - you're the best <3

i had a big followup question here but i solved it so i edited it out lol. tysm!

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