Is there a way to get a total word count of your Inform7 project? I see in Index>>Contents a breakdown by my chapters, etc, but not a grand total.
Are you looking for the total word count of your source code, or the words of printable text?
After you compile, select the Results tab and you’ll see a message like:
The 38-word source text has successfully been translated into a world with 1 room and 2 things, and the index has been brought up to date.
This is all words in the source. Excluding extensions and comments, if I recall correctly.
You can also use any standard word-counting tool on the project/Source/story.ni file.
Ah, the results tab. That’ll work-- this is just for my own vanity. Thanks!
Counting the words of printable text is harder. I’ve used various hacks but I don’t have a simple solution.
This isn’t perfect, but if you have a reasonably-complete exploration of your game via Skein then you can insert a node at the start that executes transcript
, replay the rest of your game via nodes, and then feed the resulting file to wc
or an editor capable of giving you a word count. (Or if you have a list of commands in a file, you can use another interpreter that supports automated replay.)
It’s going to over-count some text like repeated room descriptions and under-count other text such as error messages and alternative paths not explored, but it should give you a ballpark at least. You can mitigate the first a little bit by also running brief
.
That’s a completely different measure, really, and I wouldn’t even try to compare them. Different ballpark in a different county.
(Also, “length of a minimal walkthrough” is completely different from “number of words that the average player sees when solving/completing the game.”)
I didn’t say “minimal walkthrough”, I said “reasonably-complete exploration”. In other words, something designed to print almost every word of sayable text that you have (barring things that are mutually exclusive). As a way to “count the words of printable text”.
Though having said that, it’s quite hard to construct properly that way. A more reliable method would be to run the following:
cat story.ni | grep -o '".*"' | wc -w
This won’t count words in extensions, but assuming you don’t have any story-specific extensions then this is probably what you want anyway. This will still miscount a little (it will include things like Understand phrases, and won’t count room and object names), but again it should get you to a close ballpark.
Yeah, that’s the sort of thing I do. It gets a little more complicated if you put literal linebreaks in quoted text (which is legal).
Hmm, yeah, multi-line quotes are tricky. This one is the best incantation I currently have for that:
cat story.ni | awk -v RS="\"[^\"]*\"" '{gsub(/\n/," ",RT); print RT}' | wc -w