SA-MP Forums Archive
Colors simplier to read - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Colors simplier to read (/showthread.php?tid=337926)



Colors simplier to read - Padarom - 28.04.2012

Hello everybody.
Usually a color is defined in that way:
pawn Код:
#define COLOR_RED 0xFF006600
This way the hex-code isn't that clear to read (FF0066). So I wanted to make it a little bit clearer:
pawn Код:
#define c(%1) 0x%100
#define COLOR_RED c(FF0066)
But now the color is black everytime. In my opinion it is because the code cuts the 0 (from the 0x in front). But I don't really know why. Is there a way to do this more easily or at least without the bug?

And yeah, I know it's pretty senseless, no need to mention that :P

Thanks in advance.
Padarom


Re: Colors simplier to read - .FuneraL. - 28.04.2012

Define the color :

pawn Код:
#define COLOR_RED 0xFF006600
And Use in this function , only a example:

pawn Код:
SendClientMessage(playerid, COLOR_RED, "Message");
This is more easily.


AW: Colors simplier to read - Padarom - 28.04.2012

Ermm - Yeah, that's the way I mentioned first. But I want to make the hex code easier to read. Even if it's increasing the line numbers (1 more line), the color would be easier to define or change - Due to the clear hex.

Just ignore if you think this is useless, but I still would love to have a solution for that.


Re: Colors simplier to read - Niko_boy - 28.04.2012

#define c(%1) 0x%100
#define COLOR_RED c(FF0066)
hmm why u did 100 isnt it supposed to be 00 ?


Re: Colors simplier to read - 2KY - 28.04.2012

Quote:
Originally Posted by Niko_boy
Посмотреть сообщение
#define c(%1) 0x%100
#define COLOR_RED c(FF0066)
hmm why u did 100 isnt it supposed to be 00 ?
The macro is using %1. 0x %1 00 is what he actually has.


Re: Colors simplier to read - Niko_boy - 28.04.2012

ahhah yeah
didnt thought of that but the macro doesnt become 100 if he type like that loL?
%100 instead of %1 00
I guesss no ?


AW: Colors simplier to read - Padarom - 28.04.2012

Well if I would use %1 00 (instead of %100) I would get errors when using the color:
pawn Код:
error 001: expected token: ",", but found "-integer value-"
warning 215: expression has no effect
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line



Re: Colors simplier to read - MP2 - 28.04.2012

http://www.colorpicker.com/


Re: Colors simplier to read - Niko_boy - 28.04.2012

can u use like
#define AlPha 00
#define c(%1) 0x%1AlPha
#define COLOR_RED c(FF0066)
NO ?
i am doing it wrong anyways :P?


AW: Colors simplier to read - Padarom - 28.04.2012

Yeah MP2, that's the website I get my colors from. And why did you post it?
It doesn't have anything to do with my matter.

@Niko: Nope, it doesn't recognize the Alpha as a defined number (undefined symbol "xD10054Alpha")