Ren'Py Gallery of sex scenes

monkeyposter_7

Thirsty for my Guest
Game Developer
Nov 23, 2018
330
1,179
So i really want to add a gallery as a sub menu. For sex scenes (only the stuff that has been "unlocked")
Can u recommend some good guides for this task?
Something for a noob like myself, i learn code as i go along and as i need stuff for the game...

Also, if i add this now, is it gonna brakes saves? Or cause any other issues?
 
  • Like
Reactions: thengineer

ChummyChonka

Newbie
Aug 17, 2017
79
312
Should not be to complicated in theory. Have you tried looking into the official RenPy documentation?
This should probably help you:
And here's a tutorial from someone who used it in their first game:
 
  • Like
Reactions: monkeyposter_7

thengineer

Moonlight Sins
Game Developer
Nov 19, 2018
191
771
So i really want to add a gallery as a sub menu. For sex scenes (only the stuff that has been "unlocked")
Can u recommend some good guides for this task?
Something for a noob like myself, i learn code as i go along and as i need stuff for the game...

Also, if i add this now, is it gonna brakes saves? Or cause any other issues?
Dont use the official code for galleries, it sucks and is outdated, will bring you a lot of trouble. Instead, take a look at this video ( watch all the parts)

I’m on my phone right now so cant really show you my own code, but if you wanna take a look, use a renpy decompiler or something. It’s pretty much the same code with a couple of tweaks.
Good luck!
 
  • Like
Reactions: monkeyposter_7

monkeyposter_7

Thirsty for my Guest
Game Developer
Nov 23, 2018
330
1,179
Dont use the official code for galleries, it sucks and is outdated, will bring you a lot of trouble. Instead, take a look at this video ( watch all the parts)

I’m on my phone right now so cant really show you my own code, but if you wanna take a look, use a renpy decompiler or something. It’s pretty much the same code with a couple of tweaks.
Good luck!
This guide seems good, lot of details in it. thank you!

BUT does it brakes the saves? Or does it cause any others problems for players if i add this now? (ep5)
That's the most important thing for me...
 
  • Like
Reactions: thengineer

thengineer

Moonlight Sins
Game Developer
Nov 19, 2018
191
771
This guide seems good, lot of details in it. thank you!

BUT does it brakes the saves? Or does it cause any others problems for players if i add this now? (ep5)
That's the most important thing for me...
Nope, it should be perfectly fine, so long as you use renpy.seen or whatever it is. If that doesnt work, there are cheekier ways of making it work
 
  • Like
Reactions: monkeyposter_7

Rich

Old Fart
Modder
Respected User
Donor
Game Developer
Jun 25, 2017
2,452
6,905
BUT does it brakes the saves? Or does it cause any others problems for players if i add this now? (ep5)
That's the most important thing for me...
As @thengineer indicates, your gallery doesn't have to break your saves. The trick is that Ren'py already keeps track of whether an image has been seen or not without you having to do anything. So you can use Ren'py's own records of "seen or not" to unlock (or not) items in your gallery.

Here's the complete code for the gallery from Family, Friends and Strangers using the . (You're welcome to play to the game to see it in action, of course.) The first section sets up the individual entries in the gallery. You'll see that each of then has a button, then a condition that controls whether or not, then one or more images that are what will be shown if the item is unlocked.

Then I group the gallery buttons into pages of six buttons each. (If the buttons don't come out evenly into a multiple of 6, I add (None,None,None) items so that the last array in image_gallery_buttons_pages still has six entries. The entries are Python tuples that contain the slot button name, the title to be put under the thumbnail, and the thumbnail image name. (I build the thumbnail images directly from the full-size images using the gallery_thumbnail() function.

gallery_buttons is a screen fragment that creates the grid entries for a single page of gallery buttons, and deals with whether each item is unlocked or not.
gallery is the actual gallery screen, which handles its own pagination, and uses gallery_buttons in order to place individual gallery buttons within its grid

You're welcome to steal this - you'd just need to rewrite the "image_gallery" manipulation to match your own images, etc., and then then image_gallery_buttons_pages to set the pages up properly.

Code:
init python:
    def gallery_thumbnail(thumbnail_name):
        return im.FactorScale(thumbnail_name, 0.2)

    image_gallery = Gallery()
    image_gallery.transition = dissolve
    image_gallery.locked_button = "gallery_locked_button"

    image_gallery.button("slot01")
    image_gallery.condition('renpy.seen_image("ch0b_12")')
    image_gallery.unlock_image("ch0b_09")
    image_gallery.unlock_image("ch0b_10")
    image_gallery.unlock_image("ch0b_11_movie")
    image_gallery.unlock_image("ch0b_12")

    image_gallery.button("slot02")
    image_gallery.condition('renpy.seen_image("ch0d_27")')
    image_gallery.unlock_image("ch0d_24")
    image_gallery.unlock_image("ch0d_25")
    image_gallery.unlock_image("ch0d_26_movie")
    image_gallery.unlock_image("ch0d_27")

    image_gallery.button("slot03")
    image_gallery.condition('renpy.seen_image("ch1a_07")')
    image_gallery.unlock_image("ch1a_03")
    image_gallery.unlock_image("ch1a_04")
    image_gallery.unlock_image("ch1a_05")
    image_gallery.unlock_image("ch1a_06")
    image_gallery.unlock_image("ch1a_07")

    image_gallery.button("slot04")
    image_gallery.condition('renpy.seen_image("ch1b_10")')
    image_gallery.unlock_image("ch1b_07")
    image_gallery.unlock_image("ch1b_08")
    image_gallery.unlock_image("ch1b_09")
    image_gallery.unlock_image("ch1b_10")

    image_gallery.button("slot05")
    image_gallery.condition('renpy.seen_image("ch1c_17")')
    image_gallery.image("ch1c_16_gallery")
    image_gallery.condition("True")
    image_gallery.unlock_image("ch1c_17")

    image_gallery.button("slot06")
    image_gallery.condition('renpy.seen_image("ch1e_12_movie")')
    image_gallery.unlock_image("ch1e_09a")
    image_gallery.unlock_image("ch1e_09b")
    image_gallery.unlock_image("ch1e_09c")
    image_gallery.unlock_image("ch1e_09d")
    image_gallery.unlock_image("ch1e_10")
    image_gallery.unlock_image("ch1e_10a")
    image_gallery.unlock_image("ch1e_11")
    image_gallery.unlock_image("ch1e_12_movie")

    image_gallery.button("slot07")
    image_gallery.condition('renpy.seen_image("ch1e_17_movie")')
    image_gallery.unlock_image("ch1e_15")
    image_gallery.unlock_image("ch1e_16")
    image_gallery.unlock_image("ch1e_17_movie")

    image_gallery.button("slot08")
    image_gallery.condition('renpy.seen_image("ch1e_22")')
    image_gallery.unlock_image("ch1e_19a")
    image_gallery.unlock_image("ch1e_19")
    image_gallery.unlock_image("ch1e_20a")
    image_gallery.unlock_image("ch1e_20")
    image_gallery.unlock_image("ch1e_21")
    image_gallery.unlock_image("ch1e_22")

    image_gallery.button("slot09")
    image_gallery.condition('renpy.seen_image("ch1e_34")')
    image_gallery.unlock_image("ch1e_25_00")
    image_gallery.unlock_image("ch1e_25_anim")
    image_gallery.unlock_image("ch1e_26")
    image_gallery.unlock_image("ch1e_27_movie")
    image_gallery.unlock_image("ch1e_28")
    image_gallery.unlock_image("ch1e_29")
    image_gallery.unlock_image("ch1e_33")
    image_gallery.unlock_image("ch1e_34")

    image_gallery.button("slot10")
    image_gallery.condition('renpy.seen_image("ch3a_06")')
    image_gallery.unlock_image("ch3a_06")

    image_gallery.button("slot11")
    image_gallery.condition('renpy.seen_image("ch3c_10")')
    image_gallery.unlock_image("ch3c_07")
    image_gallery.unlock_image("ch3c_08")
    image_gallery.unlock_image("ch3c_09")
    image_gallery.unlock_image("ch3c_10")
    image_gallery.unlock_image("ch3c_11")
    image_gallery.unlock_image("ch3c_12")
    image_gallery.unlock_image("ch3c_13")
    image_gallery.unlock_image("ch3c_14")
    image_gallery.unlock_image("ch3c_15")
    image_gallery.unlock_image("ch3c_16")
    image_gallery.unlock_image("ch3c_17")
    image_gallery.unlock_image("ch3c_18")
    image_gallery.unlock_image("ch3c_19")

    image_gallery.button("slot12")
    image_gallery.condition('renpy.seen_image("ch3c_29")')
    image_gallery.unlock_image("ch3c_27")
    image_gallery.unlock_image("ch3c_28")
    image_gallery.unlock_image("ch3c_29")

    image_gallery.button("slot13")
    image_gallery.condition('renpy.seen_image("ch3c_35a")')
    image_gallery.unlock_image("ch3c_32")
    image_gallery.unlock_image("ch3c_35")
    image_gallery.unlock_image("ch3c_35a")

    image_gallery.button("slot14")
    image_gallery.condition('renpy.seen_image("ch3c_37")')
    image_gallery.unlock_image("ch3c_37")

    image_gallery.button("slot15")
    image_gallery.condition('renpy.seen_image("ch3c_45")')
    image_gallery.unlock_image("ch3c_40")
    image_gallery.unlock_image("ch3c_41_movie")
    image_gallery.unlock_image("ch3c_42")
    image_gallery.unlock_image("ch3c_43")
    image_gallery.unlock_image("ch3c_44_00")
    image_gallery.unlock_image("ch3c_42a")
    image_gallery.unlock_image("ch3c_44_movie")
    image_gallery.unlock_image("ch3c_45")

    image_gallery.button("slot16")
    image_gallery.condition('renpy.seen_image("ch3c_51")')
    image_gallery.unlock_image("ch3c_46")
    image_gallery.unlock_image("ch3c_47")
    image_gallery.unlock_image("ch3c_48")
    image_gallery.unlock_image("ch3c_49")
    image_gallery.unlock_image("ch3c_50")
    image_gallery.unlock_image("ch3c_51")

    image_gallery.button("slot17")
    image_gallery.condition('renpy.seen_image("ch3d_18")')
    image_gallery.unlock_image("ch3d_17")
    image_gallery.unlock_image("ch3d_18")

    image_gallery.button("slot18")
    image_gallery.condition('renpy.seen_image("ch3d_32")')
    image_gallery.image("ch3_gallery_parker_fantasy")

    image_gallery_buttons_pages = [
        [
            ( "slot01", "Ch 1: Brad and Emily",     "ch0b/ch0b_09.jpg" ),
            ( "slot02", "Ch 1: Parker and Becky",   "ch0d/ch0d_24.jpg" ),
            ( "slot03", "Ch 2: Melanie\u2019s Bra", "ch1a/ch1a_03.jpg" ),
            ( "slot04", "Ch 2: Melissa Downblouse", "ch1b/ch1b_09.jpg" ),
            ( "slot05", "Ch 2: License Grab",       "ch1c/ch1c_16_0.jpg" ),
            ( "slot06", "Ch 2: The Search, Part 1", "ch1e/ch1e_09a.jpg" )
        ],
        [
            ( "slot07", "Ch 2: The Search, Part 2", "ch1e/ch1e_15.jpg" ),
            ( "slot08", "Ch 2: The Search, Part 3", "ch1e/ch1e_19a.jpg" ),
            ( "slot09", "Ch 2: The Search, Part 4", "animations/ch1e_25_00.jpg" ),
            ( "slot10", "Ch 3: A revealing time",   "ch3a/ch3a_06.jpg" ),
            ( "slot11", "Ch 3: Let\u2019s have the top", "ch3c/ch3c_07.jpg" ),
            ( "slot12", "Ch 3: And the rest",       "ch3c/ch3c_27.jpg" ),
        ],
        [
            ( "slot13", "Ch 3: Exposed",             "ch3c/ch3c_32.jpg" ),
            ( "slot14", "Ch 3: Full Search, Part 1", "ch3c/ch3c_37.jpg" ),
            ( "slot15", "Ch 3: Full Search, Part 2", "ch3c/ch3c_40.jpg" ),
            ( "slot16", "Ch 3: Dressing",           "ch3c/ch3c_46.jpg" ),
            ( "slot17", "Ch 3: Tits are tits",      "ch3d/ch3d_17.jpg" ),
            ( "slot18", "Ch 3: Parker\u2019s Fantasy", "ch3d/ch3_gallery_parker_fantasy.jpg" ),
        ]
    ]

screen gallery_buttons(data):
    for (name, title, thumbnail) in data:
        if name:
            vbox:
                $ the_button = image_gallery.make_button(name, gallery_thumbnail(thumbnail))
                add the_button
                if image_gallery.buttons[name].check_unlock():
                    text title
                else:
                    text ""
        else:
            text ""

screen gallery():
    default page = 1
    tag menu

    use game_menu(_("Gallery"), scroll="viewport"):

        style_prefix "gallery"

        vbox:
            xsize 940
            ysize 500
            label "Page [page]":
                xalign 0.5
                bottom_margin 10

            grid 3 2:
                style_prefix "gallery_slot"

                xalign 0.5
                yalign 0.5

                xspacing 30
                yspacing 20

                use gallery_buttons(image_gallery_buttons_pages[page-1])

            hbox:
                style_prefix "page"

                anchor (0.5, 0.0)
                pos(0.5, 1.0)

                spacing gui.page_spacing

                if page > 1:
                    textbutton _("<") action SetScreenVariable("page", page - 1)
                else:
                    textbutton  _("<") action NullAction()

                for i in range(1, len(image_gallery_buttons_pages) + 1):
                    textbutton "[i]" action SetScreenVariable("page", i)

                if page < len(image_gallery_buttons_pages):
                    textbutton _(">") action SetScreenVariable("page", page + 1)
                else:
                    textbutton  _(">") action NullAction()

style gallery_slot_text:
    size 18
    xalign 0.5
    yalign 0.0

style gallery_button is button:
    hover_background "#fff"

style gallery_button_text:
    size 24
    bold True
    color "#fff"
    hover_color "#000"
    underline True

style gallery_button_current is button
style gallery_button_current_text is gallery_button_text:
    underline False
    hover_color "#fff"
 

Honey hunters

Member
Jan 23, 2020
118
26
hello everyone i used a Rich gallery code as it is same in my game , but i got little wired problem .
when i convert my game in PC(WINDOWS) version there is no locked button showing in Gallery PC.png

and when i converted into Android mobile version the gallery locked button is working mobile.png


soo can anyone help me why it's not working on PC version and why it's working on Android version , so where i made a mistake here it is the program which i used in my game development.


Python:
init python:
LAST_SAVE_REGEX = r"\d+"
def has_recent_save():
return renpy.newest_slot(LAST_SAVE_REGEX) != None

def load_most_recent_save():
filename = renpy.newest_slot(LAST_SAVE_REGEX)
if filename != None:
renpy.load(filename)




init 2 python:
def gallery_thumbnail(thumbnail_name):
return im.FactorScale(thumbnail_name, 0.2)

image_gallery = Gallery()
image_gallery.transition = dissolve
image_gallery.locked_button = "game_gui/gallery_locked_button.png"

image_gallery.button("slot01")
image_gallery.condition('renpy.seen_image("intro6")')
image_gallery.unlock_image("intro1")
image_gallery.unlock_image("intro2")
image_gallery.unlock_image("intro3")
image_gallery.unlock_image("intro6")

image_gallery.button("slot02")
image_gallery.condition('renpy.seen_image("intro1")')
image_gallery.unlock_image("intro4")
image_gallery.unlock_image("intro0")
image_gallery.unlock_image("intro2")
image_gallery.unlock_image("intro1")

image_gallery.button("slot03")
image_gallery.condition('renpy.seen_image("intro2")')
image_gallery.unlock_image("intro6")
image_gallery.unlock_image("intro1")
image_gallery.unlock_image("intro0")
image_gallery.unlock_image("intro3")
image_gallery.unlock_image("intro2")

image_gallery.button("slot04")
image_gallery.condition('renpy.seen_image("intro6")')
image_gallery.unlock_image("intro1")
image_gallery.unlock_image("intro2")
image_gallery.unlock_image("intro3")
image_gallery.unlock_image("intro6")

image_gallery.button("slot05")
image_gallery.condition('renpy.seen_image("intro1")')
image_gallery.unlock_image("intro4")
image_gallery.unlock_image("intro0")
image_gallery.unlock_image("intro2")
image_gallery.unlock_image("intro1")

image_gallery.button("slot06")
image_gallery.condition('renpy.seen_image("intro2")')
image_gallery.unlock_image("intro6")
image_gallery.unlock_image("intro1")
image_gallery.unlock_image("intro0")
image_gallery.unlock_image("intro3")
image_gallery.unlock_image("intro2")

image_gallery.button("slot07")
image_gallery.condition('renpy.seen_image("intro6")')
image_gallery.unlock_image("intro1")
image_gallery.unlock_image("intro2")
image_gallery.unlock_image("intro3")
image_gallery.unlock_image("intro6")

image_gallery.button("slot08")
image_gallery.condition('renpy.seen_image("intro1")')
image_gallery.unlock_image("intro4")
image_gallery.unlock_image("intro0")
image_gallery.unlock_image("intro2")
image_gallery.unlock_image("intro1")

image_gallery.button("slot09")
image_gallery.condition('renpy.seen_image("intro2")')
image_gallery.unlock_image("intro6")
image_gallery.unlock_image("intro1")
image_gallery.unlock_image("intro0")
image_gallery.unlock_image("intro3")
image_gallery.unlock_image("intro2")

image_gallery.button("slot10")
image_gallery.condition('renpy.seen_image("intro6")')
image_gallery.unlock_image("intro1")
image_gallery.unlock_image("intro2")
image_gallery.unlock_image("intro3")
image_gallery.unlock_image("intro6")

image_gallery.button("slot11")
image_gallery.condition('renpy.seen_image("intro1")')
image_gallery.unlock_image("intro4")
image_gallery.unlock_image("intro0")
image_gallery.unlock_image("intro2")
image_gallery.unlock_image("intro1")

image_gallery.button("slot12")
image_gallery.condition('renpy.seen_image("intro2")')
image_gallery.unlock_image("intro6")
image_gallery.unlock_image("intro1")
image_gallery.unlock_image("intro0")
image_gallery.unlock_image("intro3")
image_gallery.unlock_image("intro2")



image_gallery_slots = []

image_gallery_slots.extend(
[
( "slot01", "Ch 1: Brad and Emily", "intro/intro1.png" ),
( "slot02", "Ch 1: Parker and Becky", "intro/intro4.png" ),
( "slot03", "Ch 2: Melanie\u2019s Bra", "intro/intro6.png" ),
( "slot04", "Ch 1: Brad and Emily", "intro/intro1.png" ),
( "slot05", "Ch 1: Parker and Becky", "intro/intro4.png" ),
( "slot05", "Ch 2: Melanie\u2019s Bra", "intro/intro6.png" ),
( "slot06", "Ch 1: Brad and Emily", "intro/intro1.png" ),
( "slot07", "Ch 1: Parker and Becky", "intro/intro4.png" ),
( "slot08", "Ch 2: Melanie\u2019s Bra", "intro/intro6.png" ),
( "slot09", "Ch 1: Brad and Emily", "intro/intro1.png" ),
( "slot10", "Ch 1: Parker and Becky", "intro/intro4.png" ),
( "slot11", "Ch 2: Melanie\u2019s Bra", "intro/intro6.png" ),
( "slot12", "Ch 2: Melanie\u2019s Bra", "intro/intro6.png" ),

])

@renpy.pure
def get_image_gallery_page_count():
return (len(image_gallery_slots) + 5) // 6

@renpy.pure
def get_image_gallery_page(page):
slots = []
first_index = (page - 1) * 6
for i in range(first_index, first_index + 6):
if i < len(image_gallery_slots):
slots.append(image_gallery_slots)
else:
slots.append((None, None, None))
return slots

screen gallery_buttons(data):
for (name, title, thumbnail) in data:
if name:
vbox:
$ the_button = image_gallery.make_button(name, gallery_thumbnail(thumbnail))
add the_button
if image_gallery.buttons[name].check_unlock():
text title
else:
text ""
else:
text ""

screen gallery():
tag menu
default page = 1
default total_pages = get_image_gallery_page_count()


use game_menu(_("Gallery"), scroll="viewport"):

style_prefix "gallery"

vbox:
xsize 940
ysize 500
label "Page [page]":
xalign 0.5
bottom_margin 10

grid 3 2:
style_prefix "gallery_slot"

xalign 0.5
yalign 0.5

xspacing 30
yspacing 20

use gallery_buttons(get_image_gallery_page(page))

hbox:
style_prefix "page"

anchor (0.5, 0.0)
pos (0.5, 1.0)

spacing gui.page_spacing

if page > 1:
textbutton _("<") action SetScreenVariable("page", page - 1)
else:
textbutton _("<") action NullAction()

for i in range(1, total_pages + 1):
textbutton "" action SetScreenVariable("page", i)

if page < total_pages:
textbutton _(">") action SetScreenVariable("page", page + 1)
else:
textbutton _(">") action NullAction()

style gallery_slot_text:
size 18
xalign 0.5
yalign 0.0

style gallery_button is button:
hover_background "#fff"

style gallery_button_text:
size 24
bold True
color "#fff"
hover_color "#000"
underline True

style gallery_button_current is button
style gallery_button_current_text is gallery_button_text:
underline False
hover_color "#fff"
Can any one help me where i made wrong in this and what i missed in this programme
 
Last edited:

DineshakR

Newbie
Sep 16, 2020
34
215
Dont use the official code for galleries, it sucks and is outdated, will bring you a lot of trouble. Instead, take a look at this video ( watch all the parts)

I’m on my phone right now so cant really show you my own code, but if you wanna take a look, use a renpy decompiler or something. It’s pretty much the same code with a couple of tweaks.
Good luck!
Hey guys I used this video tutorial but it shows error expected statement in class