[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

#16 Post by rayminator »

I only removed it because it given me init +1 python error

but it fixed itself after i have created a new game

so that part is back in

but the images won't unlock not in less I remove this part g_cg.unlock(gal_item)

If I put it like this #g_cg.unlock(gal_item) to cancel it out all images show

but if it's like this g_cg.unlock(gal_item) it only shows the gallocked image and if I play through the game the image doesn't unlock

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

Re: How to make a gallery

#17 Post by Imperf3kt »

That sounds odd and is unexpected behaviour.

Try updating or reinstalling Ren'Py. There may have been an error during install or your initial download.

When I have enough time to, I'll put together a very basic game which includes a gallery.
You can then test it by placing it in your projects directory. It should work then.


There is one thing I noticed though, in the code you posted earlier. You have 12 items in your list, but only 11 of them actually exist.
Perhaps try changing:

Code: Select all

init python:
    #Galleries settings - start
    #list the CG gallery images here:
    gallery_cg_items = ["bg sc01", "bg sc02", "bg sc03", "bg sc04", "bg sc05", "bg sc06", "bg sc07", "bg sc08", "bg sc09", "bg sc10", "bg sc11", "bg sc12"]
To

Code: Select all

init python:
    #Galleries settings - start
    #list the CG gallery images here:
    gallery_cg_items = ["bg sc01", "bg sc02", "bg sc03", "bg sc04", "bg sc05", "bg sc06", "bg sc07", "bg sc08", "bg sc09", "bg sc10", "bg sc11"]
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

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

Re: How to make a gallery

#18 Post by rayminator »

here is my copy

this from a new copy of renpy my version is Ren'Py 6.99.14.1

and it still won't unlock and same thing if I remove this g_cg.unlock(gal_item)the images show



thanks for the help anyways it doesn't seem to want to work
Last edited by rayminator on Sat Feb 17, 2018 3:28 pm, edited 1 time in total.

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

Re: How to make a gallery

#19 Post by rayminator »

I figure how to use this code here at Image Gallery, Music Room, and Replay Actions on renpy web-page (site down)

but i need to find a to get the image to show after the image been unlocked

Code: Select all

# Call make_button to show a particular button.
        add g.make_button("dark", "gallocked.png", xalign=0.5, yalign=0.5)
        add g.make_button("dawn", "gallocked.png", xalign=0.5, yalign=0.5)
        add g.make_button("end1", "gallocked.png", xalign=0.5, yalign=0.5)

        add g.make_button("end2", "gallocked.png", xalign=0.5, yalign=0.5)
        add g.make_button("end3", "gallocked.png", xalign=0.5, yalign=0.5)
        add g.make_button("end4", "gallocked.png", xalign=0.5, yalign=0.5)

        add g.make_button("dark mary", "gallocked.png", xalign=0.5, yalign=0.5)
        add g.make_button("dawn mary", "gallocked.png", xalign=0.5, yalign=0.5)

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: How to make a gallery

#20 Post by poorlyformed »

That's what I used to make my gallery. Here's my code. I added some notes to explain what everything is and what to change.

Code: Select all

init python:

    g = Gallery()
    
   
    g.button("btn_cg1") ## this creates the button/thumbnail for your gallery. also, everything in quotations you would rename to whatever you're using for your files
    g.condition("persistent.cg1_unlocked") ## you want to make sure you unlock the CG in your script with $ persistent.cg1_unlocked = True (put that where the CG appears)
    g.image ("cg1a") ## this is your CG
    g.image ("cg1b") ## if you want more than one image to show from one thumbnail, just add them into the button,
    g.transition = dissolve
    
    
screen gallery:
    tag menu
    add "gui/menus/gallery_menu_bg.png" 
    use navigation
    default curpage = "main_gal" ## if you have more than one page in your gallery. if you don't, you can delete this.
    
    ## Gallery navigation
    
    imagebutton auto "gui/menus/gallery_main_%s.png" xpos 567 ypos 170 action SetScreenVariable("curpage", "main_gal")  alt _("Main Gallery")
    imagebutton auto "gui/menus/gallery_sean_%s.png" xpos 710 ypos 170 action SetScreenVariable("curpage", "sean_gal")  alt _("Sean's Gallery")


    if curpage == "main_gal":
        add g.make_button("btn_cg1", "thumb_cg1", locked="cglocked", xpadding=0, ypadding=0) xpos 570 ypos 250 
        ## ok, so the first thing in quotations is the name of the button you made above. the second is the name of the thumbnail image, which you would have to create. the third is the locked image, what will show when the CG is still locked. xpadding and ypadding you don't have to worry about unless you're creating a hover border around the image. and then xpos and ypos is to position the image on the page.
        
    if curpage == "sean_gal":
        add g.make_button("btn_cg1", "thumb_cg1", locked="cglocked", xpadding=0, ypadding=0) xpos 570 ypos 250
so the only things you would have to change in this code is the names for all the files (everything in quotation marks) and the positions of the buttons. For example, instead of "btn_cg1" you might want to use "btn_dark" (but you can name them whatever you want, as long as it's consistent and makes sense to you.)
Image

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

Re: How to make a gallery

#21 Post by rayminator »

thanks you very much poorlyformed

only used part of your code

Code: Select all

add g.make_button("btn_cg1", "thumb_cg1", locked="cglocked", xpadding=0, ypadding=0) xpos 570 ypos 250 

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: How to make a gallery

#22 Post by poorlyformed »

Do you mean that you're not using the rest of it? Because at the very least, you need the g.condition part to tell it to unlock the image in the gallery, although I'm not sure if that will even work without the rest of the code.
Image

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

Re: How to make a gallery

#23 Post by rayminator »

poorlyformed wrote: Thu Feb 15, 2018 12:59 pm Do you mean that you're not using the rest of it? Because at the very least, you need the g.condition part to tell it to unlock the image in the gallery, although I'm not sure if that will even work without the rest of the code.
It works just fine without it

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

Re: How to make a gallery

#24 Post by rayminator »

Update:

Still need help to add image for the textbutton and how add the main menu to it

I'll looking through the pages of the site search doesn't work

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: How to make a gallery

#25 Post by poorlyformed »

I'm not sure what you mean by "add image for the textbutton."

For the main menu, do you mean to add the gallery link to the main menu, or to add the navigation to the gallery screen. For the former, you can just add

Code: Select all

textbutton "Gallery" action ShowMenu("gallery")
The "gallery" in parentheses would be whatever you've actually named your gallery screen.

For the latter, you need to add 'use navigation', like I have it in the code above.
Image

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

Re: How to make a gallery

#26 Post by rayminator »

i want to change the text from return to an image

something like this
google image click the link to find out what i mean


now how add the main menu to the gallery

tried using this use game_menu(_("Image Gallery"), scroll="viewport"): but it didn't work

but i am still looking

and Imperf3kt it look like you had the same issue that I'm having with that gallery that I want to use

viewtopic.php?f=8&t=45762

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

Re: How to make a gallery

#27 Post by Imperf3kt »

I didn't actually get to look at it last night, I got a little busy working on a 3D print file and completely forgot.
I'm planning to check it tonight, but I don't think I'll have a lot of time as I have some appointments late in the afternoon in a town an hour away from home. I don't expect to get around to it until late, so I may not look until tomorrow.
Its currently 7:15am here.
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
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: How to make a gallery

#28 Post by poorlyformed »

ah, ok. You can just use an imagebutton for that. Could you paste your code and then I can tell you what you need to change.

Also, do you have the Navigation part of the main/game menu set up? If you do, then you just add 'use navigation' to your gallery screen.
Image

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

Re: How to make a gallery

#29 Post by rayminator »

this what I want to change

Code: Select all

# Step 3. The gallery screen we use.
screen gallery:
    use navigation
    # Ensure this replaces the main menu.
    tag menu
    # The background.
    add "scnes11"

    # A grid of buttons.
    grid 3 3:

        xfill False
        yfill False
        ypos 100
        xpos 200

        # Call make_button to show a particular button.
        add g.make_button("dark", "all162b", locked="gallocked", xalign=0.5, yalign=0.5)
        add g.make_button("dawn", "all162b", locked="gallocked", xalign=0.5, yalign=0.5)
        add g.make_button("end1", "all162b", locked="gallocked", xalign=0.5, yalign=0.5)

        add g.make_button("end2", "all162b", locked="gallocked", xalign=0.5, yalign=0.5)
        add g.make_button("end3", "all162b", locked="gallocked", xalign=0.5, yalign=0.5)
        add g.make_button("end4", "all162b", locked="gallocked", xalign=0.5, yalign=0.5)

        add g.make_button("dark mary", "all162b", locked="gallocked", xalign=0.5, yalign=0.5)
        add g.make_button("dawn mary", "all162b", locked="gallocked", xalign=0.5, yalign=0.5)


        # The screen is responsible for returning to the main menu. It could also
        # navigate to other gallery screens.
        textbutton "Return" action Return() xalign 0.5 yalign 0.5 <-- this what I want to change into an image

User avatar
poorlyformed
Regular
Posts: 53
Joined: Mon Jan 22, 2018 11:43 am
Projects: Shadowburg
Tumblr: poorlyformed
itch: poorlyformed
Location: NYC
Contact:

Re: How to make a gallery

#30 Post by poorlyformed »

okay, just use

Code: Select all

imagebutton "YOURIMAGENAME.png" action Return() alt _("Return") xalign 0.5 yalign 0.5
Image

Post Reply

Who is online

Users browsing this forum: Bing [Bot], GetOutOfMyLab, Ocelot