Page 1 of 1

Counter for lines of text for reference

Posted: Sat Oct 13, 2018 9:48 pm
by Settle for Pocky
I can't seem to find it on here and when I type in "counter" in the search box it freezes up, so maybe there is so much of it?

I would want something in the corner that would have the total line of text (each block) and what I'm on currently
(like 1/500, 2/500, 3/500, etc.) so it's easier for people testing and for me referencing back to something.

take care,
Patrick B.

Re: Counter for lines of text for reference

Posted: Sun Oct 14, 2018 3:55 pm
by Imperf3kt
Renpy has a pre built (or you can make your own) screen for that called the progress_screen
It makes use of renpy.seen
https://www.renpy.org/doc/html/other.ht ... gue_blocks

Re: Counter for lines of text for reference

Posted: Sun Oct 14, 2018 11:40 pm
by Settle for Pocky
Do I literally just copy/paste

renpy.count_seen_dialogue_blocks() ?

Because I'm having trouble doing it (so I know there's probably more to it)

Re: Counter for lines of text for reference

Posted: Mon Oct 15, 2018 3:00 pm
by Imperf3kt
Okay, so you have two options.
You can use the prebuilt screen that can be found in renpy common, or make your own.

Code: Select all

screen _progress:
    $ new = renpy.count_newly_seen_dialogue_blocks()
    $ seen = renpy.count_seen_dialogue_blocks()
    $ total = renpy.count_dialogue_blocks()

    drag:
        draggable True
        focus_mask None
        xpos 0
        ypos 0

        text "[new] [seen]/[total]":
            size 60
            color "#fff"
            outlines [ (1, "#000", 0, 0) ]
            alt ""
All you have to do is in your script, "show screen progress_screen"
Alternatively, you can "ShowMenu ("progress_screen")" from a screen, but you might need to add tag menu to the progress screen.

You'll also likely want to style the screen.


Or, you could show it in the dialogue:

Code: Select all

default new = renpy.count_newly_seen_dialogue_blocks()
default seen = renpy.count_seen_dialogue_blocks()
default total = renpy.count_dialogue_blocks()

label start:
    "Hi, you have read [seen] of [total] lines of dialogue. You read [new] of those since you last stared the game."
    

Re: Counter for lines of text for reference

Posted: Mon Oct 15, 2018 11:31 pm
by Settle for Pocky
So this is what I did
I changed the progress screens so they would match (it would just bring me to the error screen), not sure if a typo.

Code: Select all

#COUNT BLOCKS OF TEXTS

screen progress_screen:
    $ new = renpy.count_newly_seen_dialogue_blocks()
    $ seen = renpy.count_seen_dialogue_blocks()
    $ total = renpy.count_dialogue_blocks()

    drag:
        draggable True
        focus_mask None
        xpos 0
        ypos 0

        text "[new] [seen]/[total]":
            size 60
            color "#fff"
            outlines [ (1, "#000", 0, 0) ]
            alt ""

    
# CHARACTERS SMOOTHLY COMING IN

init python:
    define.move_transitions("ease", 0.6)

# The game starts here.

label start:
    
    show screen progress_screen

So what I get is in the corner in white numbers with black outlines
0 813/1376 and doesn't move from that spot
So it does start at 0, but no idea where it's getting the 813/1376 from

and that same thing happens when I try it the other way with the dialogue box.

I'm really sorry about this, I spent about a hour tinkering with it.

This code also starts on line 105 if that helps :/

Re: Counter for lines of text for reference

Posted: Tue Oct 16, 2018 12:50 am
by Imperf3kt
What that means would be 0 dialogue blocks have been read since the game was started or loaded.
813/1376 would mean that 813 dialogue blocks have been seen (probably during testing) from 1376 total dialogue blocks.

If these numbers don't match what you expect to see, you might need to delete persistent data from the Ren'Py launcher

Re: Counter for lines of text for reference

Posted: Tue Oct 16, 2018 11:18 am
by Settle for Pocky
https://vimeo.com/295393839

Ok I got it but last thing is how to reset so when I open it again it goes back to 0/how many lines there are (0/500) instead of keeping track from last time.

I owe you a ton

take care,
Pat

Re: Counter for lines of text for reference

Posted: Tue Oct 16, 2018 2:50 pm
by Imperf3kt
That should be taken care of by deleting persistent data.
Building the game should also clear it (in the built distribution)

I am not sure on this though, having never considered it.
Oh and in your video, for some reason, your browser never loses focus and blocks half the screen.

Re: Counter for lines of text for reference

Posted: Tue Oct 16, 2018 5:05 pm
by Settle for Pocky
Sorry about the video.

So yeah my plan was when people were to test out the game they could pick out exact lines with grammar or other problems but also able to start over from checkpoints and able to just show what line you currently on rather than how much you've gone through.

Your advice still helps for the future, thanks :)