How to define a bunch of images?

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
bbs3223474
Regular
Posts: 33
Joined: Thu Apr 02, 2015 12:17 am
Contact:

How to define a bunch of images?

#1 Post by bbs3223474 »

Well, engine's tutorial told me that I can use a command like
image bg bg01 = "image/bg01.bmp"
so that I can simply use
scene bg bg01
to load that background image.

But I still have bunch of those images to use like bg02.bmp and so on. It's too tire to define them one by one. So how can I define them all just using a simple command?

User avatar
Zetsubou
Miko-Class Veteran
Posts: 522
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: How to define a bunch of images?

#2 Post by Zetsubou »

For basic define statements, you could use this: https://github.com/koroshiya/renpy-imag ... -simple.py
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

https://zetsubou.games

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: How to define a bunch of images?

#3 Post by xavimat »

You can use config.automatic_images and config.automatic_images_strip:
http://www.renpy.org/doc/html/config.ht ... tic_images
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
bbs3223474
Regular
Posts: 33
Joined: Thu Apr 02, 2015 12:17 am
Contact:

Re: How to define a bunch of images?

#4 Post by bbs3223474 »

Thanks

User avatar
bbs3223474
Regular
Posts: 33
Joined: Thu Apr 02, 2015 12:17 am
Contact:

Re: How to define a bunch of images?

#5 Post by bbs3223474 »

xavimat wrote:You can use config.automatic_images and config.automatic_images_strip:
http://www.renpy.org/doc/html/config.ht ... tic_images
How can I use it?
I've already add this command in options.rpy but when I use

scene bg01

it still can't shows the picture.
So I wondering about whether I made some mistakes because I can't understand how excatlly to use this command.

User avatar
Corvo
Regular
Posts: 29
Joined: Thu Nov 13, 2014 2:42 pm
Deviantart: Corvocollorosso
Contact:

Re: How to define a bunch of images?

#6 Post by Corvo »

bbs3223474 wrote:Well, engine's tutorial told me that I can use a command like
image bg bg01 = "image/bg01.bmp"
so that I can simply use
scene bg bg01
to load that background image.
Are you using bmp images? According to the documentation config.automatic_images works for .png and .jpg files.

User avatar
bbs3223474
Regular
Posts: 33
Joined: Thu Apr 02, 2015 12:17 am
Contact:

Re: How to define a bunch of images?

#7 Post by bbs3223474 »

Corvo wrote:
bbs3223474 wrote:Well, engine's tutorial told me that I can use a command like
image bg bg01 = "image/bg01.bmp"
so that I can simply use
scene bg bg01
to load that background image.
Are you using bmp images? According to the documentation config.automatic_images works for .png and .jpg files.
I converted them into .png files.
Just don't understand what statement should follow behind config.automatic_images =
Opensource project of a Ren'py transplanted game: https://github.com/bbs3223474/HANA16_Renpy

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How to define a bunch of images?

#8 Post by trooper6 »

So, bbs3223474, I've never used that command before, but whenever I have questions about how to use something, I search a) the Documentation and b) search these message boards.

xavimat linked you to the documentation which tell you how to use the command: http://www.renpy.org/doc/html/config.ht ... tic_images
But you say you don't understand what statement should follow behind background image.

So I did a search of the lemmasoft forums for "config.automatic_images"

and came up with a few posts that show a completed version of that command:
In this thread: http://lemmasoft.renai.us/forums/viewto ... es#p352816
PyTom posts the completed command as:

Code: Select all

init python:
    config.automatic_images = [ '_' ]
In this thread: http://lemmasoft.renai.us/forums/viewto ... es#p350451

mjshi posts the completed command as:

Code: Select all

config.automatic_images = [ '_', '/' ]
Going back to the documentation is says:
I
f not None, this causes Ren'Py to automatically define images.

When not set to None, this should be set to a list of separators. (For example, [ ' ', '_', '/' ].)

Ren'Py will scan through the list of files on disk and in archives. When it finds a file ending with .png or .jpg, it will strip the extension, then break the name at separators, to create an image name. If the name consists of at least two components, and no image with that name already is defined, Ren'Py will define that image to refer to a filename.

With the example list of separators, if your game directory contains:

eileen_happy.png, Ren'Py will define the image "eileen happy".
lucy/mad.png, Ren'Py will define the image "lucy mad".
mary.png, Ren'Py will do nothing. (As the image does not have two components.)
So what do you put after "config.automatic_images"? Whatever separator you are using in the way you've named your files.

Look especially at this part:
With the example list of separators, if your game directory contains:

eileen_happy.png, Ren'Py will define the image "eileen happy".
lucy/mad.png, Ren'Py will define the image "lucy mad".
mary.png, Ren'Py will do nothing. (As the image does not have two components.)


So, how are your files organized and named? The answer to that question will dictate what you put after config.automatic_images
If you haven't named or organized your files properly in the first place, you won't get what you want out of config.automatic_images
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
bbs3223474
Regular
Posts: 33
Joined: Thu Apr 02, 2015 12:17 am
Contact:

Re: How to define a bunch of images?

#9 Post by bbs3223474 »

trooper6 wrote:So, bbs3223474, I've never used that command before, but whenever I have questions about how to use something, I search a) the Documentation and b) search these message boards.

xavimat linked you to the documentation which tell you how to use the command: http://www.renpy.org/doc/html/config.ht ... tic_images
But you say you don't understand what statement should follow behind background image.

So I did a search of the lemmasoft forums for "config.automatic_images"

and came up with a few posts that show a completed version of that command:
In this thread: http://lemmasoft.renai.us/forums/viewto ... es#p352816
PyTom posts the completed command as:

Code: Select all

init python:
    config.automatic_images = [ '_' ]
In this thread: http://lemmasoft.renai.us/forums/viewto ... es#p350451

mjshi posts the completed command as:

Code: Select all

config.automatic_images = [ '_', '/' ]
Going back to the documentation is says:
I
f not None, this causes Ren'Py to automatically define images.

When not set to None, this should be set to a list of separators. (For example, [ ' ', '_', '/' ].)

Ren'Py will scan through the list of files on disk and in archives. When it finds a file ending with .png or .jpg, it will strip the extension, then break the name at separators, to create an image name. If the name consists of at least two components, and no image with that name already is defined, Ren'Py will define that image to refer to a filename.

With the example list of separators, if your game directory contains:

eileen_happy.png, Ren'Py will define the image "eileen happy".
lucy/mad.png, Ren'Py will define the image "lucy mad".
mary.png, Ren'Py will do nothing. (As the image does not have two components.)
So what do you put after "config.automatic_images"? Whatever separator you are using in the way you've named your files.

Look especially at this part:
With the example list of separators, if your game directory contains:

eileen_happy.png, Ren'Py will define the image "eileen happy".
lucy/mad.png, Ren'Py will define the image "lucy mad".
mary.png, Ren'Py will do nothing. (As the image does not have two components.)


So, how are your files organized and named? The answer to that question will dictate what you put after config.automatic_images
If you haven't named or organized your files properly in the first place, you won't get what you want out of config.automatic_images
I'm sorry that I'm rookie in programming. All background image was inside bg folder and named bg01a,bg02a,bg03a...... So how should I use them and is this command inside option.rpy?
BTW, I'm Chinese and not so good at English. Sometime a specific example can make me understand easily than a lot of explanation.
Opensource project of a Ren'py transplanted game: https://github.com/bbs3223474/HANA16_Renpy

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]