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,592
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,311
Reaction score
9,705
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 Profile Posts

Work on UD is already so delayed but I gotta drop everything so that I have something ready for IGMC!
Messed up the chains... :kaoback:
Sw7U8dA.jpg

Character: Jeanne D'Arc from Fate/Apocrypha.
Neptrone wrote on Andar's profile.
Hello Andar, i just saw you created a lot of helpful thread in the past regarding RPG, genre, game design, etc, etc.

Do you have full collection or list about every useful thread that you made in the past ? I think it would be very useful for me.


Thanks :)
I-G-M-C, I-G-M-C!
To be honest, I had no idea what this was until now haha. But it looks fun, so my main game is on hold for a month while I participate! :yhappy:
Going live for tonight's Rise of the Third Power! Twitch

Forum statistics

Threads
123,246
Messages
1,155,216
Members
161,635
Latest member
qixxi
Top