Instant CG and BG gallery

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
El Caminante
Newbie
Posts: 24
Joined: Fri Aug 14, 2015 4:09 pm
Contact:

Re: Instant CG and BG gallery

#121 Post by El Caminante »

Hello , I wonder if this would add to the custom code sections for each character having the character name tag and go to your personal gallery

canonic22
Regular
Posts: 27
Joined: Mon Oct 26, 2015 11:33 am
Tumblr: akira
Deviantart: akira
Github: akira
Contact:

Re: Instant CG and BG gallery

#122 Post by canonic22 »

Hello, I wanted to ask you, is the code for unlock the CG is different or something else ?
Because when I commenting out this code g_cg.unlock(gal_item) , my room.jpg is in the CG gallery, but when I not commenting it, the image is replace with unlocked picture.

Thanks

El Caminante
Newbie
Posts: 24
Joined: Fri Aug 14, 2015 4:09 pm
Contact:

Re: Instant CG and BG gallery

#123 Post by El Caminante »

As you complete your code ?
Maybe just a problem of order among pictures

User avatar
karorogunso
Newbie
Posts: 6
Joined: Mon Nov 24, 2014 10:01 am
Projects: Bluebird
IRC Nick: karorogunso
Github: karorogunso
Location: Thailand
Contact:

Re: Instant CG and BG gallery

#124 Post by karorogunso »

awesome code for make some new template :D

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

Re: Instant CG and BG gallery

#125 Post by Imperf3kt »

Hi. I notice you should probably explain to people what "define your images" means. It took me around 5 minutes to work out that you meant add an init block above cg gallery which defines the images. If anyone else can't figure the common error out, this is how to fix it.

Code: Select all

#CG Gallery

init-1:
    image image1 = "image1.png"
    image image2 = "image2.png"
    ## and so on

init python:
    #Galleries settings - start
Anyway, I initially never thought I'd need to join these forums, I thought that browsing the available answers should be all I needed, but I've come across an issue that I can't understand.

On the CG Gallery, I'm testing it with my characters.
When I "see" the first two images, they unlock in the gallery perfectly, as expected.
My problem is that the final CG does NOT unlock, even though I've "seen" it.

Could this be caused by the fact it's used only once as a "show image2 at left as image1".
I'm not understanding this and the documentation on galleries very.... confusing for beginners.

User avatar
Puppeteer
Newbie
Posts: 3
Joined: Sun Dec 13, 2015 8:48 am
Projects: SGW: Jinx (KN); SGW: Vampire's Garden (ADV)
Contact:

Re: Instant CG and BG gallery

#126 Post by Puppeteer »

This is a great resource for adding galleries. Every needed piece does get covered somewhere in this thread: the starting code, adding the buttons for the gallery to the main menu, fixing the pesky "expected image, got displayable" problem.

Being determined to have both a cast gallery for character sprites and a scene gallery for backgrounds, but without having to create images that don't suffer from thumbnail scaling, I tinkered until I found how to tell it to use different criteria for different galleries:

First, you need Leon's code. And it has to work as-is, so make sure it does. (Just to ensure any errors are only from this tweak.)

Second: define your thumbnail types...

At this code
#thumbnail size in pixels:
thumbnail_x = 267
thumbnail_y = 150


Change to this
#thumbnail size in pixels:
cg_thumbnail_x = 150
cg_thumbnail_y = 300
bg_thumbnail_x = 200
bg_thumbnail_y = 150

**or whatever dimensions work best for your images and window size and resolution and all that stuff.

THEN

Change the references to those thumbnails for EACH gallery type.

for gal_item in gallery_cg_items:
renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), thumbnail_x, thumbnail_y))
for gal_item in gallery_bg_items:
renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), thumbnail_x, thumbnail_y))


becomes

for gal_item in gallery_cg_items:
renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), cg_thumbnail_x, cg_thumbnail_y))
for gal_item in gallery_bg_items:
renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), bg_thumbnail_x, bg_thumbnail_y))


and

add g_cg.make_button(gal_item + " butt", gal_item + " butt", im.Scale("gallocked.png", thumbnail_x, thumbnail_y), xalign=0.5, yalign=0.5, idle_border=None, background=None, bottom_margin=24)

becomes

add g_cg.make_button(gal_item + " butt", gal_item + " butt", im.Scale("gallocked.png", cg_thumbnail_x, cg_thumbnail_y), xalign=0.5, yalign=0.5, idle_border=None, background=None, bottom_margin=24)

I was seriously so pleased with myself for getting this to work I declared myself winner of all internets and also danced around the room.

User avatar
vollschauer
Veteran
Posts: 231
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Instant CG and BG gallery

#127 Post by vollschauer »

After staring the whole day at the gallery code I got mostly everything working, but I like to have for each of my characters it's own gallery...
I don't want to have defined xx galleries and build xx gallery screens, I was thinking about something like this:

Code: Select all

init python:
    if persistent.gl_chara is None:
        persistent.gl_chara = "chara1"
    #Galleries settings - start
    #List the CG gallery images here:
    if persistent.gl_chara == "chara1":
        gallery_cg_items = ["cg1",...]
    elif persistent.gl_chara == "chara2":
        gallery_cg_items = ["cg2", ...]
    elif persistent.gl_chara == "chara3":
        gallery_cg_items = ["cg3", ...]
I just set the persistent.gl_chare via imagebuton

Code: Select all

action SetField(persistent, "gl_chara", "chara1")
How can I switch between my characters and get the screen refreshed to rebuild the gallery grid properly?

User avatar
Karizu
Newbie
Posts: 19
Joined: Mon Apr 11, 2016 6:28 am
Completed: AKUMANGEL (IT)
Projects: Akumangel: The Madhouse Swing (ENG-IT)
Organization: Spin.to Studios
Soundcloud: spin-to-studios
Contact:

Re: Instant CG and BG gallery

#128 Post by Karizu »

Hi guys, I know this topic is very old but I'm really confused about one point: how can I move the different frames to adapt them to my personal design? I've attached a picture below to let you see what I'm talking about.
Thank you in advance!
Attachments
This is an example of what I've designed.
This is an example of what I've designed.
Akumangel: The Madhouse Swing: an an investigative-noire visual novel entirely set between the walls of a prestigious mental hospital situated on the outskirts of New York City, during the 40s.
Julia Maine - a young and peculiar detective living in uptown NYC - discovers from her father's old notes that many important men and women, coming from politics or high society, have mysteriously disappeared over the years, under unknown circumstances.
All the researches seem to point to the old St Jeremy House, an ancient manor converted into an asylum, but beside these poor informations, the notes give no sign of hard evidence.
During a period of forced unemployment caused by the critic loss of interesting cases, Julia decides to get hospitalized in the madhouse in order to investigate and resolve the case, firmly convinced that the most of the "mad" patients have actually been kidnapped by some secret organization.
Website: http://akumangeltms.blogspot.com

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

Re: Instant CG and BG gallery

#129 Post by Imperf3kt »

Karizu wrote:Hi guys, I know this topic is very old but I'm really confused about one point: how can I move the different frames to adapt them to my personal design? I've attached a picture below to let you see what I'm talking about.
Thank you in advance!
I'm on a mobile, so excuse my lack of an example. This is purely a suggestion, without studying the code closely, I can't guarantee my suggestion will even work with this.

You could try setting gallery rows to 2 and columns to 1 and the width to one third of the screen then where it creates the thumbnails, adjust the positioning so its centered (default IIRC), making sure the grid is aligned left.

After that, add two more columns to the grid, one centered, and offset as you have it, one aligned right.

If I had more time, I'd probably write you up an example - I did something similar (though not for a CG gallery)

User avatar
Karizu
Newbie
Posts: 19
Joined: Mon Apr 11, 2016 6:28 am
Completed: AKUMANGEL (IT)
Projects: Akumangel: The Madhouse Swing (ENG-IT)
Organization: Spin.to Studios
Soundcloud: spin-to-studios
Contact:

Re: Instant CG and BG gallery

#130 Post by Karizu »

Thank you for your answer. I'm a newbie in programming, so I'm not sure I'll manage to do what you said, but I'll try. In any case, if you have any time later, I'd be grateful for a little coding example of what you described in words.
Akumangel: The Madhouse Swing: an an investigative-noire visual novel entirely set between the walls of a prestigious mental hospital situated on the outskirts of New York City, during the 40s.
Julia Maine - a young and peculiar detective living in uptown NYC - discovers from her father's old notes that many important men and women, coming from politics or high society, have mysteriously disappeared over the years, under unknown circumstances.
All the researches seem to point to the old St Jeremy House, an ancient manor converted into an asylum, but beside these poor informations, the notes give no sign of hard evidence.
During a period of forced unemployment caused by the critic loss of interesting cases, Julia decides to get hospitalized in the madhouse in order to investigate and resolve the case, firmly convinced that the most of the "mad" patients have actually been kidnapped by some secret organization.
Website: http://akumangeltms.blogspot.com

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

Re: Instant CG and BG gallery

#131 Post by Imperf3kt »

I'll need to know if you're just doing a cg gallery, or including backgrounds or anything else. Also, you're probably going to want some buttons on that (switching pages, returning to the main menu etc.

Could you PM this information to me (so we don't annoy everyone checking this thread) and after work I'll try to come up with something for you.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Karizu
Newbie
Posts: 19
Joined: Mon Apr 11, 2016 6:28 am
Completed: AKUMANGEL (IT)
Projects: Akumangel: The Madhouse Swing (ENG-IT)
Organization: Spin.to Studios
Soundcloud: spin-to-studios
Contact:

Re: Instant CG and BG gallery

#132 Post by Karizu »

I answered your questions two days ago by a Private Message, but I'm not sure you received it. Please tell me.
Akumangel: The Madhouse Swing: an an investigative-noire visual novel entirely set between the walls of a prestigious mental hospital situated on the outskirts of New York City, during the 40s.
Julia Maine - a young and peculiar detective living in uptown NYC - discovers from her father's old notes that many important men and women, coming from politics or high society, have mysteriously disappeared over the years, under unknown circumstances.
All the researches seem to point to the old St Jeremy House, an ancient manor converted into an asylum, but beside these poor informations, the notes give no sign of hard evidence.
During a period of forced unemployment caused by the critic loss of interesting cases, Julia decides to get hospitalized in the madhouse in order to investigate and resolve the case, firmly convinced that the most of the "mad" patients have actually been kidnapped by some secret organization.
Website: http://akumangeltms.blogspot.com

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

Re: Instant CG and BG gallery

#133 Post by Imperf3kt »

The gallery doesn't work as I expected.
I don't currently have the time to make one for you, but I can suggest maybe looking into imagbuttons, instead of imagemaps.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Karizu
Newbie
Posts: 19
Joined: Mon Apr 11, 2016 6:28 am
Completed: AKUMANGEL (IT)
Projects: Akumangel: The Madhouse Swing (ENG-IT)
Organization: Spin.to Studios
Soundcloud: spin-to-studios
Contact:

Re: Instant CG and BG gallery

#134 Post by Karizu »

Yes, of course I'm looking into imagebuttons. But I'm probably renouncing and use the standard-shaped gird. Thank you anyway.
Akumangel: The Madhouse Swing: an an investigative-noire visual novel entirely set between the walls of a prestigious mental hospital situated on the outskirts of New York City, during the 40s.
Julia Maine - a young and peculiar detective living in uptown NYC - discovers from her father's old notes that many important men and women, coming from politics or high society, have mysteriously disappeared over the years, under unknown circumstances.
All the researches seem to point to the old St Jeremy House, an ancient manor converted into an asylum, but beside these poor informations, the notes give no sign of hard evidence.
During a period of forced unemployment caused by the critic loss of interesting cases, Julia decides to get hospitalized in the madhouse in order to investigate and resolve the case, firmly convinced that the most of the "mad" patients have actually been kidnapped by some secret organization.
Website: http://akumangeltms.blogspot.com

User avatar
RayDizzle
Regular
Posts: 25
Joined: Tue Jul 28, 2015 9:49 pm
Deviantart: Gem2012
Location: New Zealand
Contact:

Re: Instant CG and BG gallery

#135 Post by RayDizzle »

Hi, I know this thread is quite old but I was quite confused as to how exactly you unlock the gallery images after they've been shown in the script.rpy file. The rest of it works fine, I just need to know how to actually unlock the images. Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users