How to Set Text Color In gameMessage.add Script

Joined
Nov 27, 2017
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMMV
Hi there!

I've started playing around with the scripting capabilities of MV and am stumped with trying to change the color of the text that I display when using
Code:
gameMessage.add("some text");
.

I know I'm probably overlooking something. Thanks in advance.
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,682
First Language
English
Primarily Uses
RMMZ
You're forgetting the $

Code:
$gameMessage
As for text color, the game message window uses "drawTextEx" to draw the text, meaning it will reset the font every time it is called, but it can read data inside the string and perform operations based on that. To change the text color, you need to use this inside the text (here's the format):

Code:
\C[n]
where n = the color.
 
Joined
Nov 27, 2017
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMMV
Ah, thank you so much! I was forgetting to escape the backslash for the change color command.
 

MusicalSamurai

Villager
Member
Joined
Nov 8, 2019
Messages
21
Reaction score
12
First Language
English
Primarily Uses
RMMV
Ah, thank you so much! I was forgetting to escape the backslash for the change color command.
Anything in Script - if it requires an apostrophe or a Backslash, it should be prefixed by another backslash (with the exception of forced Newlines)...
Such as:
Code:
$gameMessage.add('\\C[17]\\N[1]\\C[0]:\nI\'m Loving The Sunshine!.');
I'm not sure about you, but I'm also a big fan of having the character's name on the first line with their text underneath, and to mirror this programmatically I do the following:
Code:
$gameMessage.add('\\C[17]\\N[1]\\C[0]:\n' +
  'I\'m Loving The Sunshine!.'
);
It may appear messy at first, but if you consider the first line will never need to change, it may be easier to see at a glance what the context of your messagebox might be :)
 

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,860
Messages
1,017,038
Members
137,568
Latest member
invidious
Top