#define color with 0x prefix - 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: #define color with 0x prefix (
/showthread.php?tid=574195)
#define color with 0x prefix -
IllidanS4 - 14.05.2015
Is it possible to create a #define using another define adding the "0x" prefix?
pawn Code:
#define INLINE_RED FF0000
#define COLOR_RED 0xINLINE_REDFF //would result in 0xFF0000FF
Re: #define color with 0x prefix -
JaydenJason - 14.05.2015
nope sir
Re: #define color with 0x prefix -
Misiur - 14.05.2015
Just to be precise: it isn't because nesting macros doesn't work, it's just because there isn't a kind of "stop" character before your new macro:
pawn Code:
#define RED FF0000
#define OTHER_RED 0x|RED
//OTHER_RED => 0x|FF0000
Re: #define color with 0x prefix -
IllidanS4 - 30.05.2015
Found a workaround:
pawn Code:
#define RED[%0,%1] %0FF0000%1
#define INLINE[%0] "{"#%0[,]"}"
#define COLOR[%0] %0[0x,FF]
//INLINE[RED] = "{FF0000}"
//COLOR[RED] = 0xFF0000FF