Hey all, I'm making a scene gallery for my game. For each scene, I want to indicate whether the player has seen all the choices and variations in that scene.
So, I searched for a way to check if all the text in a specific label has been seen by the player. renpy.count_seen_dialogue_blocks is similar to what I want, but that counts all text in the entire game. I want to limit it to just text between the start and end (jump or return statement) of a given label. Is there a good way to do this?
If not, is there a good way to check if every choice in a specific label has been chosen at least once? I know I could just assign a variable to every choice and check them for each label. But since there are a lot of choices, I'd rather not do that if there's a more efficient method. I looked into using persistent._chosen, which seems to record all chosen choices. However, I'm not sure how to backtrack from the information in persistent._chosen to a specific label.
If anyone has a better idea of how to handle this, please let me know!
Check if all text in a scene has been seen
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.
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.
- Arowana
- Miko-Class Veteran
- Posts: 531
- Joined: Thu May 31, 2012 11:17 pm
- Completed: a2 ~a due~
- Projects: AXIOM.01, The Pirate Mermaid
- Organization: Variable X, Navigame
- Tumblr: navigame-media
- itch: navigame
- Contact:
Check if all text in a scene has been seen
Complete: a2 ~a due~ (music, language, love)
In progress: The Pirate Mermaid (fairytale otome)
On hold: AXIOM.01 (girl detective game)
In progress: The Pirate Mermaid (fairytale otome)
On hold: AXIOM.01 (girl detective game)
- 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: Check if all text in a scene has been seen
Probably the closest thing Ren'Py has is that you can put a label at the end of the scene, and then do renpy.seen_label to determine if it it has been reached. Of course, the usual way to do this is to just use a persistent variable to unlock thinks at the end of a scene.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
- 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: Check if all text in a scene has been seen
With jumping around between labels based on menu choices you likely have scenes that cover multiple labels, so you would need some form of mapping, perhaps like...
gallery_img1_labels = ['label_1', 'label_1_nice', 'label_1_naughty']
You could then integrate that with...
Note it uses _persistent so if you delete lines it might say 'seen 11 of 8 lines'...
gallery_img1_labels = ['label_1', 'label_1_nice', 'label_1_naughty']
You could then integrate that with...
Code: Select all
init python:
def label_info(label_name):
return "{0} of {1} lines read".format(
len( [k for k in persistent._seen_translates if k[0:len(label_name)] == label_name] ),
len( [k for k in renpy.game.script.translator.default_translates.keys() if k[0:len(label_name)] == label_name] ) )
screen label_progress():
vbox:
for k in [j for j in renpy.get_all_labels() if j[0] != "_"]:
text "{0} in label '{1}'".format( label_info(k), k )
label start:
show screen label_progress
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
- Arowana
- Miko-Class Veteran
- Posts: 531
- Joined: Thu May 31, 2012 11:17 pm
- Completed: a2 ~a due~
- Projects: AXIOM.01, The Pirate Mermaid
- Organization: Variable X, Navigame
- Tumblr: navigame-media
- itch: navigame
- Contact:
Re: Check if all text in a scene has been seen
Thanks a bunch for the responses! Remix, your code snippet looks very useful. I'll give a try!
Complete: a2 ~a due~ (music, language, love)
In progress: The Pirate Mermaid (fairytale otome)
On hold: AXIOM.01 (girl detective game)
In progress: The Pirate Mermaid (fairytale otome)
On hold: AXIOM.01 (girl detective game)
Who is online
Users browsing this forum: Semrush [Bot]