Show image path error

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
RonPaul2020
Newbie
Posts: 5
Joined: Mon May 30, 2022 12:18 am
Contact:

Show image path error

#1 Post by RonPaul2020 » Mon May 30, 2022 12:34 am

I'm attempting to attach an image into an instance of a custom character class to be used for facial expression, but for reasons unknown if I do not put in the full path for the image up to the C drive, I receive the 'could not find file' exception.

I set the image during the creation of the instance, and all other parts of the class besides the image works so it likely isn't a problem with the class. I have double and triple checked paths, spellings, filetypes, parenthesis and quotation marks. I really don't understand why the game would need up to the C directory in order to find the image.

Any help would be greatly appreciated

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

Re: Show image path error

#2 Post by Alex » Mon May 30, 2022 12:44 pm

Check if your image is in 'your_game_folder/game' or subfolder(s). If image is in 'game' folder it shouldn't complain about path at all, and if it in subfolder(s), you need to specify path starting from subfolder of 'game' folder.

RonPaul2020
Newbie
Posts: 5
Joined: Mon May 30, 2022 12:18 am
Contact:

Re: Show image path error

#3 Post by RonPaul2020 » Mon May 30, 2022 9:16 pm

Thanks Alex, but that doesn't work. I have tried every path possible and only the one that leads back to C: successfully shows the image.
With some experimentation I've got it so that there is no exception crashing the game, but the image still doesn't show.

Is there a limit to the number of sub-folders you can have in /game/? Currently the full path is /MyGame/game/images/character/clothes/image.png

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1882
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Show image path error

#4 Post by Ocelot » Tue May 31, 2022 2:33 am

And how do you specify you image in game?
< < insert Rick Cook quote here > >

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

Re: Show image path error

#5 Post by rayminator » Tue May 31, 2022 8:43 am

it's because you are putting it the wrong way

blah blah blah = hover "" action call

wrong:

Code: Select all

imagebutton idle "MyGame/game/images/character/clothes.png" blah blah blah
right:

Code: Select all

imagebutton idle "images/character/clothes/clothes_01.png" blah blah blah

RonPaul2020
Newbie
Posts: 5
Joined: Mon May 30, 2022 12:18 am
Contact:

Re: Show image path error

#6 Post by RonPaul2020 » Wed Jun 01, 2022 1:01 am

Ocelot wrote:
Tue May 31, 2022 2:33 am
And how do you specify you image in game?
The character object is defined and initalised correctly, using a 'None' as a placeholder for the face attribute.

$ character.face = "images/character/face/character_face.png"

show image character.face

On the scene where the show is called, the error is produced.

RonPaul2020
Newbie
Posts: 5
Joined: Mon May 30, 2022 12:18 am
Contact:

Re: Show image path error

#7 Post by RonPaul2020 » Wed Jun 01, 2022 1:03 am

rayminator wrote:
Tue May 31, 2022 8:43 am
it's because you are putting it the wrong way

blah blah blah = hover "" action call

wrong:

Code: Select all

imagebutton idle "MyGame/game/images/character/clothes.png" blah blah blah
right:

Code: Select all

imagebutton idle "images/character/clothes/clothes_01.png" blah blah blah
Firstly, I'm not trying to do anything with imagebuttons. I'm just trying to show the image itself.

Secondly, I have tried literally every possible variant of the path, including both of the ones you have mentioned. All of them produce the error, except for the one leading back to C:/.

User avatar
m_from_space
Veteran
Posts: 302
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Show image path error

#8 Post by m_from_space » Wed Jun 01, 2022 1:23 am

RonPaul2020 wrote:
Wed Jun 01, 2022 1:01 am
Ocelot wrote:
Tue May 31, 2022 2:33 am
And how do you specify you image in game?
The character object is defined and initalised correctly, using a 'None' as a placeholder for the face attribute.

$ character.face = "images/character/face/character_face.png"

show image character.face

On the scene where the show is called, the error is produced.
There is no command "show image". You are doing it wrong. Just write:

Code: Select all

show expression character.face
The command "image" is used to define images, not to show them.
https://www.renpy.org/doc/html/displaying_images.html

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1882
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Show image path error

#9 Post by Ocelot » Wed Jun 01, 2022 2:49 am

RonPaul2020 wrote:
Wed Jun 01, 2022 1:01 am

$ character.face = "images/character/face/character_face.png"
This is not an image. This is a string. Image displayable does a lot of things, like fixing relative paths, poking archives, doing substitution (if nessesary), etc. You do no such things, so it is no wonder that it didn't work.
If you define objects at init time, I suggest you use Image displayable, otherwise use m_from_space suggestion and use show expression
< < insert Rick Cook quote here > >

RonPaul2020
Newbie
Posts: 5
Joined: Mon May 30, 2022 12:18 am
Contact:

Re: Show image path error

#10 Post by RonPaul2020 » Wed Jun 01, 2022 4:09 am

The command "image" is used to define images, not to show them.
https://www.renpy.org/doc/html/displaying_images.html
I see! Thanks, much appreciated.

Post Reply

Who is online

Users browsing this forum: mold.FF