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.
-
zmook
- Veteran
- Posts: 421
- Joined: Wed Aug 26, 2020 6:44 pm
-
Contact:
#1
Post
by zmook » Fri May 27, 2022 6:22 pm
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?
Basically, how do I automate this?
Code: Select all
show ellen speaking
el "Oh! You're interesting."
show ellen -speaking
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM
-
zmook
- Veteran
- Posts: 421
- Joined: Wed Aug 26, 2020 6:44 pm
-
Contact:
#2
Post
by zmook » Fri May 27, 2022 7:04 pm
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?
Code: Select all
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"
At least, it seems like it might work if renpy.show_image() exists, but I don't see it with the other image functions at
https://www.renpy.org/doc/html/displayi ... -functions
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM
-
philat
- Eileen-Class Veteran
- Posts: 1853
- Joined: Wed Dec 04, 2013 12:33 pm
-
Contact:
#3
Post
by philat » Fri May 27, 2022 8:32 pm
-
zmook
- Veteran
- Posts: 421
- Joined: Wed Aug 26, 2020 6:44 pm
-
Contact:
#4
Post
by zmook » Fri May 27, 2022 9:47 pm
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM
Users browsing this forum: No registered users