Ren'Py How can I make an exception for renpy.seen_label()? [SOLVED]

JohnDupont

Active Member
Modder
May 26, 2017
812
2,720
I am using renpy.seen_label() for a gallery.
Code:
screen gallery:
    frame:
        for i in range(0,len(gallery_picked)):
            if renpy.seen_label(gallery_picked[i]):
gallery_picked[l] is a label found in a .csv file.

One of the labels can't be seen through a normal playthrough and is therefore locked.

Is there a way to force this label to be "seen" without actually seeing it?
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,490
7,035
Why not just add an extra condition?

Code:
screen gallery:
   frame:
       for i in range(0,len(gallery_picked)):
           if renpy.seen_label(gallery_picked[i]) or gallery_picked[i] == "the_special_label":
 

JohnDupont

Active Member
Modder
May 26, 2017
812
2,720
Why not just add an extra condition?

Code:
screen gallery:
   frame:
       for i in range(0,len(gallery_picked)):
           if renpy.seen_label(gallery_picked[i]) or gallery_picked[i] == "the_special_label":
Thanks.

the_special_label
is a variation of a scene which can be seen though normal means. I'm trying to make it so seeing the_normal_label unlocks the special label with :
Code:
if renpy.seen_label(gallery_picked[i]) or ( gallery_picked[i] == "the_special_label" and renpy.seen_label("the_normal_label") ):
It seems to work.
I can't tell for sure because persistent._clear() doesn't seem to reset renpy.seen_label() for some reason. Am I missing something?

EDIT: NVM it's actually persistent._clear(progress=True). It will require a bit more testing but i'm pretty sure, it's working. Thanks again @Rich
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,490
7,035
EDIT: NVM it's actually persistent._clear(progress=True). It will require a bit more testing but i'm pretty sure, it's working. Thanks again @Rich
You could also just delete the file in which the persistent information is kept. It's called (duh) 'persistent', and is in the directory where your game saves are made.
 

JohnDupont

Active Member
Modder
May 26, 2017
812
2,720
You could also just delete the file in which the persistent information is kept. It's called (duh) 'persistent', and is in the directory where your game saves are made.
I deleted it (It's in %Appdata%/Roaming/Renpy/Gamename/, right?) but it didn't change anything. Anyway, I did more testing and it's working perfectly. Thanks again.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,284
I deleted it (It's in %Appdata%/Roaming/Renpy/Gamename/, right?) but it didn't change anything.
The save files are stored both in the AppData folder and in the game/save folder ; the newer of the two file being used, whatever the folder it is. But if you just want to get ride of the persistent data, why not click on "delete persistent" on the Ren'py launcher ? It should delete the persistent file for the selected project.

As for your initial question, that's how you force a label into seen_label :
Code:
    $ renpy.game.persistent._seen_ever["label name"] = True
And if you just want to clean the list of seen label, while keeping the rest of the persistent data :
Code:
    $ renpy.game.persistent._seen_ever.clear()
 

wurg

Active Member
Modder
Apr 19, 2018
705
1,634
The save files are stored both in the AppData folder and in the game/save folder ; the newer of the two file being used, whatever the folder it is. But if you just want to get ride of the persistent data, why not click on "delete persistent" on the Ren'py launcher ? It should delete the persistent file for the selected project.

As for your initial question, that's how you force a label into seen_label :
Code:
    $ renpy.game.persistent._seen_ever["label name"] = True
And if you just want to clean the list of seen label, while keeping the rest of the persistent data :
Code:
    $ renpy.game.persistent._seen_ever.clear()
I'm making a gallery mod for a game using custom labels for the scenes to cut down on the previous dialog that isn't important to the scene and have been sitting here for over two hours trying different things to get 'action Replay ("label") to work if the user hasn't seen the label and return you to the gallery menu where they left off.

So thank you again for helping me, even though this time I didn't ask you directly, you don't know how much posting these things help us who are not familiar with Python or are very familiar with how the Ren'Py engine works.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,284
[...] you don't know how much posting these things help us who are not familiar with Python or are very familiar with how the Ren'Py engine works.
Well, it's what I try to do, and it's always a pleasure to see that it helped.
 
  • Like
Reactions: JohnDupont

Tacito

Forum Fanatic
Jul 15, 2017
5,339
42,958
Code:
    $ renpy.game.persistent._seen_ever["label name"] = True
And if you just want to clean the list of seen label, while keeping the rest of the persistent data :
Code:
    $ renpy.game.persistent._seen_ever.clear()
Thanks as usual , very difficult find information about this.
During my experiment they work very well.
Now i want to remove a seen label but
$ renpy.game.persistent._seen_ever["label name"] = False
doesn't work , False or True is the same thing for renpy.seen_label("label name")

I try in console
del renpy.game.persistent._seen_ever["label name"]
seems to work ... but this can create problems ?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,284
I try in console
del renpy.game.persistent._seen_ever["label name"]
seems to work ... but this can create problems ?
It will not create problems since it's the way to remove an entry from a dictionary (what is "_seen_ever").

And you're right, the value don't mater here. I used True as value to stay consistent with what Ren'py do itself, but what is important is that the entry exist in the dictionary, not its value.
 
  • Like
Reactions: Tacito