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

Status
Not open for further replies.

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
349
Reaction score
323
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
349
Reaction score
323
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,610
Reaction score
5,153
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

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.

I'm a bit conflicted. One the one hand, it's quite visually cool to make bodies of water that the player can interact with by going into it. However obscuring the player character from a gameplay perspective is pretty bad. Hmm... There's the option to make the area around the player visible, but then that kind of defeats the purpose of submerging them. :unsure:
Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
Another two plugins done! One being an on map grid inventory.
busy with my newborn child, can't even touch pc at all ;_;

Forum statistics

Threads
104,298
Messages
1,005,353
Members
135,812
Latest member
Yagyu_Chan
Top