reveurduciel

Warper
Member
Joined
Dec 31, 2014
Messages
4
Reaction score
0
First Language
French
Primarily Uses
Hello.

I have a little Windows Base child that i use to write some text

class Window_Choix < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(624,0,400,300) contents.font.size = 16 hide end def updateText(text,clear=false) contents.clear if clear show for i in 0..text .length-1 contents.draw_text(0,16*i,600,16,text[1],0) end end endand i have this code elsewhere

@text.push("Blabla") @windowText.updateText(@text)It work fine.

My question is: since Windows Base have some color method

def process_escape_character(code, text, pos) case code.upcase when 'C' change_color(text_color(obtain_escape_param(text))) when 'I' process_draw_icon(obtain_escape_param(text), pos) when '{' make_font_bigger when '}' make_font_smaller end endhow can i color some of my text in blue ?

Some code like :

@text.push("Bla \C[5] bla")@windowText.updateText(@text)Thank you :D
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,812
Reaction score
890
First Language
German
Primarily Uses
RMMZ
The method "draw_text_ex" in Window_Base draws text while interpreting control characters.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,977
Reaction score
4,587
First Language
English
Primarily Uses
RMMZ
Be aware that if you're using a colour code in draw_text_ex, you need two backwards slashes and a capital C, or it won't work. So \\C[6] for yellow, for example.
 

reveurduciel

Warper
Member
Joined
Dec 31, 2014
Messages
4
Reaction score
0
First Language
French
Primarily Uses
Thank you very much, but when i change my script for this :

class Window_Choix < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(624,0,400,300) contents.font.size = 16 hide end def updateChoix(text,clear=false) contents.clear if clear show for i in 0..text .length-1 draw_icon(text[0],0, 16*i) draw_text_ex(0,16*i,600,16,text[1]) end end endi get a no method error for draw_text_ex :(
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,275
Reaction score
9,696
First Language
German
Primarily Uses
RMMV
draw_text_ex has different parameters compared to draw_text.

You need not only change the name, but also give the correct parameters for the function
 

Latest Threads

Latest Posts

Latest Profile Posts

Wish me luck. One of the leading experts on certain false shuffle is going to check if my skill is good enough to be called "not total trash".
Not an RPG Maker Update but I'm happy to say that I finally passed my drivers written test. Which makes me a happy guy.
FWRu-cYXkAAAUbl
Have you ever been in such a luck streak you felt fear something was wrong?
I'm going to be adding in combat animations, revamping the UI and putting in a new cutscene this week, so this is your last chance to play the MC:RIS demo in its original form! Say you were there since the beginning! https://qos.itch.io/infinite-sadness
I added reflections and shadows. Though one of the party seems to have no reflection, is floating, with glowing eyes. I'm sure it's fine.
p7O1sjG.png

Forum statistics

Threads
123,119
Messages
1,154,105
Members
161,446
Latest member
rozero
Top