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

Status
Not open for further replies.

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
352
Reaction score
325
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
717
Reaction score
445
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
352
Reaction score
325
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,633
Reaction score
5,163
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 Profile Posts

Where do i have to play Heisei Pistol Show the same creator that made Re: Kinder Parun
I really get the feeling I should be doing regular YouTube videos whenever I make something cool in my game, instead of waiting for massive changes. But not going to lie... I always feel like it's never quite enough to merit an update, until it's a drastic change. :kaoswt:
Going to submit to this game jam...struggling with the time crunch...
Have to keep compromising...
Just released a new OST for my game and a new place to purchase it!

Ah, things to do when you finish a game.
Ami
Me: It's dark cloudy! I hope it's Rain…
(2-3 Hours Later,Changed To Sunny)
Me: :kaolivid:

Forum statistics

Threads
104,540
Messages
1,007,018
Members
136,034
Latest member
WhatisGachi
Top