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

Status
Not open for further replies.

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
355
Reaction score
329
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
735
Reaction score
459
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
355
Reaction score
329
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,656
Reaction score
5,170
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

Dama wrote on akoniti's profile.
Hi
Thanks for your review.
I was checking the trailer for details and as the woman shut the door at the exact moment the song I was hearing said "you slim the door" and I couldn't resist to add it there. :D And I used this idea one more time on another scene.
Just doing some tileset tinkering again...
rux
Someone please help me make my game.
I need someone to volunteer, I am on my knees man.
I made my own pizza. First critique, more chicken next time.

Forum statistics

Threads
104,690
Messages
1,008,147
Members
136,183
Latest member
brandini503
Top