Disappearing unlocked CG thumbnail in 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.
Post Reply
Message
Author
User avatar
Shocking Alberto
Regular
Posts: 35
Joined: Sun Mar 29, 2020 4:58 am
Contact:

Disappearing unlocked CG thumbnail in Gallery?

#1 Post by Shocking Alberto »

I followed the documentation for making a gallery (https://www.renpy.org/doc/html/rooms.ht ... ht=gallery) but I have come across a peculiar issue where the thumbnail of an unlocked CG disappears upon exiting the gallery. Of course, it appears again when you re-enter the gallery so it's not a major issue. Just a curiosity. :P

script.rpy

Code: Select all

    if persistent.gallery_EV01 is None:
        persistent.gallery_EV01 = False

    if persistent.gallery_EV02 is None:
        persistent.gallery_EV02 = False
        
    if persistent.gallery_EV03 is None:
        persistent.gallery_EV03 = False

    if persistent.gallery_EV04 is None:
        persistent.gallery_EV04 = False

####################################
# Initializing Gallery

init python:
    gallery = Gallery()
    gallery.transition = Dissolve(0.3)
    
    gallery.button("EV01")
    gallery.condition("persistent.gallery_EV01")
    gallery.image("images/ev/ev01 01.png")
    
    gallery.button("EV02")
    gallery.condition("persistent.gallery_EV02")
    gallery.image("images/ev/ev02 01.png")
    
    gallery.button("EV03")
    gallery.condition("persistent.gallery_EV03")
    gallery.image("images/ev/ev03 01.png")

    gallery.button("EV04")
    gallery.condition("persistent.gallery_EV04")
    gallery.image("images/ev/ev04 01a.png")
        
        
screens.rpy

Code: Select all

screen extra():

    tag menu

    default current_tab = "gallery"

    # Background
    if current_tab == "gallery":
        add "gui/back_gallery.png"
        add "config_icon":
            xalign 0.006
            yalign 0.963

    # Tabs
    vbox:
        style_prefix "extra_tabs"

        # Gallery
        imagebutton:
            idle "gui/btn_tab_cgmode_off.png"
            hover "gui/btn_tab_cgmode_over.png"
            insensitive "gui/btn_tab_cgmode_over.png"
            hover_sound "sse_02"
            action [Play("sound", "sse_01"), 
                    SetScreenVariable("current_tab", "gallery"),
                    SensitiveIf(current_tab != "gallery")]

    if current_tab == "gallery":

        default current_page = 1

        # Page buttons
        vbox:
            style_prefix "gallery_page"

            $ locked_image = "gui/btn_plate_back.png"
            $ hover_image = "gui/thumb_cg/h_border.png"

        grid 2 2:

            style_prefix "gallery"

            if current_page == 1:

                # Button 1
                add gallery.make_button(
                    "EV01", "gui/thumb_cg/EV_01.png",
                    locked=locked_image, hover_border=hover_image)

                # Button 2
                add gallery.make_button(
                    "EV02", "gui/thumb_cg/EV_02.png",
                    locked=locked_image, hover_border=hover_image)

                # Button 3
                add gallery.make_button(
                    "EV03", "gui/thumb_cg/EV_03.png",
                    locked=locked_image, hover_border=hover_image)

                # Button 4
                add gallery.make_button(
                    "EV04", "gui/thumb_cg/EV_04.png",
                    locked=locked_image, hover_border=hover_image)
Everything unlocks fine, displays fine but not sure what causes the thumbnail to disappear upon exiting. I'll keep digging around the forums for anyone with a similar situation though sometimes I wonder if maybe I just misread something and broke the game or if I just have bad luck finding edge cases. (:

Post Reply

Who is online

Users browsing this forum: No registered users