Forum

> > CS2D > Scripts > Colour failure
Forums overviewCS2D overview Scripts overviewLog in to reply

English Colour failure

4 replies
To the start Previous 1 Next To the start

old Colour failure

Talented Doge
User Off Offline

Quote
I tried to search but nothing has met my problem.

My problem is simple, I tried using command to set my say colour. With a integer at the start of colour code, everything is perfect, but with a 0, the colour is different. I don't know why, but once I set the colour, the "new colour set" text is fine, while when I speak, the say colour is completely different from the "new colour set" text. I don't know what's wrong with it...

old Re: Colour failure

Rainoth
Moderator Off Offline

Quote
Not sure what you're trying to say.
You set your color to be 000000000 and it's a different color?

old Re: Colour failure

VADemon
User Off Offline

Quote
I don't see any code posted to help you with.
In general: Don't save color codes as numbers, because the zeros in front will get lost when saving as integer.
Is there possibly another script installed which modifies chat color?

old Re: Colour failure

_oops
User Off Offline

Quote
If you using 3 individuales for rgb then try this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
if color_red <100 then
color_red = "0"..color_red
end
if color_red<10 then
color_red="00"..color_red
end
if color_green < 100 then
color_green = "0"..color_green
ens
if color_green<10 then
color_green = "00"..color_green
end
if color_blue < 100 then
color_blue = "0"..color_blue
end
if color_blue < 10 then
color_blue="00"..color_blue
end

..or if you used one variable for color ( such as !setcolor 000000000 )
1
2
3
4
5
6
7
8
9
if #color_rgb == 8 then
color_rgb = "0"..color_rgb
end
if #color_rgb == 7 then
color_rgb="00"..color_rgb
end
if #color_rgb <= 6 then
color_rgb="000"..color_rgb
end

I didn't test because I'm using mobile to write this.

old Re: Colour failure

Talented Doge
User Off Offline

Quote
The error was caused by the misuse of file:read() function. I've fixed it. Thanks a lot oops321.
edited 1×, last 24.04.15 05:38:55 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview