Mark All labels as seen

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
dasauto1
Regular
Posts: 38
Joined: Sun Oct 31, 2021 2:26 pm
Contact:

Mark All labels as seen

#1 Post by dasauto1 »

Hello, is there a way to mark all labels as unseen? My problem is that

Code: Select all

renpy.seen_label(label)
returns true if the label has executed at least once, but doesn't "de-count" if the game restarts from the beginning. So I thought if a put a code in the beginning of the script after the game starts to "de-count" all the previously seen labels.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Mark All labels as seen

#2 Post by Ocelot »

Get all labels by https://www.renpy.org/doc/html/label.ht ... all_labels
and then mark each of those unseen https://www.renpy.org/doc/html/label.ht ... bel_unseen

Just be aware that "seen" property is global. If you start new game, play a lot, then start another new game, get label marked unseen and then load first game, all labels will be considered unseen tere too.

seen_label is intended to be used to unlock global gallery, or to mark which blocks can be skipped by user if he is playing second time or things like that.
< < insert Rick Cook quote here > >

User avatar
zmook
Veteran
Posts: 421
Joined: Wed Aug 26, 2020 6:44 pm
Contact:

Re: Mark All labels as seen

#3 Post by zmook »

This is the sort of question that makes me want to ask why you want to do that. There are other ways to track progress, if that's what you want.
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Mark All labels as seen

#4 Post by Remix »

You might do better writing your own system to record which labels have been visited on a per-game basis...

Code: Select all

default visited_labels = []

init python:

    def label_callback(lbl, context):

        if (
                lbl.startswith('_')
                or lbl.startswith("main_menu")
                or lbl in visited_labels):

            return

        store.visited_labels.append(lbl)

    config.label_callback = label_callback


label start:

    `Visited: [visited_labels!q]`
    
    return
The visited_labels list there should now properly reset each new game and be saved/loaded when needed.
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]