$ renpy.show and image directory

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.
Message
Author
numaej
Newbie
Posts: 22
Joined: Fri Dec 21, 2018 9:24 am
Contact:

$ renpy.show and image directory

#1 Post by numaej »

I ran onto a weird problem, and I have no clue how to solve this issue. Basically, when my images are put directly in 'images' folder, everything works just fine. The problem is that I decided to organize everything a little bit, because it started to get really messy and hard to follow. I created new subfolders in images folder for every chapter of my game and in these subfolders, I created another subfolders for every location where the action takes place. Now instead of having individual number per each render or unique name, they are all named, let's say, from 1-10 but since they are in different folders there's no problem with it. It makes coding way easier for me, I guess. Now, the problem is that renpy clearly can't find the path to those images. But why? Should I define them and how?

I need to use this code, because as you may see each render has a different filter attached to it [which is chosen by the player]

now this code works just fine if the image named '1' is directly in the images folder

Code: Select all

$ renpy.show("1"+persistent.filter)
but with what was said earlier, now I have a lot of '1' images divided in all of subfolders, and when I'm trying to create a path renpy doesn't see the image.
example

Code: Select all

$ renpy.show("ch1/home/1"+persistent.filter)
So, how the hell should it be done?

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: $ renpy.show and image directory

#2 Post by hell_oh_world »

numaej wrote: Wed Aug 28, 2019 4:51 pm I ran onto a weird problem, and I have no clue how to solve this issue. Basically, when my images are put directly in 'images' folder, everything works just fine. The problem is that I decided to organize everything a little bit, because it started to get really messy and hard to follow. I created new subfolders in images folder for every chapter of my game and in these subfolders, I created another subfolders for every location where the action takes place. Now instead of having individual number per each render or unique name, they are all named, let's say, from 1-10 but since they are in different folders there's no problem with it. It makes coding way easier for me, I guess. Now, the problem is that renpy clearly can't find the path to those images. But why? Should I define them and how?

I need to use this code, because as you may see each render has a different filter attached to it [which is chosen by the player]

now this code works just fine if the image named '1' is directly in the images folder

Code: Select all

$ renpy.show("1"+persistent.filter)
but with what was said earlier, now I have a lot of '1' images divided in all of subfolders, and when I'm trying to create a path renpy doesn't see the image.
example

Code: Select all

$ renpy.show("ch1/home/1"+persistent.filter)
So, how the hell should it be done?
Renpy treats all the images in the images directory and in ts sub folders as directly placed into itself. So technically 1 is the same as of those 1 in other subfolders... See this doc.
https://www.renpy.org/doc/html/displayi ... -directory
This process takes place in all directories underneath the image directory. For example, all of these files will define the image eileen happy:

Code: Select all

game/images/eileen happy.png
game/images/Eileen Happy.jpg
game/images/eileen/eileen happy.png
Last edited by hell_oh_world on Wed Aug 28, 2019 5:17 pm, edited 1 time in total.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: $ renpy.show and image directory

#3 Post by Remix »

It is unclear whether you are using image references or actual filenames...
Is the filter a string that is added within the filename or at the end of a reference?

If as part of a reference, lose the / separators and use spaces or underscores
If using filenames, include images/ at the start and the .webp or .png at the end
Frameworks & Scriptlets:

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: $ renpy.show and image directory

#4 Post by hell_oh_world »

numaej wrote: Wed Aug 28, 2019 4:51 pm I ran onto a weird problem, and I have no clue how to solve this issue. Basically, when my images are put directly in 'images' folder, everything works just fine. The problem is that I decided to organize everything a little bit, because it started to get really messy and hard to follow. I created new subfolders in images folder for every chapter of my game and in these subfolders, I created another subfolders for every location where the action takes place. Now instead of having individual number per each render or unique name, they are all named, let's say, from 1-10 but since they are in different folders there's no problem with it. It makes coding way easier for me, I guess. Now, the problem is that renpy clearly can't find the path to those images. But why? Should I define them and how?

I need to use this code, because as you may see each render has a different filter attached to it [which is chosen by the player]

now this code works just fine if the image named '1' is directly in the images folder

Code: Select all

$ renpy.show("1"+persistent.filter)
but with what was said earlier, now I have a lot of '1' images divided in all of subfolders, and when I'm trying to create a path renpy doesn't see the image.
example

Code: Select all

$ renpy.show("ch1/home/1"+persistent.filter)
So, how the hell should it be done?
Also, you need to define the file extension of the image, for Ren'Py to recognize it.

drKlauz
Veteran
Posts: 239
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: $ renpy.show and image directory

#5 Post by drKlauz »

RenPy auto-image definer is ... well, ugly (sorry, PyTom).
I use this: viewtopic.php?f=8&t=56534#p517181
Does exactly what you want for same reasons, it is really annoying to traverse thru hundreds of images with loooong filenames, folders is must for big projects.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: $ renpy.show and image directory

#6 Post by IrinaLazareva »

I would like to add that for the program to work correctly, the name of the file, folder, or directory must begin with a letter, not a number.

numaej
Newbie
Posts: 22
Joined: Fri Dec 21, 2018 9:24 am
Contact:

Re: $ renpy.show and image directory

#7 Post by numaej »

So, the only solution is changing the images names?
Persistent only adds a or b at the end of the image name, that's why I segregated them. Each subfolder contains images named 1a, 1b, 2a, 2b, 3a, 3b...
Defining the extension isn't necessary while using 'show' option, at least it never was for me. On the opposite to 'scene', when defining images was a must.
Previously, I had all of my images directly in the 'images' folder, named with numbers and there was no problem at all.
System easily found the wanted image with the persistent variable.
The problem occurs now, when the images are segregated into subfolders.
Worth mentioning, I guess, my images are flat renders, there ain't any specific actions on them. So, it's basically jumping from a render to a render.

@drKlauz

This is probably what I'm looking for, but sadly the code isn't working for me... I don't know why.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: $ renpy.show and image directory

#8 Post by hell_oh_world »

numaej wrote: Wed Aug 28, 2019 5:50 pm So, the only solution is changing the images names?
Persistent only adds a or b at the end of the image name, that's why I segregated them. Each subfolder contains images named 1a, 1b, 2a, 2b, 3a, 3b...
Defining the extension isn't necessary while using 'show' option, at least it never was for me. On the opposite to 'scene', when defining images was a must.
Previously, I had all of my images directly in the 'images' folder, named with numbers and there was no problem at all.
System easily found the wanted image with the persistent variable.
The problem occurs now, when the images are segregated into subfolders.
Worth mentioning, I guess, my images are flat renders, there ain't any specific actions on them. So, it's basically jumping from a render to a render.

@drKlauz

This is probably what I'm looking for, but sadly the code isn't working for me... I don't know why.
Yeah my bad with that file extension. I didn't realize you were using show.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: $ renpy.show and image directory

#9 Post by hell_oh_world »

numaej wrote: Wed Aug 28, 2019 5:50 pm So, the only solution is changing the images names?
Persistent only adds a or b at the end of the image name, that's why I segregated them. Each subfolder contains images named 1a, 1b, 2a, 2b, 3a, 3b...
Defining the extension isn't necessary while using 'show' option, at least it never was for me. On the opposite to 'scene', when defining images was a must.
Previously, I had all of my images directly in the 'images' folder, named with numbers and there was no problem at all.
System easily found the wanted image with the persistent variable.
The problem occurs now, when the images are segregated into subfolders.
Worth mentioning, I guess, my images are flat renders, there ain't any specific actions on them. So, it's basically jumping from a render to a render.

@drKlauz

This is probably what I'm looking for, but sadly the code isn't working for me... I don't know why.
I'm afraid so... I guess you really should state your image names differently as what the doc. says. Because they'll be treated the same after all. The program that was shared to you may help you atleast.

numaej
Newbie
Posts: 22
Joined: Fri Dec 21, 2018 9:24 am
Contact:

Re: $ renpy.show and image directory

#10 Post by numaej »

Damn, just when I thought, I'm finally done with organizing my stuff...

The drKlauz code seemed so promising...

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: $ renpy.show and image directory

#11 Post by hell_oh_world »

numaej wrote: Wed Aug 28, 2019 6:38 pm Damn, just when I thought, I'm finally done with organizing my stuff...

The drKlauz code seemed so promising...
I took a look at the program. It seems irrelevant I guess because its for file extensions. It just basically strips off the the need for including file extensions when declaring an image.

numaej
Newbie
Posts: 22
Joined: Fri Dec 21, 2018 9:24 am
Contact:

Re: $ renpy.show and image directory

#12 Post by numaej »

Now I ran into another problem, how should I code an renpy animation?

Code: Select all

$ renpy.show("animation"+persistent.filter)
I've created animationa&animationb [for the persistent], defined the images in it... yet renpy tells me that it can't find the image...

The rest after changing the names works just fine.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: $ renpy.show and image directory

#13 Post by hell_oh_world »

numaej wrote: Wed Aug 28, 2019 6:54 pm Now I ran into another problem, how should I code an renpy animation?

Code: Select all

$ renpy.show("animation"+persistent.filter)
I've created animationa&animationb [for the persistent], defined the images in it... yet renpy tells me that it can't find the image...

The rest after changing the names works just fine.
The animation you're talking about is it through atl? or like a movie? If its through atl how did you define the animated images?
Last edited by hell_oh_world on Wed Aug 28, 2019 7:01 pm, edited 1 time in total.

numaej
Newbie
Posts: 22
Joined: Fri Dec 21, 2018 9:24 am
Contact:

Re: $ renpy.show and image directory

#14 Post by numaej »

Simple renpy animation by combining two images.

Code: Select all

image animationa:
    "ch01home1.jpg"
    0.3
    "ch01home2.jpg"
    0.3
I have no idea how to make $ renpy.show command show it.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: $ renpy.show and image directory

#15 Post by hell_oh_world »

numaej wrote: Wed Aug 28, 2019 7:01 pm Simple renpy animation by combining two images.

Code: Select all

image animationa:
    "ch01home1.jpg"
    0.3
    "ch01home2.jpg"
    0.3
I have no idea how to make $ renpy.show command show it.
you should show it with no quotes

$ renpy.show(animationa) ##TOTALLY WRONG!!!
I haven't tried this but this might not work!
Last edited by hell_oh_world on Wed Aug 28, 2019 7:08 pm, edited 3 times in total.

Post Reply

Who is online

Users browsing this forum: Andredron