[Solved]How to make a gallery

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
rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: How to make a gallery

#31 Post by rayminator »

poorlyformed wrote: Thu Feb 15, 2018 5:08 pm okay, just use

Code: Select all

imagebutton "YOURIMAGENAME.png" action Return() alt _("Return") xalign 0.5 yalign 0.5
I get this

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/gallery.rpy", line 109: expected a keyword argument, colon, or end of line.
    imagebutton "ReturnButton.png" action Return() alt _("Return") xalign 0.5 yalign 0.5
                ^

Ren'Py Version: Ren'Py 6.99.14.1.3218
Thu Feb 15 16:41:21 2018

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

Re: How to make a gallery

#32 Post by rayminator »

Update:

I have figure out how to change textbutton into and image

this is the code if anybody need it

Code: Select all

imagebutton idle im.Scale("images/returnbutton.png", 129, 50) hover im.Scale("images/returnbuttonb.png", 129, 50) action Return() xalign 0.5 yalign 0.5

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

Re: [Solved]How to make a gallery

#33 Post by rayminator »

itssherylle1989 wrote: Wed Nov 28, 2018 11:57 am I think you can make an image from the gallery on search by image. All the images there are available and its really work.
this has nothing to do how to make a gallery for renpy and I don't why posted here in the first place when that as nothing to do with this post

Imperf3kt wrote: Wed Feb 14, 2018 5:13 am Okay, you mention having to remove

Code: Select all

init +1 python:
    #Here we create the thumbnails. We use a special "locked" image for CGs to prevent spoilers.
    for gal_item in gallery_cg_items:
        renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), thumbnail_x, thumbnail_y))
so your game test can work?
I don't really understand what you mean by that, but without that chunk of code, the gallery shouldn't work.

Is there a particular reason you need to remove it? I don't really understand what you mean by game test.
hey there... there was one thing was missing

it's this code here

something like this

Code: Select all

$ persistent.unlock_62 = True

Harimak
Newbie
Posts: 10
Joined: Tue Sep 08, 2020 12:14 am
Deviantart: KimisuCandy
Contact:

Re: [Solved]How to make a gallery

#34 Post by Harimak »

Hi! I've been trying to make the gallery, the code provided by Leo/@Imperf3kt really helped me. The problem is that something happened ...
T_T)!
When I make the gallery, I get this:
https://images2.imgbox.com/52/29/fHxRmzOh_o.png

I don't know what to do, I've already tried to move some codes but it's the same. I am very new to renpy, I have the latest update.

i have> 1280x720 screen

My CG gallery

Code: Select all

#CG Gallery

init-1:
    image cg1 = "cg1.png"
    image cg2 = "cg2.png"
    image cg3 = "cg3.png"
    image cg4 = "cg4.png"
    image cg5 = "cg5.png"
    image cg6 = "cg6.png"

init python:
    #Galleries settings - start
    #list the CG gallery images here:
    gallery_cg_items = ["cg1", "cg2", "cg3", "cg4", "cg5", "cg6"]
    #how many rows and columns in the gallery screens?
    gal_rows = 3
    gal_cols =  3
    #thumbnail size in pixels:c
    thumbnail_x = 200
    thumbnail_y = 150
    #the setting above will work well with 4:3 screen ratio. Make sure to adjust it, if your are using 16:9 (such as 267x150) or something else.
    #Galleries settings - end
    
    gal_cells = gal_rows * gal_cols    
    g_cg = Gallery()
    for gal_item in gallery_cg_items:
        g_cg.button(gal_item + " butt")
        g_cg.image(gal_item)
        g_cg.unlock(gal_item)
    g_cg.transition = fade
    cg_page=0
    
init +1 python:
    #Here we create the thumbnails. We use a special "locked" image for CGs to prevent spoilers.
    for gal_item in gallery_cg_items:
        renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), thumbnail_x, thumbnail_y))
        
screen cg_gallery():
    tag menu
    use game_menu(_("Image Gallery"), scroll="viewport"):
        hbox:
            grid gal_cols gal_rows:
                spacing 35
                $ i = 0
                $ next_cg_page = cg_page + 1            
                if next_cg_page > int(len(gallery_cg_items)/gal_cells):
                    $ next_cg_page = 0
                for gal_item in gallery_cg_items:
                    $ i += 1
                    if i <= (cg_page+1)*gal_cells and i>cg_page*gal_cells:
                        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=0)
                for j in range(i, (cg_page+1)*gal_cells):
                    
                    null
            frame:
                xpos 35
                ypos 45
                if len(gallery_cg_items)>gal_cells:
                    textbutton _("Next Page") action [SetVariable('cg_page', next_cg_page), ShowMenu("cg_gallery")]
Screen:
https://pastebin.com/YmfJtzUU

QwQ)_

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

Re: [Solved]How to make a gallery

#35 Post by rayminator »

Harimak wrote: Tue Sep 08, 2020 2:55 pm Hi! I've been trying to make the gallery, the code provided by Leo/@Imperf3kt really helped me. The problem is that something happened ...
T_T)!
When I make the gallery, I get this:
https://images2.imgbox.com/52/29/fHxRmzOh_o.png

I don't know what to do, I've already tried to move some codes but it's the same. I am very new to renpy, I have the latest update.

i have> 1280x720 screen

My CG gallery

Code: Select all

#CG Gallery

init-1:
    image cg1 = "cg1.png"
    image cg2 = "cg2.png"
    image cg3 = "cg3.png"
    image cg4 = "cg4.png"
    image cg5 = "cg5.png"
    image cg6 = "cg6.png"

init python:
    #Galleries settings - start
    #list the CG gallery images here:
    gallery_cg_items = ["cg1", "cg2", "cg3", "cg4", "cg5", "cg6"]
    #how many rows and columns in the gallery screens?
    gal_rows = 3
    gal_cols =  3
    #thumbnail size in pixels:c
    thumbnail_x = 200
    thumbnail_y = 150
    #the setting above will work well with 4:3 screen ratio. Make sure to adjust it, if your are using 16:9 (such as 267x150) or something else.
    #Galleries settings - end
    
    gal_cells = gal_rows * gal_cols    
    g_cg = Gallery()
    for gal_item in gallery_cg_items:
        g_cg.button(gal_item + " butt")
        g_cg.image(gal_item)
        g_cg.unlock(gal_item)
    g_cg.transition = fade
    cg_page=0
    
init +1 python:
    #Here we create the thumbnails. We use a special "locked" image for CGs to prevent spoilers.
    for gal_item in gallery_cg_items:
        renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), thumbnail_x, thumbnail_y))
        
screen cg_gallery():
    tag menu
    use game_menu(_("Image Gallery"), scroll="viewport"):
        hbox:
            grid gal_cols gal_rows:
                spacing 35
                $ i = 0
                $ next_cg_page = cg_page + 1            
                if next_cg_page > int(len(gallery_cg_items)/gal_cells):
                    $ next_cg_page = 0
                for gal_item in gallery_cg_items:
                    $ i += 1
                    if i <= (cg_page+1)*gal_cells and i>cg_page*gal_cells:
                        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=0)
                for j in range(i, (cg_page+1)*gal_cells):
                    
                    null
            frame:
                xpos 35
                ypos 45
                if len(gallery_cg_items)>gal_cells:
                    textbutton _("Next Page") action [SetVariable('cg_page', next_cg_page), ShowMenu("cg_gallery")]
Screen:
https://pastebin.com/YmfJtzUU

QwQ)_

that's the frame that's what it looks like

Code: Select all

 frame:
                xpos 35
                ypos 45
                if len(gallery_cg_items)>gal_cells:
                    textbutton _("Next Page") action [SetVariable('cg_page', next_cg_page), ShowMenu("cg_gallery")]]/code]

Harimak
Newbie
Posts: 10
Joined: Tue Sep 08, 2020 12:14 am
Deviantart: KimisuCandy
Contact:

Re: [Solved]How to make a gallery

#36 Post by Harimak »

It has worked! thank you
(⌒‿⌒) \(≧▽≦)/ ⌒(o^▽^o)ノ ヽ(*⌒▽⌒*)ノ
Q____q)!!

Post Reply

Who is online

Users browsing this forum: Google [Bot]