(SOLVED) Side Image with custom name

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
ThicBit
Newbie
Posts: 5
Joined: Mon May 09, 2022 10:27 pm
Contact:

(SOLVED) Side Image with custom name

#1 Post by ThicBit »

Hello everyone! I am VERY new when it comes to making games with Renpy. I am having a blast so far, but I have come across an issue that I can't seem to fix. I want to display a side image for my main character, but it doesn't seem to work, and I think it's because my character has a custom name....???? I'm not sure.

I wanted my main character to have a name that can be inputted by the player so I did the code:

Code: Select all

define m = Character("[name]", image="main")

default m = "Nim"

    $ m = renpy.input("What's your name?", default="Nim", length=20)

and then for the side images this is the code that I have

Code: Select all

image define main happy = "side_main_happy.png"

image define main normal = "side_main_normal.png"

init python:
     config.side_image_tag = "main"
but whenever I type

m happy

m normal

this is the error i get
" who(what, interact=interact, *args, **kwargs)
Exception: Say has image attributes (u'normal',), but there's no image tag associated with the speaking character. "

If anyone could help me, I would really appreciate it! I am struggling so hard out here.
Thank you :)
Last edited by ThicBit on Tue May 10, 2022 4:59 pm, edited 1 time in total.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: (PLEASE HELP) Side Image with custom name

#2 Post by rayminator »

one thing I can tell don't use main

don't use default names like:

main
start
system
define
default
etc...

try to use a unique names

more info here
https://www.renpy.org/doc/html/side_ima ... ide-images

ThicBit
Newbie
Posts: 5
Joined: Mon May 09, 2022 10:27 pm
Contact:

Re: (PLEASE HELP) Side Image with custom name

#3 Post by ThicBit »

Okay so i named everything better so now it looks like this:

Code: Select all

define m = Character("[name]", image="nim")

default m = "Nim"

    $ m = renpy.input("What's your name?", default="Nim", length=20)
    

Code: Select all

image define nim happy = "side_nim_happy.png"

image define nim normal = "side_nim_normal.png"

init python:
     config.side_image_tag = "nim"
But it sadly didn't really change anything. I still get the error message when i put

m normal "this is me normal"

in the script

I feel like I maybe didn't properly define the character or something? I just don't know what to do

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: (PLEASE HELP) Side Image with custom name

#4 Post by Alex »

ThicBit wrote: Tue May 10, 2022 12:13 am ...I feel like I maybe didn't properly define the character or something? I just don't know what to do
Looks like - you are using 'm' to define character then store string 'Nim' in it and then store players input.

Code: Select all

define m = Character("[name]", image="nim")
here you make your character take its name from variable 'name', so try

Code: Select all

define m = Character("[name]", image="nim")

default name = "Nim"

label start:
    $ name = renpy.input("What's your name?", default=name, length=20)
    m "My name is [name]"
As for images, you gave your character image property 'nim', so images should be named like
image nim normal = ""
image nim happy = ""
image side nim normal = ""

viewtopic.php?f=4&t=60845#p537336
https://www.renpy.org/doc/html/dialogue.html

ThicBit
Newbie
Posts: 5
Joined: Mon May 09, 2022 10:27 pm
Contact:

Re: (PLEASE HELP) Side Image with custom name

#5 Post by ThicBit »

Code: Select all

define m = Character("[name]", image="m")

label start:

	default name = "Nim"

    	$ name = renpy.input("What's your name?", default="Nim", length=20)

    pause 3

    show bedroom

    m happy "My name is [name]"
Okay so I made the changes, and It seems like a step in the right direction because I didn't get an error message. But there is still no side image when I put "m happy" next to the dialogue.

Code: Select all


image side m happy = "side_m_happy.png"

image side m normal = "side_m_normal.png"

init python:
     config.side_image_tag = "m"
I changed the images names to "m" just to keep it consistent with the defined character. Im not sure if maybe that messed it up??????

Thank you guys for helping me btw! I am trying my best to learn :P

User avatar
Zelan
Lemma-Class Veteran
Posts: 2436
Joined: Tue Mar 01, 2016 7:23 pm
Completed: The Dark
Projects: Cosplay Couple
Tumblr: evns
itch: Zelan
Discord: ltnkitsuragi#7082
Contact:

Re: (PLEASE HELP) Side Image with custom name

#6 Post by Zelan »

I literally just got side images to work in my own project so I've been looking at your code for like 10 minutes and I cannot figure out what's wrong with it lol. Probably a dumb question but do you have the images in the image folder? And maybe check the sizing on them as well, if they're too small or too big they may not display properly.

ThicBit
Newbie
Posts: 5
Joined: Mon May 09, 2022 10:27 pm
Contact:

Re: (PLEASE HELP) Side Image with custom name

#7 Post by ThicBit »

OMGGGGG I GOT IT TO WORK!!!

It was indeed a sizing issue. My side image was the same resolution as my game. I switched the size down to about 400x400 and it works perfectly now.

Thank you guys so much!

User avatar
Zelan
Lemma-Class Veteran
Posts: 2436
Joined: Tue Mar 01, 2016 7:23 pm
Completed: The Dark
Projects: Cosplay Couple
Tumblr: evns
itch: Zelan
Discord: ltnkitsuragi#7082
Contact:

Re: (SOLVED) Side Image with custom name

#8 Post by Zelan »

AH NICE glad I could help!! literally image sizing is the bane of my existence lol

Good luck on your project! I'll look forward to seeing it if you post it (:

Post Reply

Who is online

Users browsing this forum: Google [Bot]