RPG Maker Text Tools: Text Manipulation and Management

RPG Maker Text Tools​

by Breaker Zero​

This plugin is designed to simplify the use of JavaScript text functions and serve other purposes which may relate to character dialogue or other in-game text displays. It revolves around alternating case, upper case and functions related to categories of language. Credit BreakerZero if used in your project. Free to use in any project under the terms of the MIT license.

Special Note Regarding the Plugin Functions​

At this time, the family mode option is functional only if Yanfly Message Core is installed and active with your project. If you intend to use family mode, please obtain that plugin first.

Script Calls​

Alternating Case​

This function changes a string of text to alternating case. Useful if you have a character that speaks through artificial means, or who is a mechanical being in a sci-fi scenario. To use, add this to a game variable definition:

alternatingCase(string)

Alternatively, you can use a script call. For example:

$gameVariables.setValue(1, alternatingCase("good morning"));

String: the text string to convert.

Actor Name Alternating Case​

This version of the alternating case function affects the name of the actor specified by his or her ID number. To use, add this to a game variable definition:

actorNameAlternatingCase(actorID)

Alternatively, you can use a script call. Using actor one as an example:

$gameVariables.setValue(1, actorNameAlternatingCase(1));

actorID: the targeted actor's ID number.

Upper Case​

This function changes a string of text to upper case. Useful if you have a character who is extremely angry, or to place emphasis on a portion of the game's text. To use, add this to a game variable definition:

upperCase(string)

Alternatively, you can use a script call. For example:

$gameVariables.setValue(1, upperCase("good morning"));

String: the text string to convert.

Actor Name Upper Case​

This version of the upper case function affects the name of the actor specified by his or her ID number. To use, add this to a game variable definition:

actorNameUpperCase(actorID)

Alternatively, you can use a script call. Using actor one as an example:

$gameVariables.setValue(1, actorNameUpperCase(1));

actorID: the targeted actor's ID number.

Configuration Settings​

Use Family Mode​

Allows for the creation of a family mode for your game, which detects and hides any strong language in game dialogue. Note that the functionality is not dependent on the case of text used - it can be upper case, lower case or a combination thereof and still detect the words to be filtered out. The most common forms of strong language (and a few culturally sensitive ones) are detected and filtered when using this functionality.

Family Mode Option Text​

When using family mode, this sets the name of the option in the preferences screen.

Block List File Name​

When using family mode, sets the name of the block list. Make sure it's saved within the data directory as a comma-separated value (CSV) file. A sample file supporting English, German, Italian, Spanish, Japanese, Korean and Simplified Chinese is included in the GitHub repository as blocklist.csv (which is also the default file name).

Replacement Text​

When using family mode, it determines what text is used to replace strong language in the game's dialogue. Default option is a simple BLEEP marker.

Get the Plugin​

Download from GitHub
Download from itch.io
You might consider turning the censored list into a plugin parameter that the user can edit.

Your list:
- has words that aren't necessarily censor-worthy
- doesn't have words that might be censor-worthy
- presumes people spell the words the way you chose

Also, I'm unsure what your instructions "add to a game variable definition" mean.

If you mean to put that in the Script box of a Control Variables event command, you might want to say that more explicitly - I think a low-level user that your plugin is aimed toward will not understand what you mean.

You also might consider presenting them in a plugin command format for said users.
You might consider turning the censored list into a plugin parameter that the user can edit.

Your list:
- has words that aren't necessarily censor-worthy
- doesn't have words that might be censor-worthy
- presumes people spell the words the way you chose

Also, I'm unsure what your instructions "add to a game variable definition" mean.

If you mean to put that in the Script box of a Control Variables event command, you might want to say that more explicitly - I think a low-level user that your plugin is aimed toward will not understand what you mean.

You also might consider presenting them in a plugin command format for said users.
What I mean by variable definition is when you create a game variable and assign a script command to it. Sorry for the confusion, but I can add a screenshot for those who are unfamiliar with this.

Also, it's technically called family mode so the words are chosen as a result of this. I can release an updated version that will allow you to determine how strong the filter is, if you prefer. However, there are legitimate cases where any strong language is not advisable, for example if you are streaming the game for the purpose of a wider audience (which could include children) or if the purpose of such a streaming video requires that strong language be excluded (for example, Extra Life charity events which have to be family friendly) so in these cases the actual presence of these words may not be acceptable.
Is there a particular benefit to using your upperCase function instead of the toUpperCase function that's natively available to strings in JS?
Sorry for the confusion, but I can add a screenshot for those who are unfamiliar with this.
I don't think a screenshot is necessary if you just use the words that are actually present in RPG Maker.

Also, it's technically called family mode so the words are chosen as a result of this. I can release an updated version that will allow you to determine how strong the filter is, if you prefer.
I have no preference, I am not a potential user of this plugin. I maintain my original point - not all of the words you listed are un-family-friendly, there are other words that people would consider family unfriendly, and not everything you have in there is a standard spelling.

It would cost you almost 0 effort to move the string to a plugin parameter for the user to edit.

That's my suggestion. Good luck with your work.
Version 1.0.1 has been released to add functionality by which the developer can choose as to whether or not some strong words can be used. Note that the higher strength level of filtering (cultural slurs, sexual expletives etc.) cannot be turned off without deactivating family mode; however, by allowing moderate mode to be used the developer can give the player a choice as to how strict the game is when in family mode (for example, the word damn is visible when moderate mode is activated and hidden when it is not). Also note that you can only access moderate mode if the main family mode option is turned on.

Is there a particular benefit to using your upperCase function instead of the toUpperCase function that's natively available to strings in JS?
I also forgot to mention (and apologies if this is technically double posting) that the inclusion of the uppercase function is intended to simplify this functionality, such that it doesn't require the developer to spell out the entire built-in function (and especially so with the actorID version, which only requires the developer to specify a numeric code that corresponds to that actor in order to get the uppercase conversion). I do also use the built-in uppercase conversion regardless (and in fact the only conversion that requires custom code is for alternating case).
Not to pile on here, but the idea of a word filtering plugin that only filters words the plugin author specifies seems... incredibly strange to me. Even stranger is that, rather than what @ATT_Turan suggested, you seem to have introduced a "moderate" tier of filtered words that, again, you are specifying.

It's a really weird approach in my view. It's of limited use to anyone who doesn't subscribe to your exact view of which words are offensive and require filtering.

You've also left out some words that would be huge red flags in my book, which makes me wonder about the point of this entire thing.

I could kind of see the point if you were trying to follow some sort of specific, established guidelines (e.g. ESRB guidelines, if they actually have word guidelines?). But from what I can gather, the filtered words are pretty arbitrary.

But, hey—you do you, and again, I'm not trying to pile on here. It's just weird.
Not to pile on here, but the idea of a word filtering plugin that only filters words the plugin author specifies seems... incredibly strange to me. Even stranger is that, rather than what @ATT_Turan suggested, you seem to have introduced a "moderate" tier of filtered words that, again, you are specifying.

It's a really weird approach in my view. It's of essentially no use to anyone other than people who subscribe to your exact view of which words are offensive and require filtering.

You've also left out some words that would be huge red flags in my book, which makes me wonder about the point of this entire thing.

I could kind of see the point if you were trying to follow some sort of specific, established guidelines (e.g. ESRB guidelines, if they actually have word guidelines?). But from what I can gather, the filtered words are pretty arbitrary.

But, hey—you do you, and again, I'm not trying to pile on here. It's just weird.
To be fair, I wanted to at least start with the more common words (things like d**n, s**t and the f-bomb), and I have not yet done a more comprehensive level of research into the entire list of excessively strong words as of yet. Future versions can expand on this list once I do a bit of research, or if there are any that you can think of then you can DM me a list file and I'll throw them onto the pile in the next update.

Also (and just to be clear) the moderate level is for words that may be excessively strong, but not that strong. In that particular case, I'm going by established strength levels for certain words (so d**n and s**t count as moderate words, but c**t and f**k are considered to be at the higher end of the two extremes). But again, this can be improved in future versions.

As an aside, I do intend to add an extensive mode that allows the developer to include a custom word list that can also be turned on or off depending on the user's preference. However, it will take a while for me to figure out the most effective way to do so, and therefore will have to wait for a future version.
To be fair, I wanted to at least start with the more common words (things like d**n, s**t and the f-bomb), and I have not yet done a more comprehensive level of research into the entire list of excessively strong words as of yet.
Or you simply allow the plugin's user to list the words that they know they're using in their own project, which requires zero levels of research on your part.

It's just perplexing that you feel the need to control the process when that makes it both harder for you and less useful to anyone who might want to consider the plugin.

But whatever works for you.
Just read through the topic, and I gotta agree with the general consensus. What use is a profanity filter that a potential user of this plugin can't edit as they see fit? Beyond that, it's way less work on your part to just allow the developer to put together their own censor list.

Doing it the way you're doing it makes it seem like you absolutely need control over this aspect of someone else's project. Combine this with the way I recall you repeatedly reporting a thread to try and get it closed . . . well, that don't look so good.
Did you write this plugin, or is it AI-generated?

It has chunks of duplicated code.

It calls the wrong function for adding text to the game message window.

It tries to call the filtering function on an array of curse words that was never defined.

It has syntax errors that prevent the file from even loading.
Did you write this plugin, or is it AI-generated?

It has chunks of duplicated code.

It calls the wrong function for adding text to the game message window.

It tries to call the filtering function on an array of curse words that was never defined.

It has syntax errors that prevent the file from even loading.
That's weird... it was working on my end and I tested it, and no I don't use AI for anything. That being said, I did have a few changes that I was making to what would be in the first update (the error that you mentioned, for example, is probably because you may have downloaded while I was preparing for the custom block list, which I decided to hold off on for the current version).

In any case, I can check the code for issues that I might have overlooked and if needed I will push a fix. As it is, I tested everything on my end to make sure that it works before pushing the update, so try downloading again and if you still have problems then I will gladly take a screenshot so I can narrow down the problem.
That's weird... it was working on my end and I tested it, and no I don't use AI for anything. That being said, I did have a few changes that I was making to what would be in the first update (the error that you mentioned, for example, is probably because you may have downloaded while I was preparing for the custom block list, which I decided to hold off on for the current version).

In any case, I can check the code for issues that I might have overlooked and if needed I will push a fix. As it is, I tested everything on my end to make sure that it works before pushing the update, so try downloading again and if you still have problems then I will gladly take a screenshot so I can narrow down the problem.
The error Turan appears to be referring to is that your filtering code references a "commonSwears" variable that you never define anywhere. Going by context, I'm guessing it was supposed to be "moderateSwears" but was mistyped.

Your alternatingCase function also references the identifier "s" in the body but the parameter you provided in the definition was "string".
The error Turan appears to be referring to is that your filtering code references a "commonSwears" variable that you never define anywhere. Going by context, I'm guessing it was supposed to be "moderateSwears" but was mistyped.

Your alternatingCase function also references the identifier "s" in the body but the parameter you provided in the definition was "string".
Thanks for letting me know. Version 1.1.0 will be going up soon, this removes the moderate mode and replaces it with a developer-defined block list as suggested earlier (and which should therefore also address the first issue that you mentioned). I'll also go ahead and fix the alternating case function as well.

EDIT: The update is now live. Thanks again for the suggestions and input!
It still uses the wrong function for Show Text. It won't work for developers using the vanilla engine without Yanfly's Message Core.
It still uses the wrong function for Show Text. It won't work for developers using the vanilla engine without Yanfly's Message Core.
That's by intention, I do it this way so that I can detect word wrap settings in the plugin that you mentioned. I tried the other method and it borked everything. However, I have tested with and without and it works fine for me.

EDIT: In case it helps to clear up confusion regarding this aspect of the plugin, here's the detection line for Yanfly's message core:

JavaScript:
if (Imported.YEP_MessageCore == true && $gameSystem.wordWrap()) filteredDialogue = '<WordWrap>' + filteredDialogue;

For those of you who know anything of JavaScript, it detects if Yanfly Message Core is both in the project and activated (as well as whether or not its word wrap function is set to automatic processing), and if both are true then it adds the word wrap modifier to the processed text. If one or both are false, then the text is displayed using the default implementation.

EDIT 2: Patched to 1.1.1 which addresses a small flaw in one of the variable definitions that in certain cases may not properly store the array data upon import. This may also address the issue that @ATT_Turan raised in their most recent post.
That's by intention
Then you should tell users Yanfly's Message Core is required for your plugin.

However, I have tested with and without and it works fine for me.
I don't see how it possibly could, the default engine does not have a Game_Message.addText() method.

The only window that does is the Battle Log.

So when your plugin declares a new addText() method and then doesn't call it anywhere, I don't see how it's possible for it to work.
Then you should tell users Yanfly's Message Core is required for your plugin.


I don't see how it possibly could, the default engine does not have a Game_Message.addText() method.

The only window that does is the Battle Log.

So when your plugin declares a new addText() method and then doesn't call it anywhere, I don't see how it's possible for it to work.
I don't know, maybe it's being called regardless? In any case, I'll add the disclaimer just to be fair.

EDIT: I'm pushing version 1.1.2 so that overrides along the lines of what Yanfly does are in place, this should ensure that the call is processed properly. As such, I am removing the disclaimer.

EDIT 2: Updated to version 1.1.3. There was a little more to the Yanfly implementation that I didn't previously account for, so this has been addressed to fix any issues that may have resulted from this oversight.

EDIT 3: Added a note regarding the family mode implementation due to the method of providing compatibility with Yanfly Message Core (and also changed some of the terminology), thereby changing the version to 1.1.4 for tracking purposes.

EDIT 4: The disclaimer is going back up. Apparently, I'm not yet done with analyzing the Yanfly implementation for the compatibility provisions. This also necessitates temporary removal of the overrides, changing the version to 1.1.5 for tracking purposes.

Original thread: https://forums.rpgmakerweb.com/threads/rpg-maker-text-tools-text-manipulation-and-management.162706/