RMMZ [solved] How to color Text Segment in a Window?

Status
Not open for further replies.

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
350
Reaction score
324
First Language
german
Primarily Uses
RMMZ
Hey all, so I need some help from the RMMZ UI experts :p

So I have a custom Window, nothing special, it just inherits from Window_Base. The Game Dev can setup a message eg. "Go to the \C[2]Dark Forest\C[0]!"

What is the best approach to make the Text Segment "Dark Forest" being colored in its respective color?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
708
Reaction score
435
First Language
English
Primarily Uses
RMMV
If you call drawTextEx(text, x, y, width, alignment) it will perform all of the text escape codes available to the message box, including showing icons and changing colors. Use that function instead of the more simple drawText function that most other windows use.
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
350
Reaction score
324
First Language
german
Primarily Uses
RMMZ
Wow, that was easy!

If someone encounters this thread and has problems, it could be because the Maker sometimes escapes the text codes eg. from "\C" to "\\C". This line is a simple fix:

JavaScript:
text = text.split("\\\\").join("\\");
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,613
Reaction score
5,154
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Is there anyone need help with anything except art and music?
is Gotcha Gotcha Games Inc. = KADOKAWA CORPORATION? I haven't found this topic yet, Want to know for credits on my game. Thanks.
If you get everything you want, when you want it, it kills your creativity. If you never get anything you want, you're forced to be creative with what you have.
Old chiptune loops free for use.
I think I've got my hero designs pretty much finialised ( still got some tweaks. ) In the end it'll be the four outfit colour variants with four different skintones.

Forum statistics

Threads
104,299
Messages
1,005,377
Members
135,818
Latest member
Hennet91
Top