switch expression; no image tag associated with the speaking character?

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.
Post Reply
Message
Author
User avatar
arzenpai
Newbie
Posts: 14
Joined: Thu Apr 15, 2021 8:21 am
Projects: It's Just a Phase VN
itch: arzenpai
Discord: arzenpai
Contact:

switch expression; no image tag associated with the speaking character?

#1 Post by arzenpai »

hello! new to renpy so im still struggling; am confused if this is a bug, but likely i just mistyped something,,,,

i wanted this character zephyr to switch their original expression (normal) to a second expression (sad)
but i am getting this:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 411, in script
    zeph sad "\"Your fault for not paying attention.\""
Exception: Say has image attributes (u'sad',), but there's no image tag associated with the speaking character.
with the full traceback of:

Code: Select all

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 411, in script
    zeph sad "\"Your fault for not paying attention.\""
  File "renpy/ast.py", line 721, in execute
    renpy.exports.say(who, what, *args, **kwargs)
  File "renpy/exports.py", line 1419, in say
    who(what, *args, **kwargs)
  File "renpy/character.py", line 1189, in __call__
    old_attr_state = self.handle_say_attributes(False, interact)
  File "renpy/character.py", line 1001, in handle_say_attributes
    if self.resolve_say_attributes(predicting, attrs):
  File "renpy/character.py", line 927, in resolve_say_attributes
    raise Exception("Say has image attributes %r, but there's no image tag associated with the speaking character." % (attrs,))
Exception: Say has image attributes (u'sad',), but there's no image tag associated with the speaking character.
---
i used this code to define my character callbacks and stuff:

Code: Select all

define zeph = Character("Zephyr",
                        who_color="#795d3d",
                        callback=active_Zephyr)
^ in the script.rpy file

Code: Select all

#Zephyr
init python:
    def active_Zephyr(event, interact=True, **kwargs):
        global current_speaker
        if not interact:
            return

        if event == "begin":
            current_speaker = 'Zephyr'
            renpy.music.play("audio/softestblip.wav", channel="blips")

        if event == "slow_done":
            renpy.music.stop(channel="blips")


image zephyr normal = ConditionSwitch(
    "current_speaker == 'Zephyr'", "zephyr normal.png",
    "current_speaker != 'Zephyr'", im.MatrixColor("zephyr normal.png", im.matrix.saturation(0.4) * im.matrix.brightness(-0.2)),
    "current_speaker == 'Max'", im.MatrixColor("zephyr normal.png", im.matrix.saturation(0.4) * im.matrix.brightness(-0.2)))

image zeph sad= ConditionSwitch(
    "current_speaker == 'Zephyr'", "images/zephyr sad.png",
    "current_speaker != 'Zephyr'", im.MatrixColor("images/zephyr sad.png", im.matrix.saturation(0.4) * im.matrix.brightness(-0.2)),
    "current_speaker == 'Max'", im.MatrixColor("images/zephyr sad.png", im.matrix.saturation(0.4) * im.matrix.brightness(-0.2)))
^ in images.rpy file (for callbacks)
aaaaaaaaaaand

Code: Select all

    show athena happy at placement2
    show arthur happy at placement3
    show zephyr normal at placement4
    with dissolve

    mc "{i}I nearly jump out of my skin and turn my head to see my younger brother looking at us.{/i}"
    mc "{i}He has his phone in his hand, but he looks sleepy.{/i}"

    mc "\"Jesus Christ, Zeph, don't spook me like that.\""

    zeph sad "\"Your fault for not paying attention.\""
    zeph normal "\"Anyway, mom and dad want us in the car already. Going home in a few, apparently.\""
^ this is the code where im trying to have the switch of expression happen

---
i have checked the names of the files and it matches with the supposed image tag (zephyr sad.png) but i still get the same exception
i have tried:
  • switching the names of the tag (zephyr frown.png / zephyr lookaway.png / zephyr side.png) as well as the corresponding code
  • putting @ before the tag in the script (zeph @ sad / zeph @ normal) so it would switch from normal, to sad but it didnt work
mybe im just overlooking something,,,,, thought id ask bc im at my wits end,,,
thank you!
your wonderfully weab senpai
main site here: https://arzenpai.carrd.co
writing portfolio here: https://www.clippings.me/arzenpai

fic and art commissions open!

User avatar
m_from_space
Miko-Class Veteran
Posts: 974
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: switch expression; no image tag associated with the speaking character?

#2 Post by m_from_space »

Hey,

make sure you created a character, that is actually linked with the image tag you are using, e.g.

Code: Select all

define z = Character("Zephyr", ... , image="zeph")

image zeph normal = "zephyr_normal.png"
image zeph sad = "zephyr_sad.png"

label start:
	show zeph normal
	z "Hey, I am normal Zephyr!"
	
	z sad "Hey, now I am sad!"
	z "I am still sad."
	
	z normal "Now I am normal."
	z "Still normal..."
	...
Also there is a missmatch of names in your code, one time it's zephyr, the other time it's zeph:

Code: Select all

image zephyr normal = ConditionSwitch(...)
image zeph sad= ConditionSwitch(...)

User avatar
arzenpai
Newbie
Posts: 14
Joined: Thu Apr 15, 2021 8:21 am
Projects: It's Just a Phase VN
itch: arzenpai
Discord: arzenpai
Contact:

Re: switch expression; no image tag associated with the speaking character?

#3 Post by arzenpai »

m_from_space wrote: Tue Jan 25, 2022 11:13 am Hey,

make sure you created a character, that is actually linked with the image tag you are using, e.g.

Code: Select all

define z = Character("Zephyr", ... , image="zeph")

image zeph normal = "zephyr_normal.png"
image zeph sad = "zephyr_sad.png"

label start:
	show zeph normal
	z "Hey, I am normal Zephyr!"
	
	z sad "Hey, now I am sad!"
	z "I am still sad."
	
	z normal "Now I am normal."
	z "Still normal..."
	...
Also there is a missmatch of names in your code, one time it's zephyr, the other time it's zeph:

Code: Select all

image zephyr normal = ConditionSwitch(...)
image zeph sad= ConditionSwitch(...)
hooboi, thank you so much! that's definitely what i missed while i was coding
(which is sorta stupid, since the other charas before zeph were linked properly)

everything works perfectly now!
your wonderfully weab senpai
main site here: https://arzenpai.carrd.co
writing portfolio here: https://www.clippings.me/arzenpai

fic and art commissions open!

Post Reply

Who is online

Users browsing this forum: No registered users