[SOLVED] A way to know how many words are in your game?

Status
Not open for further replies.

cedr777

Veteran
Veteran
Joined
Feb 22, 2018
Messages
265
Reaction score
60
First Language
Not English
Primarily Uses
RMMV
Hi, my main platform is MV. So far I've been working on our project for almost a year now, and nearing the next version release.

I've created many additional events, which contained lengthy dialogues.

Now I haven't manually kept track of it but is there a way to find out how many words are currently in your project?
Basically the words inside the show text command is what counts the most.

I want to inform people of how many words have been added to the updated version on the change log.

A plugin perhaps?
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
This should count every word on every event of every map in the "Show Text" command. Open the console during playtest by pressing F8 and paste this in:

Code:
let totalWordCount = 0
function countWordsOnMap(mapJson, mapId) {
    return new Promise((resolve, reject) => {
        let mapWordCount = 0
        mapJson.events.forEach(event => {
            if (event) {
                event.pages.forEach(page => {
                    page.list.forEach(listItem => {
                        if (listItem.code === 401) {
                            mapWordCount += listItem.parameters[0].split(' ').length
                        }
                    })
                })
            }
        })
        console.log(`Map ${mapId} ${mapJson.displayName} has ${mapWordCount} words.`)
        totalWordCount += mapWordCount
        resolve()
    })
}
async function countAllWords() {
    const mapInfosPromise = await fetch('data/MapInfos.json')
    const mapInfosJson = await mapInfosPromise.json()
    const promises = mapInfosJson.map(async info => {
        if (info) {
            const mapPromise = await fetch(`data/Map${info.id.toString().padStart(3, '0')}.json`)
            const mapJson = await mapPromise.json()
            return countWordsOnMap(mapJson, info.id)
        }
    })
    const values = await Promise.all(promises)
    console.log(`The total number of words is: ${totalWordCount}`)
}
countAllWords()
 

cedr777

Veteran
Veteran
Joined
Feb 22, 2018
Messages
265
Reaction score
60
First Language
Not English
Primarily Uses
RMMV
Mein Gott! It worked, and it tells me that our project currently has 46,821 words.

And it even shows the Map ID and Name. that is awesome!
It's true, I really have typed so much in that Camping Site maps.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
[move]JS Plugin Requests[/move]
 

hiddenone

Lurker Extraordinaire
Global Mod
Joined
Feb 19, 2014
Messages
2,496
Reaction score
5,332
First Language
english
Primarily Uses
RMMZ

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,549
Members
137,836
Latest member
T62352536256t362
Top