RMMZ Visustella MZ Message Core Text Auto-color Priority

WillS787

Villager
Member
Joined
Jan 23, 2022
Messages
9
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Hello,
I'm using Visustella's Message Core with text Auto-Color, and I'm having an issue with (I think) the priority of the different text categories.

Here is the basic problem:

Actor names are auto-colored yellow. Item names are auto-colored red.

So let's say I have an actor named 'Reid' and an item named 'Reid's Sandwich'.

The resulting output for 'Reid's Sandwich' has the 'Reid' portion in yellow, and the ''s Sandwich' portion in red.

The desired output is for 'Reid's Sandwich' to be all red.

You can imagine the same issue happening for other situations, like a location called 'Reid's House', or a skill named 'Reid's Fury'.

It seems the actor name auto-color is higher priority than the other categories, but is there any way to change this? Or any other workaround without resorting to manual text codes?

Thanks in Advance!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,969
Reaction score
4,550
First Language
English
Primarily Uses
RMMZ
This is mentioned in the help:

2. Database names and keywords are exact size (for Roman languages)
This means if "Potion" is a marked keyword, typing out "potions" will not
prompt the auto-color to highlight "potions". You must type out all of
the variations of the words you want affected into the keyword list to
prompt the auto-color highlight.

This does not apply to Japanese, Korean, or Chinese languages.

3. Possessive cases and other language symbols aren't counted.
Symbols such as periods, commas, quotes, parentheses, and similar symbols
do no count towards Rule 2. This means if "Potion" is a marked keyword,
the typing out "(Potion)" will still highlight the "Potion" part of the
word according to the auto-color.

I'm sure there's a way around it but I'm not sure offhand what that is.
 

GmOcean

Veteran
Veteran
Joined
Nov 29, 2020
Messages
111
Reaction score
91
First Language
English
Primarily Uses
RMMZ
There is a work around using the same plugin (VisuStella's Message Core). Just requires a 'tiny' bit of work. But I took care of the hard part.

First you need to go to your Message Core plugin and make some additions. The image below will show where in the plugin to to change.
Message Core -> Text Code Replacements -> Add a new Entry -> Replace 'Key' with a word of your choice -> Change the Type to 'String' -> Use the JavaScript Code option (I'll provide this below).
Screenshot 2022-01-22 153305.png

const rawText = arguments[1]; const textColor = 1; // Color is the same as Auto-Color text Number let coloredText = ''; for (let i = 0; i < rawText.length; i++) { coloredText += "\x1bC["+textColor+"]"+rawText.charAt(i); } return coloredText;

Once you've done that, go to your text box (the one where you're trying to have the colors display correctly) and do like this picture shows:Screenshot 2022-01-22 153925.png
Here I used \ActorsPossession<TextHere>, but if you named it something else that is what you would type.

Edit: The downside is that the text will 'always' display at the color stated in the JS code (I tried to make that easy for you find and change. The upside is, you can just make more copies of this and change the color and use them accordingly for your uses. If there is a different solution to this issue, I don't know it. :(
 

WillS787

Villager
Member
Joined
Jan 23, 2022
Messages
9
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Thank you for the quick reply!
The Text Code Replacement works great.
Couple things I noticed when using this workaround:
1. You can't name the key anything that begins with 'G', because the \G turns into your currency :) (I was trying to make one called GreenText...)
2. You can't use \ActorsPossession<\ItemName[1]>, you have to write out the item's name. I prefer to use the \ItemName[] text code in case I change any names in the database, but I'll make due for these specific situations.

Thanks again!
 

GmOcean

Veteran
Veteran
Joined
Nov 29, 2020
Messages
111
Reaction score
91
First Language
English
Primarily Uses
RMMZ
There is 'another' work around for those things. Umm, I'll get back to you on that one lol.
 

WillS787

Villager
Member
Joined
Jan 23, 2022
Messages
9
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Sorry one more thing, it seems to be changing all the subsequent text in the message window and not just the text inside the <>. Is there something we can tweak to fix that? For now, I can just do \ActorsPossession<Reid's Short Sword>\C[0].
Thanks for the help!
 

GmOcean

Veteran
Veteran
Joined
Nov 29, 2020
Messages
111
Reaction score
91
First Language
English
Primarily Uses
RMMZ
Yeah, I can get that to work easily enough. Just taking my time, because dinner. The tummy is rummbly. :kaodes:

Edit: Okay that took longer than expected. But this should do the trick:
JavaScript:
let rawText = arguments[1];
let itemName = "";
let coloredText = "";
// Checks to see if a Variable Number is passed through
if (Number(rawText)) {
    rawText = $gameVariables.value(rawText);
}

// Create an Array containing [Text/ID]|[color#]
rawText = rawText.split("|");

// Check to see if an item Number was passed through, or raw text
let database;
if (Number(rawText[0])) {
    if (rawText[2] !== "" || rawText[2] !== "undefined") {
        switch (rawText[2]) {
            case "item":
                database = $dataItems;
                break;
            case "weapon":
                database = $dataWeapons;
                break;
            case "armor":
                database = $dataArmors;
                break;
        }
    }
    //Defaults to Items if none specified.
    const id = parseInt(rawText[0]);
    const icon = false;
    itemName = this.databaseObjectName(database, id, icon);
    itemName = [...itemName];
    let i = 0;
    while (i <5) {
        itemName.shift();
        i++;
    }
    itemName.length = (itemName.length - 12);
    rawText[0] = itemName.join("");
}

for (let i = 0; i < rawText[0].length; i++) {
    coloredText += "\x1bC["+rawText[1]+"]"+rawText[0].charAt(i);
}
coloredText +="\x1bC[0]"
return coloredText;

Here's how it will work.
For the most part, everything is the same, you type the command \CommandName<>
the difference is now I added the option to pass specific information through. And here's how:
\CommandName<Text|color>
OR
\CommandName<VariableNumber>
OR
\CommandName<ItemID#|color|itemType>


Here's an example of option 1:
\CommandName<Wooden Staff|1> Returns: Wooden Staff in color # 1

Here's an example of option 2 using Variables.
first you need to pass the information through a variable to do that choose the SCRIPT option.Screenshot 2022-01-23 152504.png Notice the " " those are needed.
\CommandName<99> This will tell the code that the information is in variable #99.


The last example is:
\CommandName<1|4|weapon> this is saying you want the weapon name of ID#1 in color#4
<0|0|weapon> <0|0|armor> <0|0|item>
those are the acceptable item types. *Note - the item type needs to be in lowercase*

In all cases, the color should revert back to the default text color of \C[0]
 

Attachments

  • Screenshot 2022-01-23 152235.png
    Screenshot 2022-01-23 152235.png
    40.9 KB · Views: 0
Last edited:

WillS787

Villager
Member
Joined
Jan 23, 2022
Messages
9
Reaction score
2
First Language
English
Primarily Uses
RMMZ
Amazing! This is seriously above and beyond, super useful, thank you!!
 

GmOcean

Veteran
Veteran
Joined
Nov 29, 2020
Messages
111
Reaction score
91
First Language
English
Primarily Uses
RMMZ
You're welcome. And yeah, I made it a bit more than needed because I figured I could use it myself down the line if I wanted to.
 

Latest Threads

Latest Profile Posts

one of the coolest things I've learned from the forums is the ability to give yourself a hitbox. I have a move you can do on the fields. shoulder tackle. thanks to the forums, that tackle triggers self A switches on some events. NPC's and the environment now react to the tackle. awesome.
I really liked how this one turned out! :kaopride:
WYqMPf6.png

Character (Yes, this is a character): Nibiru the Primal Being from Yugioh.
Dragon Quest style enemy selection plugin work in progress:

Quest_Targeting.png

It's a simple targeting system from the NES era. Select an enemy group; single-target skills will target the first enemy in that group.

Quest-Targeting-Animated.gif
Somehow that granny topic got me... maybe I can come up with some more thematic stuff :3
Going live for tonight's stream! Kytt isn't feeling 100% tonight so the wifestream will be tomorrow and I'll be playing Final Fantasy XIV for this one instead. Twitch

Forum statistics

Threads
121,935
Messages
1,145,269
Members
160,207
Latest member
RiceKun
Top