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,591
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,278
Reaction score
9,702
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

Update on the Unity thing: I had to redo all my map graphics for Unity because the originals were from XP, but it actually looks so much better now in Unity, so I genuinely might make the switch.
Messing around with fragment shaders (filters). This thing is HUGE and I'm surprised almost no one makes good use of. Even the number of plugins that do this stuff are limited.
ScreenShot_6_28_2022_3_2_40.png

There's 7 main areas in the game that are all connected. This train get's you from an underground lab to the center of someone's subconscious. inside the train you can talk to some of the passengers. but going to the top of it, there's battles.
Speedrunning all character portraits just so they all have the same quality. Not sure if this was a good idea, but now I'm almost done.
We now have a gameplay video!

Forum statistics

Threads
123,154
Messages
1,154,457
Members
161,503
Latest member
Asinthew
Top