[Release]Says Colored by BlackYuko

09/01/2012 13:51 crusa2#1
Hi guys ! In this post , I'm going to show you how can type with all colors in your scripts/quests .

1. Paste this code in questlib.lua

Code:
--**
--** Functions colored says
--** by BlackYuko
--**

function say_color(color, text)
    local rgb = rawget(colors_data, color)
    say(color256(rgb[1],rgb[2],rgb[3])..text..color256(colors_data.default[1], colors_data.default[2], colors_data.default[3]))
end

function set_text_color(color)
    local rgb = rawget(colors_data, color)
    raw_script(color256(rgb[1],rgb[2],rgb[3]))
end

colors_data =     {
                ['green'] = {0,190,0},
                ['light green'] = {0,255,0},
                ['dark green'] = {0,110,0},
                ['semi light green'] = {144,238,144},
                ['teal'] = {102,205,170},
                ['red'] = {240,0,0},
                ['semi light red'] = {255,69,51},
                ['rose'] = {255,64,160},
                ['dark rose'] = {255,0,128},
                ['light rose'] = {255,182,193},
                ['light orange'] = {255,127,80},
                ['orange'] = {255,130,0},    
                ['dark orange'] = {255,90,0},                
                ['semi dark violet'] = {255,0,255},    
                ['violet'] = {224,129,255},
                ['dark violet'] = {148,0,148},
                ['light violet'] = {200,162,200},
                ['brown'] = {161,63,0},
                ['dark brown'] = {120,66,0},
                ['light brown'] = {200,164,115},
                ['yellow'] = {255,255,53},
                ['light yellow'] = {255,255,128}, 
                ['gold'] = {255,191,24},
                ['blue'] = {0,0,250},
                ['dark blue'] = {0,0,150},
                ['cyan'] = {128,255,255},
                ['light cyan'] = {180,255,255},
                ['turquoise'] = {0,255,255},
                ['white'] = {255,255,225},
                ['gray'] = {128,128,128},
                ['black'] = {0,0,0},
                ['default'] = {196,196,196}
                }
2. Add these functions in file quest_functions :

Code:
say_color
set_text_color
These are the color that I put yet , naturally you can add more colors :

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

If you want to add more colors , add in the vector "colors_data" .

How to use it :

In whichever quest , when you type a colored string , use function "say_color" .

Code:
say_color("name_color" , "text")
Example :

Code:
say_color("yellow", "This string is yellow")
say_color("red", "This string is red")
say_color("blue", "This string is blue")
say_color("light yellow", "This string is light yellow")
say_color("light red", "This string is light red")
say_color("teal", "This string is teal")
say_color("default", "This string is normal")

Result :

[Only registered and activated users can see links. Click Here To Register...]

Well , you can see that color "standard" of text is called "default"

Secondary function :

If I want type more strings with the same color without type in every string ? Simple , you can setup the color of text with the function "set_text_color" , and next all says will be the color selected .

Example :
Code:
set_text_color("red")
say("Now it will type ever red")
say("Now it will type ever red")
say("Now it will type ever red")
say("Now it will type ever red")
set_text_color("yellow")
say("Now it will type ever yellow")
say("Now it will type ever yellow")
say("Now it will type ever yellow")
say("Now it will type ever yellow")
set_text_color("cyan")
say("Now it will type ever cyan")
say("Now it will type ever cyan")
say("Now it will type ever cyan")
say("Now it will type ever cyan")   
set_text_color("default")
say("Now it will type again normal")
Result :

[Only registered and activated users can see links. Click Here To Register...]

Credits & Thanks : BlackYuko
Release & scripts translated by crusa2
----------------------------------------
Best regards ,
crusa2

----------------------------------------
09/01/2012 13:59 Teh Plex#2
Nice
09/01/2012 14:06 Nick#3
It's very helpful for warnings in some quests and it's useful for me. I think, i'll apply that. ;)
09/01/2012 14:11 crusa2#4
Thanks guys , I remind you that you thank BlackYuko for these functions ;)
09/01/2012 14:45 xF4ke :þ#5
looks good, thanks for sharing :)
09/01/2012 14:49 vıo#6
i'll use it :D
09/01/2012 15:00 √π.#7
Mijago already scripted an similarly version in his questlib add-on ([Only registered and activated users can see links. Click Here To Register...])
Begins in line 648
09/01/2012 18:37 blackyuko#8
Quote:
Originally Posted by √π. View Post
Mijago already scripted an similarly version in his questlib add-on ([Only registered and activated users can see links. Click Here To Register...])
Begins in line 648
I answer because it's always my stuff. These were two very small functions that I wrote for the italian community a couple of months ago. Crusa2 posted it here but he couldn't know that someone has already done something similar. So, never mind, there will be two similar functions for colored "say" :)
09/01/2012 18:52 Mijago#9
Originally 3 ..
There is this function, then the say_red, say_blue etc and at last mine, with that you can combine colors.. and there are nearby 280 colors you can use with mine :D

lg Mijago
09/01/2012 20:35 D~CoAsT#10
VERY nice (:
09/02/2012 08:14 Nick#11
[Only registered and activated users can see links. Click Here To Register...]

Existiert wie man sieht, schon mehrmals.
09/02/2012 13:54 crusa2#12
Quote:
Originally Posted by .JayZoN View Post
[Only registered and activated users can see links. Click Here To Register...]

Existiert wie man sieht, schon mehrmals.
If you read which said BlackYuko , there are many ways to write says colored .
06/30/2013 14:36 wvoron#13
Thank