Jump to content
AlexxanderX

WFz - Change text color

Recommended Posts

WFz - Texts Colors

Created by AlexxanderX

This is my first script maked when I tried to learn Ruby. Thanks Niclas for help in Ruby.

 

Features:

-change permanently text colors;

-easy to use;

-change close quickly text colors in events.

 

How to Use:

Copy the script and put it in your project.

 

Script:

 

#-------------------------------------------------------------------------------
# Change text color
# Created by AlexxanderX
# Version 1.2
#-------------------------------------------------------------------------------
# System
#-------------------------------------------------------------------------------
module WFz
 module Texts_Colors
#-------------------------------------------------------------------------------
# To change the color permmanent in your game simple
# change the number of color you want.
# ! Between brackets are original color values of texts.
# You can make changes of colors calling in a event a
# script like:
#				Text_color_number = 21
#-------------------------------------------------------------------------------
Text_color_number = 0 # Normal (0)
Hp_color_number = 20 # HP gauge 1 (20)
Hp2_color_number = 21 # HP gauge 2 (21)
Mp_color_number = 23 # HP gauge 1 (22)
Mp2_color_number = 22 # HP gauge 2 (23)
System_color_number = 16 # System (16)
Crisis_color_number = 17 # Crisis (17)
Knockout_color_number = 18 # Knock out (18)
Gauge_back_color_number = 25 # Gauge background (19)
Mp_cost_color_number = 23 # MP cost (23)
Power_up_color_number = 24 # Equipment power up (24)
Power_down_color_number = 25 # Equipment power down (25)
Tp_gauge_color1_number = 28 # TP gauge 1 (28)
Tp_gauge_color2_number = 29 # TP gauge 2 (29)
Tp_cost_color_number = 29 # TP cost (29)
#-------------------------------------------------------------------------------
# The colors are from the window skin image.( from 0 to 31)
#-------------------------------------------------------------------------------
 end
end

class Window_Base < Window
 include WFz::Texts_Colors
 def text_color(n)
#-------------------------------------------------------------------------------
# Down is the formula for getting the color:
#   n = the color number
#-------------------------------------------------------------------------------
windowskin.get_pixel(64 + (n % 8) * 8, 96 + (n / 8) * 8)
# Default: 64 + (n % 8) * 8, 96 + (n / 8) * 8
#-------------------------------------------------------------------------------
 end
#-------------------------------------------------------------------------------
# To change the key for changing color or the icon, or to make the fond bigger
# or smaller change: (e.g: for color text changing use \C[1]text )
#-------------------------------------------------------------------------------
Key_Color = 'C' # Default 'C'
Key_Icon = 'I' # Default 'I'
Key_Font_Bigger = '{' # Default '{'
Key_Font_Smaller = '}' # Default '}'
#-------------------------------------------------------------------------------
 def process_escape_character(code, text, pos)
case code.upcase
when Key_Color
  change_color(text_color(obtain_escape_param(text)))
when Key_Icon
  process_draw_icon(obtain_escape_param(text), pos)
when Key_Font_Bigger
  make_font_bigger
when Key_Font_Smaller
  make_font_smaller
end
 end
 def normal_color;
			text_color(Text_color_number)  
 end
 def system_color
			text_color(System_color_number)
 end
 def crisis_color
			text_color(Crisis_color_number)
 end
 def knockout_color
			text_color(Knockout_color_number)
 end
 def gauge_back_color
			text_color(Gauge_back_color_number)
 end
 def hp_gauge_color1
			text_color(Hp_color_number)
 end
 def hp_gauge_color2
			text_color(Hp2_color_number)
 end
 def mp_gauge_color1
			text_color(Mp_color_number)
 end
 def mp_gauge_color2
			text_color(Mp2_color_number)
 end
 def mp_cost_color
			text_color(Mp_cost_color_number)
 end
 def power_up_color
			text_color(Power_up_color_number)
 end
 def power_down_color
			text_color(Power_down_color_number)
 end
 def tp_gauge_color1
			text_color(Tp_gauge_color1_number)
 end
 def tp_gauge_color2
			text_color(Tp_gauge_color2_number)
 end
 def tp_cost_color
			text_color(Tp_cost_color_number)
 end
end

 

 

Updates

1.1 > 1.2 Implemented more features.

 

In the final I want help with my languages errors and I need the names of some colors. Thanks!

Edited by AlexxanderX

Share this post


Link to post
Share on other sites

Seems to be a nice little snippet but you have an error here in the code:

def tp_gauge_color1
    text_color(tp_gauge_color1_number)
 end

Should be changed to this:

def tp_gauge_color1
    text_color($tp_gauge_color1_number)
 end

Share this post


Link to post
Share on other sites

Seems to be a nice little snippet but you have an error here in the code:

def tp_gauge_color1
	text_color(tp_gauge_color1_number)
 end

Should be changed to this:

def tp_gauge_color1
	text_color($tp_gauge_color1_number)
 end

 

Thanks, again. :D

 

Now Version 1.1 !

Edited by AlexxanderX

Share this post


Link to post
Share on other sites

Hi! great script! could you make a similar script for change the color of the items? i think the hp recovery items green, mp recov items blue, weapons brown, etc etc,?

 

i've tried to use codes, but in the item enciclopedia the codes are visible in the item name field! :)

 

if this script is possible, it'll be more useful for me!!

 

Again, amazing script! god job! bye!

Share this post


Link to post
Share on other sites

How can I changed the text colour like, when you talk to a NPC?

 

That's a function already built in by default in every RPG Maker since at least 2000. If I'm not mistaken, it's done by putting \c[x] (x being a number from 1-32) before the part where you wish to change the color in a message.

Share this post


Link to post
Share on other sites

I think there's some kind of misunderstanding. The color is not determined by the number itself, the system picks it from the windowskin.png file.

 

EXAMPLE:

0 is the color of the first square in windowskin.png (which is white by default!)

 

So, to change the colors, you must simply edit windowskin.png file.

With your script, I can simply choose one of the 32 colors which come in the windowskin.png file.

With the recoloring method I can choose whatever color I need!

Share this post


Link to post
Share on other sites

I don' t know what you say( my english is not very good how you saw).

It's easy to understand your english. It's my english that is not user-friendly! ^_^

You added as new feature the chance to change:

 

 

class Window_Base < Window
 include WFz::Texts_Colors
 def text_color(n)
#-------------------------------------------------------------------------------
# Down is the formula for getting the color:
#   n = the color number
#-------------------------------------------------------------------------------
	windowskin.get_pixel(64 + (n % 8) * 8, 96 + (n / 8) * 8)
	# Default: 64 + (n % 8) * 8, 96 + (n / 8) * 8
#-------------------------------------------------------------------------------
 end

 

 

 

But you should explain how this method works, how it can be modified, and what you can get by modifying it.

 

PS: Where are you from?

Edited by Ginolamantino

Share this post


Link to post
Share on other sites

Yea, need to explain more that part.

 

I'm from Romania ...

It's just 'cause common users won't know what to do with that part.

 

Nope. If so, then english is the only mean of communication :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted