Image Gallery's Locked Items - Always Indicate or Never?

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
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Image Gallery's Locked Items - Always Indicate or Never?

#1 Post by Tayruu »

I spent some time earlier working on the screen and code surrounding my project's CG gallery, as detailed here in the documentation*. I've run into something that might be a bit of a feature request, I'm not sure.

This is about when images are locked. In this example, a button points to two images. One or the other could be seen, and so the other is locked.

Image
Here the first image is unlocked. By default, it will skip the rest of the images if they're all locked, and return to the gallery.

Image
If the second image is seen instead, you're given the screen that says "Image x of x locked", followed by unlocked images, then it returns to the gallery.

The problem I have, is the inconsistency. What I want is either that the "Image x of x locked" will always display if something is locked, or it never displays.
Image

Image

The former example is easy to make happen, but inconvenient: in renpy/common/00gallery.rpy on line 466 is the following code -

Code: Select all

if self.locked and result.endswith("_unlocked"):
  images = all_images
else:
  images = unlocked_images
With just images = all_images, the message of a locked image always displays. However of course, this is editing Renpy's core code, and it's buried in a large block. As for never displaying the message - and skipping right to the next available image - I don't know how to achieve that.

"locked = True" is described in the documentation as "the gallery will advance through locked images", but I've observed no effect.

* As an aside, some of the language is contradictory. Besides "locked"'s behaviour; "unlock" is described as for "an image that automatically unlocks", but it's more like "this image will unlock when it is seen". I'm not sure if "unlock_image" has different behaviour, but I do know "unlock" doesn't play nice with "condition", so my setup checks if I'm looking for a preset condition, calling one or the other.

User avatar
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Re: Image Gallery's Locked Items - Always Indicate or Never?

#2 Post by Tayruu »

I'm not sure what the practice is about bumping unsolved topics, but am still unsure about how to approach this. I don't see anything new in the documentation, unless I'm missing it.

Additionally I have a bug in the same screen, though admittedly unrelated to the above:

Code: Select all

add art_gallry.make_button(i.id, i.thumb, style="artpage_button", hovered=[SetScreenVariable("caption_text", i.caption)], unhovered=[SetScreenVariable("caption_text", caption_deft)])
This is a part of my code - the thumbnails display a caption at the bottom corner of the screen on hovered, and replace with a X/X unlocked caption on unhovered.
When an item is selected, images are viewed, and the player returns to the art index, the caption remains as it is. The hover/unhovered events are ignored.

A non-interactable area of the screen must be clicked, or the gallery viewport must be scrolled, before the events work again.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Image Gallery's Locked Items - Always Indicate or Never?

#3 Post by PyTom »

Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
vollschauer
Veteran
Posts: 231
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Image Gallery's Locked Items - Always Indicate or Never?

#4 Post by vollschauer »

I really would like to know if you last example works now? I would like to display only unlocked images and "skip" the locked ones ...
I expected to get it with:

Code: Select all

g.locked = True / False
But no luck, it makes no difference if it's True or False...

Nova Alamak
Regular
Posts: 71
Joined: Sun Jun 08, 2014 1:45 pm
Contact:

Re: Image Gallery's Locked Items - Always Indicate or Never?

#5 Post by Nova Alamak »

I'm having this exact same problem. Any updates?

User avatar
vollschauer
Veteran
Posts: 231
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Image Gallery's Locked Items - Always Indicate or Never?

#6 Post by vollschauer »

it's actually "solved" with the latest 6.99.11 (pre-version) of renpy
use:

Code: Select all

g.unlocked_advance = True or False
https://github.com/renpy/renpy/pull/983

Nova Alamak
Regular
Posts: 71
Joined: Sun Jun 08, 2014 1:45 pm
Contact:

Re: Image Gallery's Locked Items - Always Indicate or Never?

#7 Post by Nova Alamak »

Ooh, thanks! I'll try this when I get a chance. Do you know when it will be in the official release versions?

User avatar
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Re: Image Gallery's Locked Items - Always Indicate or Never?

#8 Post by Tayruu »

This appears to be fixed already in 6.99.10, maybe earlier. I'm not sure if it's an option that does it, or if it's by default?
I'm saying this because it appears to function as per the first suggestion (Image x of x locked will display any time an image is locked, earlier or later), without me doing anything.

The code mentioned in 00gallery is different - the if/else cases are swapped.

Nova Alamak
Regular
Posts: 71
Joined: Sun Jun 08, 2014 1:45 pm
Contact:

Re: Image Gallery's Locked Items - Always Indicate or Never?

#9 Post by Nova Alamak »

Strange... I had to use vollschauer's method to get anything to work. I was going to try the other suggestion, but the code in my 00.gallery was already changed to reflect PyTom's github edit. I'm fine with the g.unlocked_advance though, as long as it continues to work in the next version!

Post Reply

Who is online

Users browsing this forum: AdsBot [Google], Google [Bot], Ocelot, snotwurm