<Solved>Side image for main 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
Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

<Solved>Side image for main character

#1 Post by Ace94 » Mon Oct 30, 2017 1:10 pm

Hi. I am having some trouble with the side image for the main character. The other character/s seem to work correctly with the side image, but once it's time for the mc to speak it crashes the game and I really don't understand why.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 81, in script
    mc serious "Nice to meet you, {color=#444444}{b}Jack{/b}{/color}."
  File "renpy/common/00library.rpy", line 249, in say
    who(what, interact=interact)
Exception: Say has image attributes (u'serious',), but there's no image tag associated with the speaking character.

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

Full traceback:
  File "game/script.rpy", line 81, in script
    mc serious "Nice to meet you, {color=#444444}{b}Jack{/b}{/color}."
  File "E:\Install Stuff\Renpy\renpy-6.99.12.4-sdk\renpy\ast.py", line 613, in execute
    renpy.exports.say(who, what, interact=self.interact)
  File "E:\Install Stuff\Renpy\renpy-6.99.12.4-sdk\renpy\exports.py", line 1145, in say
    renpy.store.say(who, what, interact=interact)
  File "renpy/common/00library.rpy", line 249, in say
    who(what, interact=interact)
  File "E:\Install Stuff\Renpy\renpy-6.99.12.4-sdk\renpy\character.py", line 819, in __call__
    self.resolve_say_attributes(False, wanted=speaking)
  File "E:\Install Stuff\Renpy\renpy-6.99.12.4-sdk\renpy\character.py", line 743, 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'serious',), but there's no image tag associated with the speaking character.

Windows-7-6.1.7601-SP1
Ren'Py 6.99.12.4.2187
It says there's no image tag associated with the main character, but there is? The main character is defined like so: "mc" and the image is "side_mc_serious.png" Any help would be appreciated greatly.

Edit: Also for some reason (only) the Main Character doesn't appear in the text history screen. Anyone knows why?
Last edited by Ace94 on Tue Oct 31, 2017 9:31 am, edited 1 time in total.

User avatar
Reinoka
Newbie
Posts: 9
Joined: Fri Oct 14, 2016 11:10 pm
Deviantart: reinoka
Contact:

Re: Side image for main character

#2 Post by Reinoka » Mon Oct 30, 2017 2:27 pm

After some google searching, I found a topic that seems to relate to this: viewtopic.php?p=305178
But since the topic is several years old, I don't know if the solution there will work for you.

As for your second issue, if the main character's lines aren't being run, since the game is crashing, then I don't think they would show up in the text history screen.

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: Side image for main character

#3 Post by Ace94 » Mon Oct 30, 2017 2:39 pm

Reinoka wrote:
Mon Oct 30, 2017 2:27 pm
After some google searching, I found a topic that seems to relate to this: viewtopic.php?p=305178
But since the topic is several years old, I don't know if the solution there will work for you.

As for your second issue, if the main character's lines aren't being run, since the game is crashing, then I don't think they would show up in the text history screen.
Yeah, I actually saw that thread and tried what was suggested, but it didn't work.

Also, even if I remove the side image for the Main Character and the game work fine until then, he still doesn't appear in the text history screen even though other characters appear.

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Too many, check signature
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: Side image for main character

#4 Post by mikolajspy » Mon Oct 30, 2017 3:59 pm

Naming the file is another thing, but do you have it defined?
Something like

Code: Select all

image mc serious = "side_mc_serious.png"
If you're using Ren'Py auto definition, I think changing folder structure and renaming file to "mc/serious.png" might help.

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: Side image for main character

#5 Post by Ace94 » Mon Oct 30, 2017 4:07 pm

I did. Here's the whole code I use:

Code: Select all

define mc = Character("[mc]",
        color = "#85B200",
        image = "mc")
image side mc serious = "side_image/side_mc_serious.png"
No progress so far... this is really bugging me.

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Too many, check signature
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: Side image for main character

#6 Post by mikolajspy » Mon Oct 30, 2017 4:31 pm

Hm... I don't see big issue with code, something similar works for me, but...
RenPy is sometimes sensitive about intendation, so maybe try something like this?

Code: Select all

define mc = Character("[mc]", color = "#85B200", image = "mc")
image side mc serious = "side_image/side_mc_serious.png"

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: Side image for main character

#7 Post by Ace94 » Mon Oct 30, 2017 4:59 pm

mikolajspy wrote:
Mon Oct 30, 2017 4:31 pm
Hm... I don't see big issue with code, something similar works for me, but...
RenPy is sometimes sensitive about intendation, so maybe try something like this?

Code: Select all

define mc = Character("[mc]", color = "#85B200", image = "mc")
image side mc serious = "side_image/side_mc_serious.png"
Got the exact same error.

User avatar
Reinoka
Newbie
Posts: 9
Joined: Fri Oct 14, 2016 11:10 pm
Deviantart: reinoka
Contact:

Re: Side image for main character

#8 Post by Reinoka » Mon Oct 30, 2017 7:47 pm

Perhaps it's your project. If you create a new project on Ren'Py and use that specific code, does it still give you an error?

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: Side image for main character

#9 Post by Ace94 » Mon Oct 30, 2017 7:56 pm

Reinoka wrote:
Mon Oct 30, 2017 7:47 pm
Perhaps it's your project. If you create a new project on Ren'Py and use that specific code, does it still give you an error?
Yep. It still gives error...


Maybe it has something to do with the fact that the player's choose their own name? I am really clueless, but here is the rest of the code for 'mc' after label start:

Code: Select all

    $ mc = renpy.input("Choose your character's name", length=10)

    $ mc = mc.strip()
    
    if mc == "":
        $ mc="John"

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Side image for main character

#10 Post by Divona » Mon Oct 30, 2017 9:19 pm

Alert. Character and player name use the same variable "mc". Here is the fix:

Code: Select all

default player_name = "John"

define mc = Character("[player_name]", color = "#85B200", image = "mc")
image side mc serious = "side_image/side_mc_serious.png"
Completed:
Image

User avatar
PyTom
Ren'Py Creator
Posts: 15563
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Side image for main character

#11 Post by PyTom » Mon Oct 30, 2017 9:48 pm

Add

Code: Select all

image mc serious = Null()
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: Side image for main character

#12 Post by Ace94 » Mon Oct 30, 2017 10:13 pm

Divona wrote:
Mon Oct 30, 2017 9:19 pm
Alert. Character and player name use the same variable "mc". Here is the fix:

Code: Select all

default player_name = "John"

define mc = Character("[player_name]", color = "#85B200", image = "mc")
image side mc serious = "side_image/side_mc_serious.png"
This didn't seem to change anything. Still getting the error.
PyTom wrote:
Mon Oct 30, 2017 9:48 pm
Add

Code: Select all

image mc serious = Null()
Where should I add this line? I tried adding it where I placed the image side at, but it didn't help.
Last edited by Ace94 on Tue Oct 31, 2017 9:25 am, edited 1 time in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3221
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Side image for main character

#13 Post by Imperf3kt » Mon Oct 30, 2017 11:41 pm

Have you tried clearing persistent data, just in case?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

User avatar
Ibitz
Regular
Posts: 63
Joined: Thu Jul 27, 2017 4:47 pm
Projects: Magical Disarray (WIP)
Organization: Ibitz Visual Novels
Deviantart: http://ibitz.deviant
itch: ibitz
Contact:

Re: Side image for main character

#14 Post by Ibitz » Tue Oct 31, 2017 12:21 am

Would something like this help, perhaps?

Code: Select all

image mc_side = ConditionSwitch(
"mc == 'serious'", "side_image/side_mc_serious.png",
"True", Null()
)
Image

Ibitz is a self-taught coder/artist who works alone on their games. All games I create are freeware. If you need any help with coding or creating your game, just let me know. I'd be more than happy to help.

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: Side image for main character

#15 Post by Ace94 » Tue Oct 31, 2017 9:18 am

Tried both suggestions and I am still getting an error. I even made a brand new project to see if I somehow messed up the code, but the result is still the same. I can't believe I am the only one having trouble with this though as I haven't seen any thread on the matter (there is only one 3 years old...outdated)

Ok. Big update! @Divona was right.
Divona wrote:
Mon Oct 30, 2017 9:19 pm
Alert. Character and player name use the same variable "mc". Here is the fix:

Code: Select all

default player_name = "John"

define mc = Character("[player_name]", color = "#85B200", image = "mc")
image side mc serious = "side_image/side_mc_serious.png"
This worked I just forgot to change every single line here:

Code: Select all

    $ player_name = renpy.input("Choose your character's first name, length=10)

    $ player_name = player_name.strip()

    if player_name == "":
        $ player_name="John"
Thank you sooooooooo much! And thank you to everyone else who tried to help me I really appreciate it. This was a big issue for me and I wouldn't have released my first version of my game if I didn't find a fix for this. This also fixed my second issue in the original post where the Main Player Character doesn't show in the text history screen. Well, now he shows correctly as well! 2 birds with 1 stone.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Jacksono