Forum

> > CS2D > Scripts > Scripting colors
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Scripting colors

11 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Scripting colors

Xirot
User Off Offline

Zitieren
I saw some comments in the filearchive/script. Asking in comments about how to set the colors in the luas.
Well , this site will help you.
For who don't know , how to use it.
Spoiler >

I hope that this will help you guys.

alt Re: Scripting colors

Assassin moder
User Off Offline

Zitieren
It's combination of three basic colors: Red, Green and Blue

RRRGGGBBB

minimum value is 0 (000) and maximum is 255.

alt Re: Scripting colors

Alistaire
User Off Offline

Zitieren
user Xirot hat geschrieben
user Alistaire: How the fuck? you're advicing peoples to get the photofiltre to know the script colors ? that's stupid.
> www.colorpicker.com exists.


You obviously can't read. I told them that you can find the RGB value for a color in a certain image with Photofiltre's colorpicker.

alt Re: Scripting colors

VaiN
User Off Offline

Zitieren
Since we're talking about scripting colors, here's how I prefer to set up colors in my Lua scripts.

Create a table called color. Create a variable to hold the copyright character (this prevents issues with file format like UTF-8/ANSI, so you can use whatever text editor you like without concern). Then concatenate the values, giving each color an entry in the table (without spaces in the color name). You can use the advice in posts above for getting the color values.

1
2
3
4
5
6
7
8
9
10
11
12
color = {}
color.code = string.char(169) -- copyright character code
color["black"] = color.code .. "000000000"
color["white"] = color.code .. "255255255"
color["red"] = color.code .. "255000000"
color["green"] = color.code .. "000128000"
color["blue"] = color.code .. "000000255"
color["yellow"] = color.code .. "255255000"
color["cyan"] = color.code .. "000255255"
color["orange"] = color.code .. "255165000"
color["purple"] = color.code .. "128000128"
color["pink"] = color.code .. "255192203"

Then you can easily reference the color using color.name or color["name"]
1
msg( color.red .. "Banhammah!" )

To take it a step further, I usually set variables to define colors for specific output such as chat output from the server.
1
2
3
color.server = color.cyan -- for public output
color.notification = color.green -- for private output
color.advertisement = color.orange -- for adverts

Then you don't have to change every msg() color if you decide to change colors in those cases. I usually keep this all in a separate file so it's easily shared for use in other scripts. Just my advice for keeping things simple.

I generated a table from all of the Microsoft.NET colors if anyone wants it (147 colors total).
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht