Gallery Thumbnails - Hooking Up Custom Unlocked Image?

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
AnnieTiamat
Regular
Posts: 53
Joined: Tue Dec 01, 2015 3:24 pm
Location: Seattle
Contact:

Gallery Thumbnails - Hooking Up Custom Unlocked Image?

#1 Post by AnnieTiamat »

Hey guys - apologies if this has been run over before, but being that the terms "galleries" and "thumbnails" are a bit on the common side, they're trickier to search and find the key elements one's looking for!

So I've got a Gallery that is kicking around GREAT. Lock/unlocks work, images display, it's awesome.

Here's the catch: I want each image to have a CUSTOM thumbnail - ONLY when it's unlocked. I've got em ready, but I have code in place (from a previous setup) that auto-creates that unlocked image. How do I disable this code and set up my own individual gallery icons (that also only appear when unlocked)?

Here's the basic code I'm rolling with:

Code: Select all

screen atlas_gallery:
    tag menu
    add "ui/menu_background.png"
    add "gallery_ground"
    use navigation
    text "Gallery" xpos 415 ypos 25 size 40
    frame:
        style "atlas_gallery_frame"
        area (23,105,768,650)
        grid atlas_rows atlas_cols:
            style_group "atlas_gallery"
            $ i = 0
            $ next_atlas_page = atlas_page + 1            
            if next_atlas_page > int(len(atlas_gallery_items)/atlas_cells):
                $ next_atlas_page = 0
            for atlas_item in atlas_gallery_items:
                $ i += 1
                if i <= (atlas_page+1)*atlas_cells and i>atlas_page*atlas_cells:
                    # $ atlas_item_text = str(atlas_item)
                    add atlas_gallery.make_button(name=atlas_item, unlocked="gal_icon_" + filter(str.isalnum, atlas_item), locked="ui/gallery_item_locked.png", style="atlas_gallery_grid_button", idle_border=filter(str.isalnum, atlas_item) + "_text",hover_border=filter(str.isalnum, atlas_item) + "_text_hover")
            for j in range(i, (atlas_page+1)*atlas_cells): #we need this to fully fill the grid
                null
The key there is the unlocked="gal_icon_" bit!

Individual references look like this:

Code: Select all

    # Placeholder Crew
    atlas_gallery.button("Placeholder Crew")
    atlas_gallery.condition("persistent.unlock_points >= 60")
    atlas_gallery.image("gCplace")
I am 100% betting it's a case of "dude, just remove that reference and put in other ones tagged as X in your individual references" - and I am entirely cool with being a dork that doesn't get the basics. I am here to be humble and learn :)

Many thanks!

Post Reply

Who is online

Users browsing this forum: No registered users