Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
So it seems like it would be convenient to use character callbacks to automatically add the "speaking" attribute to the character's sprite (the main one, not a side image) when they say something, and remove it when they're done. Is there any way to dynamically add or remove an attribute, like "speaking", to a shown image tag?
Hm. Lacking renpy.add_showing_attribute(tag) and renpy.remove_showing_attribute(tag) functions (I've looked for them and can't find them -- if they *do* exist and I just can't find them in the docs please let me know), it seems like an algorithm something like this might work?
def speaking_callback_pseudocode():
for tag in renpy.get_showing_tags():
if "speaking" in renpy.get_attributes(tag):
current_attrs = renpy.get_attributes(tag)
remove "speaking" from current_attrs
reshow image tag with current_attrs # hm, I don't actually see a renpy.show_image(tag, attrs) function in the docs?
speaker_tag = renpy.get_say_image_tag()
reshow image speaker_tag with current_attrs+"speaking"