Ren'Py [SOLVED] Bonus Image Gallery Not Working

Impious Monk

Active Member
Game Developer
Oct 14, 2021
600
2,601
I've got a bonus image gallery set up that works fine for my first couple of renders but for my newer images it's not working.

Screenshot 2023-02-26 192429.jpg

Under Part One, both of those renders are unlocked. But under Part Two, the images on the left and right should be unlocked but they aren't. Here's my gallery code:

Code:
init python:
    gallery = Gallery()

    gallery.button("jamie1")
    gallery.condition("persistent.jamie1")
    gallery.image("jamie1")

    gallery.button("jamie2")
    gallery.condition("persistent.jamie2")
    gallery.unlock_image("jamie2")

    gallery.button("jamie3")
    gallery.condition("persistent.jamie3")
    gallery.unlock_image("jamie3")

    gallery.button("jamie4")
    gallery.condition("persistent.jamie4")
    gallery.unlock_image("jamie4")

    gallery.button("jamie5")
    gallery.condition("persistent.jamie5")
    gallery.unlock_image("jamie5")

    gallery.button("jamie6")
    gallery.condition("persistent.jamie6")
    gallery.unlock_image("jamie6")

    gallery.button("jamie7")
    gallery.condition("persistent.jamie7")
    gallery.unlock_image("jamie7")

    gallery.button("jamie8")
    gallery.condition("persistent.jamie8")
    gallery.unlock_image("jamie8")

    gallery.button("aghavni1")
    gallery.condition("persistent.aghavni1")
    gallery.image("aghavni1")

    gallery.button("aghavni2")
    gallery.condition("persistent.aghavni2")
    gallery.unlock_image("aghavni2")

    gallery.button("aghavni3")
    gallery.condition("persistent.aghavni3")
    gallery.unlock_image("aghavni3")

    gallery.button("aghavni4")
    gallery.condition("persistent.aghavni4")
    gallery.unlock_image("aghavni4")

    gallery.button("aghavni5")
    gallery.condition("persistent.aghavni5")
    gallery.unlock_image("aghavni5")

    gallery.button("aghavni6")
    gallery.condition("persistent.aghavni6")
    gallery.unlock_image("aghavni6")

    gallery.button("aghavni7")
    gallery.condition("persistent.aghavni7")
    gallery.unlock_image("aghavni7")

    gallery.button("aghavni8")
    gallery.condition("persistent.aghavni8")
    gallery.unlock_image("aghavni8")

    gallery.button("emmeline2")
    gallery.condition("persistent.emmeline2")
    gallery.unlock_image("emmeline2")

    gallery.button("emmeline3")
    gallery.condition("persistent.emmeline3")
    gallery.unlock_image("emmeline3")

    gallery.button("emmeline4")
    gallery.condition("persistent.emmeline4")
    gallery.unlock_image("emmeline4")

    gallery.button("emmeline5")
    gallery.condition("persistent.emmeline5")
    gallery.unlock_image("emmeline5")

    gallery.button("emmeline6")
    gallery.condition("persistent.emmeline6")
    gallery.unlock_image("emmeline6")

    gallery.button("emmeline7")
    gallery.condition("persistent.emmeline7")
    gallery.unlock_image("emmeline7")

    gallery.button("emmeline8")
    gallery.condition("persistent.emmeline8")
    gallery.unlock_image("emmeline8")

    gallery.button("malena2")
    gallery.condition("persistent.malena2")
    gallery.unlock_image("malena2")

    gallery.button("malena3")
    gallery.condition("persistent.malena3")
    gallery.unlock_image("malena3")

    gallery.button("malena4")
    gallery.condition("persistent.malena4")
    gallery.unlock_image("malena4")

    gallery.button("malena5")
    gallery.condition("persistent.malena5")
    gallery.unlock_image("malena5")

    gallery.button("malena6")
    gallery.condition("persistent.malena6")
    gallery.unlock_image("malena6")

    gallery.button("malena7")
    gallery.condition("persistent.malena7")
    gallery.unlock_image("malena7")

    gallery.button("malena8")
    gallery.condition("persistent.malena8")
    gallery.unlock_image("malena8")

    gallery.button("empty")
    gallery.condition("persistent.empty")
    gallery.unlock_image("empty")

screen gallery:

    tag menu

    hbox:
        xalign 0.95
        yalign 0.01
        textbutton "Return" action ShowMenu("extras")

    hbox:
        xalign 0.1
        yalign 0.1
        text "Part One"

    hbox:
        xalign 0.08
        yalign 0.17
        spacing 30
        grid 2 1:
            add gallery.make_button("jamie1",unlocked="jamie_unlocked", locked="jamie_locked")
            add gallery.make_button("aghavni1",unlocked="aghavni_unlocked", locked="aghavni_locked")
            spacing 15

    hbox:
        xalign 0.1
        yalign 0.34
        text "Part Two"

    hbox:
        xalign 0.1
        yalign 0.435
        spacing 30
        grid 4 1:
            add gallery.make_button("jamie2",unlocked="jamie_unlocked", locked="jamie_locked")
            add gallery.make_button("aghavni2",unlocked="aghavni_unlocked", locked="aghavni_locked")
            add gallery.make_button("emmeline2",unlocked="emmeline_unlocked", locked="emmeline_locked")
            add gallery.make_button("malena2",unlocked="malena_unlocked", locked="malena_locked")
            spacing 15

    hbox:
        xalign 0.1
        yalign 0.57
        text "Part Three"

    hbox:
        xalign 0.1
        yalign 0.69
        spacing 30
        grid 4 1:
            add gallery.make_button("jamie3",unlocked="jamie_unlocked", locked="jamie_locked")
            add gallery.make_button("aghavni3",unlocked="aghavni_unlocked", locked="aghavni_locked")
            add gallery.make_button("emmeline3",unlocked="emmeline_unlocked", locked="emmeline_locked")
            add gallery.make_button("malena3",unlocked="malena_unlocked", locked="malena_locked")
            spacing 15

    hbox:
        xalign 0.1
        yalign .79
        text "Part Four"

    hbox:
        xalign 0.1
        yalign .935
        spacing 30
        grid 4 1:
            add gallery.make_button("jamie4",unlocked="jamie_unlocked", locked="jamie_locked")
            add gallery.make_button("aghavni4",unlocked="aghavni_unlocked", locked="aghavni_locked")
            add gallery.make_button("emmeline4",unlocked="emmeline_unlocked", locked="emmeline_locked")
            add gallery.make_button("malena4",unlocked="malena_unlocked", locked="malena_locked")
            spacing 15

    hbox:
        xalign 0.6
        yalign 0.1
        text "Part Five"

    hbox:
        xalign 0.8
        yalign 0.17
        spacing 30
        grid 4 1:
            add gallery.make_button("jamie5",unlocked="jamie_unlocked", locked="jamie_locked")
            add gallery.make_button("aghavni5",unlocked="aghavni_unlocked", locked="aghavni_locked")
            add gallery.make_button("emmeline5",unlocked="emmeline_unlocked", locked="emmeline_locked")
            add gallery.make_button("malena5",unlocked="malena_unlocked", locked="malena_locked")
            spacing 15

    hbox:
        xalign 0.6
        yalign 0.34
        text "Part Six"

    hbox:
        xalign 0.8
        yalign 0.435
        spacing 30
        grid 4 1:
            add gallery.make_button("jamie6",unlocked="jamie_unlocked", locked="jamie_locked")
            add gallery.make_button("aghavni6",unlocked="aghavni_unlocked", locked="aghavni_locked")
            add gallery.make_button("emmeline6",unlocked="emmeline_unlocked", locked="emmeline_locked")
            add gallery.make_button("malena6",unlocked="malena_unlocked", locked="malena_locked")
            spacing 15

    hbox:
        xalign 0.6
        yalign 0.57
        text "Part Seven"

    hbox:
        xalign 0.8
        yalign 0.69
        spacing 30
        grid 4 1:
            add gallery.make_button("jamie7",unlocked="jamie_unlocked", locked="jamie_locked")
            add gallery.make_button("aghavni7",unlocked="aghavni_unlocked", locked="aghavni_locked")
            add gallery.make_button("emmeline7",unlocked="emmeline_unlocked", locked="emmeline_locked")
            add gallery.make_button("malena7",unlocked="malena_unlocked", locked="malena_locked")
            spacing 15

    hbox:
        xalign 0.6
        yalign .79
        text "Part Eight"

    hbox:
        xalign 0.8
        yalign .935
        spacing 30
        grid 4 1:
            add gallery.make_button("jamie8",unlocked="jamie_unlocked", locked="jamie_locked")
            add gallery.make_button("aghavni8",unlocked="aghavni_unlocked", locked="aghavni_locked")
            add gallery.make_button("emmeline8",unlocked="emmeline_unlocked", locked="emmeline_locked")
            add gallery.make_button("malena8",unlocked="malena_unlocked", locked="malena_locked")
            spacing 15

And my unlock code for the two that work:

Code:
            if persistent.aghavni1 == None:
                $ persistent.aghavni1 = True
                $ renpy.notify("You've unlocked a special render!")
                scene black with Dissolve(1)
Code:
            if persistent.jamie1 == None:
                $ persistent.jamie1 = True
                $ renpy.notify("You've unlocked a special render!")
                scene black with Dissolve(1)

And for the two that don't work:

Code:
    if persistent.jamie2 == None:
        $ persistent.jamie2 = True
        $ renpy.notify("You've unlocked a special render!")
        scene black with Dissolve(1)
Code:
    if persistent.malena2 == None:
        $ persistent.malena2 = True
        $ renpy.notify("You've unlocked a special render!")
        scene black with Dissolve(1)
For these two that don't work, I DO get the notification that the render has been unlocked. But it doesn't unlock.

I've got my lock/unlock images all in the same place, got my special renders that unlock and those that don't all in the same place. So I have no idea what the problem is.
 
Last edited:

gojira667

Member
Sep 9, 2019
264
245
For these two that don't work, I DO get the notification that the render has been unlocked. But it doesn't unlock.

I've got my lock/unlock images all in the same place, got my special renders that unlock and those that don't all in the same place. So I have no idea what the problem is.
Have they been seen before? "This will cause an image to be displayed if it has been seen before."

For your testing you will want to either view them or mark them as seen first.
 

Meushi

Well-Known Member
Aug 4, 2017
1,146
12,721
Under Part One, both of those renders are unlocked. But under Part Two, the images on the left and right should be unlocked but they aren't. Here's my gallery code:
In the gallery code, the two buttons which work are declared using image("displayable"). All the other buttons are declared using unlock_image("displayable").

What happens if you change all those unlock_image() to image()?
 
  • Like
Reactions: Impious Monk

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
Have they been seen before? "This will cause an image to be displayed if it has been seen before."
Since he have a code to "unlock the images", my guess is the same, a misunderstanding of what "unlock_image" is doing.
Either he replace the value gave to "unlock_image" by the name of one, or more, image, and then don't need anymore the persistent value to unlock the gallery. Or he keep the persistent value, and use instead.


What happens if you change all those unlock_image() to image()?
My knowledge regarding Gallery is limited but, since "image" do nothing more than defining the image to display, I guess that it would unlock everything... because the galleries would then have no condition locking them.
 

Meushi

Well-Known Member
Aug 4, 2017
1,146
12,721
My knowledge regarding Gallery is limited but, since "image" do nothing more than defining the image to display, I guess that it would unlock everything... because the galleries would then have no condition locking them.
The OP said the ones declared with image() worked as intended? And that construct closely resembles some of the which employ a condition:
Python:
    # This button has a condition associated with it, allowing the game
    # to choose which images unlock.
    g.button("end1")
    g.condition("persistent.unlock_1")
    g.image("transfer")
    g.image("moonpic")
    g.image("girlpic")
    g.image("nogirlpic")
    g.image("bad_ending")

    g.button("end2")
    g.condition("persistent.unlock_2")
    g.image("library")
    g.image("beach1 nomoon")
    g.image("bad_ending")
My assumption from the doc examples is that if the gallery.condition is met, the following image() declarations are displayed? But I haven't tested it so couldn't say for sure.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
The OP said the ones declared with image() worked as intended? And that construct closely resembles some of the which employ a condition:
Yeah, my bad. My mind focused on the wrong use of unlock_image and erased the fact that there's a condition in the gallery definition. Don't write while eating, you loose your thoughts...
 

Impious Monk

Active Member
Game Developer
Oct 14, 2021
600
2,601
In the gallery code, the two buttons which work are declared using image("displayable"). All the other buttons are declared using unlock_image("displayable").

What happens if you change all those unlock_image() to image()?
Oh boy, yeah, that was it! Thank you so much for spotting that!

Not sure why I coded two different ways there or why I was too dumb to spot it.

Thanks everybody for your comments!