Quick SpellCheck

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
591
First Language
English
Primarily Uses
RMMV
I was excited when I thought of this, but after I made a quick plugin to my dismay, the RMMV Chromium game wrapper does not have built-in spellcheck like other Chromium. Or maybe just mine is buggy; does your spell check work? I know I'm having other problems with my game wrapper lately. So this only works for me when I run the game in a browser through the game project index.html, which voids the purpose of easy spell check in that if you have to spellcheck in something else anyway why even use a plugin?


What this does is creates a tag with contentEditable and spellcheck outside the game wrapper and all message text shows up in it, and if your Chromium has spellcheck or if you run this in the browser it puts the red underline on the misspelled words. You have to resize the game window to see the tag if not in a browser. I didn't think it would work in the game wrapper anyway (for me it doesn't), so I didn't add anything to resize the window automatically. I will do that if you test this and it does in fact work for you. Probably won't.


Of course you would take this plugin out, before distributing your game.


Screenshot: misspelled word underlined in the tag (above the game window)

Screen Shot 2017-01-27 at 10.07.07 PM.png



version 0.2 (possibly browser-only, so it's pointless... take it or leave it...)

Code:
/*
 * Spell-check Window
 *
 * @plugindesc Shows text in an outside window for spell-checking.
 * @author Mogwai "Jake Jilg"
 *
 */
window.addEventListener("load", function(e){
	var p = document.createElement("p");
	p.contentEditable = true;
	p.spellcheck = true;
	p.id = "spellCheckBox";
	p.style.color = "#000";
	p.style.backgroundColor = "#fff";
	p.appendChild(document.createTextNode("Spell Check Box"));
	document.body.appendChild(p);
});
Game_Message.prototype.addCached = Game_Message.prototype.add;
Game_Message.prototype.add = function(text) {
	var p = document.getElementById("spellCheckBox");
	p.innerHTML = '';
	var text_node = document.createTextNode(text);
	p.appendChild(text_node);
    return Game_Message.prototype.addCached.apply(this, arguments);
};
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Very nice!  Are you adding the ability to add words to the dictionary?  I imagine most of my player's names will throw up errors.  It might be worth experimenting with the placement of the check - I suspect that would throw a few errors if escape codes are used.
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
591
First Language
English
Primarily Uses
RMMV
It's browser spellcheck so add to dictionary is usually in the right click menu,Screen Shot 2017-01-28 at 9.22.18 AM.png


but I just discovered a bug when I add it this way that for some reason disabled context menu events.


Tinkering around adding it on window load seems to fix this for whatever reason so now I have a version 0.2


I didn't think anybody would be impressed. Do you mean to say this works in your playtest Chromium? It doesn't work in mine.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I haven't tried it.  I just really like the concept.  I hope you do get it working.
 

mogwai

1984
Veteran
Joined
Jun 10, 2014
Messages
875
Reaction score
591
First Language
English
Primarily Uses
RMMV
For all functional purposes this does work in a browser anyway. So if you require the task of spellchecking a whole game at once, then this script will be handy, but it just needs to be playtested in a browser instead of the playtest wrapper (just open index.html in the game folder).

EDIT: This is a better plugin for spellchecking.


For the task of spellchecking as you go and not a whole game, I made an html utility for the useful tools forum for spellchecking, and that also helps you preview font, size, color, format, and line breaks too.


Relying on browser spellcheck is useful, because I don't have to get language libraries and stuff; you'll already have your own thing in that department. That being said, I'm incapable of making a script with language libraries and stuff anyway. This script is only 20 lines and it only creates an element and changes its innerHTML.
 
Last edited:

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top