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,652
Reaction score
5,169
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 made my own pizza. First critique, more chicken next time.
My pumpkin! Anyone like Fallout?

It's not terrible, but could be better. This thing took me over an hour to carve. :kaophew:

Dad's watching a WWII documentary while I work on some cool assets for my games. I just love RPG Maker!
Also Happy Halloween! Dad's friend won't be coming unfortunately, but Dad will still be taking me to Boxi Park to have some fun tonight! I'll be posting a video on my YouTube channel of the show, and I'll be sure to post a link here.
"Nightmares exist outside of logic and there's little fun to be had in explanations. They're antithetical to the poetry of fear. In a horror story the victim keeps asking why, but there can be no explanation and there shouldn't be one..." - Stephen King
I feel people seek explanation and demand it sometimes in games, but in the horror genre, well, maybe you shouldn't have one. Silent Hill 1 comes to mind...
Managed to implement QSprite.

Always double check your plugin order.

Forum statistics

Threads
104,686
Messages
1,008,105
Members
136,177
Latest member
SGXNinetyNine
Top