AlexxanderX 1 Posted April 5, 2012 (edited) 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 April 21, 2012 by AlexxanderX Share this post Link to post Share on other sites
Nicke 151 Posted April 5, 2012 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 1 Share this post Link to post Share on other sites
Wyrelade 15 Posted April 5, 2012 Looks pretty good.. Thinking, If I might use it... Thanks Share this post Link to post Share on other sites
AlexxanderX 1 Posted April 5, 2012 (edited) 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. Now Version 1.1 ! Edited April 5, 2012 by AlexxanderX Share this post Link to post Share on other sites
thedybre 1 Posted April 8, 2012 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
AlexxanderX 1 Posted April 8, 2012 I will see if I can( because is possible), but I'm newbie in scripting and thanks. Share this post Link to post Share on other sites
Jake171 3 Posted April 10, 2012 (edited) Great idea, I am using this right now with the automatic name script, THANKYOU SO MUCH Edited April 10, 2012 by Jake171 Share this post Link to post Share on other sites
Patrick S. 10 Posted April 10, 2012 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
AlexxanderX 1 Posted April 12, 2012 Yes, I will need to update the script, but I'm very busy those days. Share this post Link to post Share on other sites
Cidiomar 39 Posted April 16, 2012 Please use constants instead of global variables. Ace already use too many. Share this post Link to post Share on other sites
Ginolamantino 6 Posted April 19, 2012 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
AlexxanderX 1 Posted April 19, 2012 Yes, I know this! But exist and a formula to get tot that color. Share this post Link to post Share on other sites
AlexxanderX 1 Posted April 21, 2012 Version 1.2 Released Share this post Link to post Share on other sites
Ginolamantino 6 Posted April 21, 2012 Version 1.2 Released I think you should explain what use can be made out of windowskin.get_pixel redefinition. Share this post Link to post Share on other sites
AlexxanderX 1 Posted April 21, 2012 I don' t know what you say( my english is not very good how you saw). Share this post Link to post Share on other sites
Ginolamantino 6 Posted April 21, 2012 (edited) 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 April 21, 2012 by Ginolamantino Share this post Link to post Share on other sites
AlexxanderX 1 Posted April 21, 2012 (edited) Yea, need to explain more that part. I'm from Romania ... Edited April 21, 2012 by AlexxanderX Share this post Link to post Share on other sites
Ginolamantino 6 Posted April 21, 2012 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 Share this post Link to post Share on other sites