
Lint+ Ren'py Word Counter
A downloadable asset pack
Download NowName your own price
It all started with simple word counts for each character, and kind of escalated from there... Either way, here's a Ren'py Tool!
This code snippet expands Lint's capabilities to show you detailed dialogue-related statistics for your visual novels:
Do you want to keep track of the precise word counts of your characters?
Do you want to know how many lines and words are in your different .rpy files?
Do you want to know which characters have how many words in which .rpy file?
Do you want to know how many choice options there are in your VN?
With the Lint+ Ren'py Word Counter, you can subject yourself to information overload and get answers to all of these questions!
Here are some examples!
Character statistics: * sa has 1,744 lines, and 17,891 words. * ef has 1,148 lines, and 13,599 words. * di has 733 lines, and 9,058 words. * ab has 613 lines, and 6,990 words. * ash has 526 lines, and 6,368 words. * ma has 371 lines, and 4,717 words. * fo has 364 lines, and 4,386 words.
File statistics: * [common_1.rpy] contains 899 lines and 11,178 words. * [common_2.rpy] contains 777 lines and 10,227 words. * [common_3.rpy] contains 1,109 lines and 13,988 words. * [escape/bedroom.rpy] contains 246 lines and 2,483 words. * [prologue.rpy] contains 191 lines and 2,486 words.
Detailed File statistics: [common_1.rpy] contains 899 lines and 11,178 words: * ef has 155 lines, and 1,930 words. * sa and re have 145 lines, and 1,662 and 1,932 words each. * fo has 42 lines, and 545 words. [common_2.rpy] contains 777 lines and 10,227 words: * sa has 68 lines, and 752 words. * re has 60 lines, and 643 words. * ef has 55 lines, and 581 words.
Menu statistics: The game has 38 menus, with a total of 90 possible choices, for an average of 2.37 choices per menu.
These statistics have all kinds of uses, such as:
- Predicting the costs of voice acting, per character
- Keeping track of your writing progress
- Estimating the playtime of a new chapter
- Noticing which characters you've neglected
(or favored too much) - Comparing the lengths of different routes
- Making sure you provide enough freedom of choice
- And probably more!
Word Counter+ Features
With a donation of $1 or more, you also get access to:
- Label statistics
These allow you to see the line and word counts of all labels within each file! - Progress tracker
Compare the difference of your word counts since the last time Lint was run!
How to use:
- Put wordcounter.rpy in your game folder
- Optionally adjust variables to disable unneeded statistics
- Select "Check Script (Lint)" from the Ren'py Launcher
Updates:
- 2025.01.24: Added the progress tracker & compatibility for older Ren'Py versions
- 2024.03.24: Fixed the label counter
- 2024.03.24: Added the label counter, and settings that let you exclude folder paths, files, or characters from the counts
- 2022.09.16: Added requested feature: Menu and choice options counter.
- 2022.09.09: Added ability to batch equivalent characters and count them as one, as well as entirely hide certain characters from the statistics.
- 2022.08.16: Release!
↓ If you have any questions or additional feature requests, feel free to comment below! ↓
Updated | 28 days ago |
Status | Released |
Category | Assets |
Rating | Rated 5.0 out of 5 stars (36 total ratings) |
Author | KigyoDev |
Made with | Ren'Py |
Tags | Ren'Py, sourcecode, Tutorial |
Code license | MIT License |
Asset license | Creative Commons Zero v1.0 Universal |
Average session | A few seconds |
Languages | English |
Download
Download NowName your own price
Click download now to get access to the following files:
wordcounter.rpy 9.9 kB
wordcounter+.rpy 20 kB
if you pay $1 USD or more
Development log
- Lint+ 3.0: New Progress Tracker!28 days ago
- New: Choice Word Counts!Jul 13, 2024
- Rebrand and new features!Mar 18, 2024
Comments
Log in with itch.io to leave a comment.
This is working (free version). Thank you so much. Will upgrade to the paid version as soon as I can get my paypal to work xD
Another thing I noticed, even after copying just the default wordcounter.rpy into the game folder and selecting 'Check Script (Lint)' from the Ren'Py SDK launcher, I still get just the default statistics at the end of Lint.txt
But called from the console in the game itself, it works as expected, but then I obviously only get the condensed output with a large chunk replaced by a "..." line.
Hey, I bought the + version 2 days ago, but it's throwing errors for me in lines 255 and 257 in the two print(f" statements when simply launching the game from the sdk.
```
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/wordcounter+.rpy", line 255: invalid syntax
print(f" * {((longest_name-len(lbl))*blank) + lbl} | {(((longest_blocks-len(humanize(labelstats[lbl].blocks))) * blank)) + humanize(labelstats[lbl].blocks)} | {((longest_words-len(humanize(labelstats[lbl].words)))*blank) + humanize(labelstats[lbl].words)}")
^
File "game/wordcounter+.rpy", line 257: invalid syntax
print(f" * {((longest_name-len(total_text))*blank) + total_text} | {(((longest_blocks-len(humanize(filestats.blocks))) * blank)) + humanize(filestats.blocks)} | {((longest_words-len(humanize(filestats.words)))*blank) + humanize(filestats.words)}")
^
Ren'Py Version: Ren'Py 7.5.3.22090809
Fri Jan 24 08:50:57 2025
```
The formatting likely gets nuked here, but the ^ is located below the last parenthesis in both lines.
It's also the only 2 locations where print(f is used... which seems rather inconsistent with the other print( statements
Thank you for reporting this! I figured out that "print(f" is a newer Python feature, so it was causing problems due to your Ren'Py version (which doesn't have support for Python 3).
I reformatted the print calls and also added a new feature while I was at it. Let me know if the problem persists, and thanks again!
Yes, this fixed it. But even though it doesn't throw an error anymore, I still haven't managed to get it working.
As far as I understand, I just need to copy the file into the game directory of the VN, then use the `Check Script (Lint)` option from within the SDK, right?
Well, it keeps giving me the standard condensed statistics output.
e.g.
Statistics:
The game contains 7,634 dialogue blocks, containing 53,666 words and 289,170
characters, for an average of 7.0 words and 38 characters per block.
The game contains 71 menus, 21 images, and 37 screens.
-----
EDIT: Hmmm, my projects folder is outside of the SDK, obviously... But when I copy the file into the Tutorial's or The Question's game folder (inside the SDK structure), it works...
That’s strange… You’re correct, you just have to place the file where the rest of your game’s script files are, and it should not matter at all where your game is located.
Do you happen to have other plugins that could somehow be overriding things? This is unfortunately the first time I’ve heard anyone have this issue, so I’m not sure how to help just yet...
Wow, this is so useful. Thanks!
This is so helpful, thank you!
just tested this out OMG THANK YOUU
Hi again! I tested it a little more for O2A2 and found out that the text from menu choices was not counted (neither the “question” statement displayed in the main box nor the “answers” displayed in choice boxes). However menus are parsed since the count of choices themselves are counted.
Since O2A2 includes choice text in the 1k word limit it would be nice to display their count. A parameter flag could be added for devs who really want to exclude them (in some games, the choice text is repeated sic as a new text line just below so it makes sense to ignore it sometimes - but generally the “question” is unique anyway).
Thank you for letting me know about this! I just published an update that adds the word counts from choices.
Thanks, for O2A2 the trick is to alternate between define wordcounter_menu_is_character = False and define wordcounter_menu_is_character = True to define the lower/upper boundary of your character counts, which vary depending on the amount of repetition between choice text and actual text (character/narrator tends to repeat the choices).
To go further I turned choice text into a variable that I injected in both choice text and actual text below using “[variable injection syntax]”. This way I can keep using define wordcounter_menu_is_character = True and it gives me the proper count of unique words!
It’s complicated to do and mostly useful for O2A2, plus it may be annoying for translators, but it works! It still has some benefits: no risk of messing changing a choice text and forgetting to update the corresponding dialogue/narration text, and you can still _(“localize”) the variable string so localizers can work translate them only once!
EDIT: oops, no, it doesn’t work as Word Counter+ will count text inside string variables as 1 word per variable, so the count will be too optimistic. Better manually remove the few redundant words if you’re really near 1k words…
Thanks, it’s quite useful for me to assess my future work on O2A2 based on previous work.
I had to dig a bit in the comments of free version to find what the $1 version was bringing (namely label stats), maybe you could expose this more clearly directly on the itch page description.
Since the script is put inside the game folder I’ll have to be careful not to commit the paid version into VCS (at least for public repositories - I suppose it’s OK on private ones only shared with team members) - but I see the free one is under MIT license so I could push it to open source repositories too.
Thank you, I'm glad this tool is useful for you!
And thanks for pointing that out, I just added a description of the label counter to the itch page as well.
There's usually an option to "ignore" files (e.g. "add to .gitignore") which will prevent them from being shared but still make them available to you. Otherwise, I'm not that sad if people go out of their way to pirate a $1 add-on. Still, I appreciate the concern!
You're welcome, it helps a lot. I was looking for some file that would do this and stumbled upon this one, which works in the quickest and most practical way possible.
Fairly new to Ren'py and super glad I found this tool before resorting to more annoying measures! I haven't been able to see the results yet, and I'm not sure if it's due to an actual issue, or if it's due to me being a noob. If everything is working right, should the report be an addendum to the "errors.txt" file that pops up after running Check Script (Lint), or should it appear somewhere else that I am not aware of?
If everything works correctly, Ren'py should generate a "lint.txt" file, not an "errors.txt" file. If possible, you can share what it says in the error file and I can help you resolve the issue!
I swear I have some sort of curse that makes code work if I give it 10-12 hours of resting time. Found some errors, tried again, and got the lint.txt file, with the words successfully counted. Thank you for your response and also for this tool in general!
Is there a specific thing I have to do to get it to work, I leave it as is and then select Check Script (Lint) just like it says but I get this
It's quite likely that you need to update Ren'py, since this is a newer configuration variable.
Otherwise, you could also try removing "define config.lint_character_statistics = False" on line 33, since it's not actually needed for the counter to work.
This seems way fricking easier than the method I've chosen for myself.
I'm glad it could be of use! Just curious, but what was your method?
Fucking Google Drive and deleting anything that wasn't dialogue/monologue lolol
Hahaha, that was my old approach too, before I got fed up with it and decided to make this tool!
I was doing the exact same thing!
Thank you so much for this. I just used it and......thank you!
Thanks for this! A feature request would be to see how many choices are in the script. (Ex. There are a total of 3 choices, with a total of 11 choice options.) <3
That's a great idea! I'm not sure if I'll actually find a way to do that, but I can definitely try.
Getting the amount of choices should be easy(ish) by counting the "menu:" commands. Getting the # of choice options might be a bit more difficult, but should still be possible.
You're right, that turned out to be no issue at all.
Both the number of menus and choices should be available now. Thanks for the suggestion!