Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // AutoColor.js
- //=============================================================================
- /*:
- * @plugindesc Auto colors key names that you define.
- * @author Jeremy Cannady
- *
- *
- * @help This script does not have any parameters to define you must go into
- the script and make your own list of key names and colors.
- My profile:http://forums.rpgmakerweb.com/index.php?/user/72458-jeremy-cannady/
- Please message for questions.
- *
- *
- */
- (function(){
- //This where we define what our key names will be and their color
- var lTBC = {
- //The name is case sensitive, please follow the format correctly
- //the commas after each entry is required
- // 'entry':15,
- // 'entry2':20,
- 'pine':3,
- 'apple':10
- };
- //Please don't touch below this as your game will explode.
- Window_Base.prototype.convertEscapeCharacters = function(text) {
- //Begin
- //Go through the text and see if we have a match to our list
- Object.keys(lTBC).forEach(function (key){
- //Define a new RegExp to detect our list
- var replacee = new RegExp('\\b' + key + '\\b', 'g');
- //Define what we want to replace it with
- var replacer = '\\c'+'['+lTBC[key]+']' + key + '\\c' +'['+0+']';
- //Replace the text
- text = text.replace(replacee,replacer);
- });
- //End
- text = text.replace(/\\/g, '\x1b');
- text = text.replace(/\x1b\x1b/g, '\\');
- text = text.replace(/\x1bV\[(\d+)\]/gi, function() {
- return $gameVariables.value(parseInt(arguments[1]));
- }.bind(this));
- text = text.replace(/\x1bV\[(\d+)\]/gi, function() {
- return $gameVariables.value(parseInt(arguments[1]));
- }.bind(this));
- text = text.replace(/\x1bN\[(\d+)\]/gi, function() {
- return this.actorName(parseInt(arguments[1]));
- }.bind(this));
- text = text.replace(/\x1bP\[(\d+)\]/gi, function() {
- return this.partyMemberName(parseInt(arguments[1]));
- }.bind(this));
- text = text.replace(/\x1bG/gi, TextManager.currencyUnit);
- return text;
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment