• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

RGB colors

Grandelf

Esteemed Member
General information
I decided to do a small release that may not be of any use to you at all.
However if you're interested in this type of thing or use a lot of colors in your scripts
this might be useful to you.
So why have RGB colors when we can already use hexadecimal codes?
Absolutely no reason, I just had this idea in my head for a while and wanted
to do something different aswell as freshing some things up.
It may actually be a little easier to use colors and memorize them with this script,
especially if you have no idea what a hexadecimal number is.

So what does this do?
This is a script that will allow you to use RGB colors. You basically call a function and
it will convert it into a usable color code for you.

How does it work?
For those of you who don't really know what RGB is, you can either look it up on google
or read my explanation. RGB basically stands for R (red), B (blue) and G (green).
With those three colors you can mix around and create 16777216 colors to be exact.
For each color type you use a number between 0 and 255. The number depends on
how intense you want the color to be.

AdditiveColor.svg


Some examples:

Red:
Code:
255, 0, 0
We are using the highest intensity on the first argument (red), the other two are 0
which means they are not used at all.

Dark(er) red:
Code:
150, 0, 0
Here we are using a lower intensity on red then before and the other two are 0 again.
Because the intensity is lower the color we get will be darker.

Green:
Code:
0, 255, 0
Here we are only using the 2nd one (green) on the highest intensity

Purple:
Code:
255, 0, 255
Here we mix up red with blue which makes purple (see picture above).

More examples: RGB colors

How to use this script?

Simply put it in your scripts folder. Then use the global function to get a color code.
Code:
local red = RGB(255, 0, 0);
So to send a red message to a player you could do:
Code:
function sendRedMessage(player)
        local red = RGB(255, 0, 0);
        player:SendBroadcastMessage(red .. "This message will be red");
end

Script: http://pastebin.com/b4TFN7Ti

Grandelf.
 

Kaev

Super Moderator
Awesome release! A version for C++ scripts would be nice for those, who doesn't use Eluna.
 
Top