ID:273377
 
You know how you can declare variables in oct, and hex?

var/dec = 20
var/oct = 024
var/hex = 0x14

Well, I was just curious, is there a way you can declare them in binary form? This would make it slightly easier for making bitwise type stuff.
That's not declaring the variables as anything, it's simply interpreting the constant value differently: 024 means 24 octal and 0x14 means 14 hexidecimal. The variables store the same thing regardless.

For bitwise type stuff, there really shouldn't be a need for this. Each bit should have its own constant and you can just | constants together. Like mob/sight (SEE_SELF|SEE_TURFS) or dir (NORTH|EAST == NORTHEAST).

So, you'd want to do:

#define BLAHFLAG 1
#define BUHFLAG 2
#define BEHFLAG 4
//etc.

x = BLAHFLAG | BEHFLAG
In response to Garthor
I meant like...

#define FLAG bin-1
#define FLAG2 bin-10


It just made me curious if you could give the variables a value in dec, oct, hex, and bin.

EDIT: Useless, but I just wanted to know more.
In response to Ranch Jolly
If you really, really need to, you can use the << bit-shift operator. Though, you'd want to use a constant variable rather than a #define in that case. So, 1 in binary becomes 1 << 0, 10 becomes 1 << 1, 100 becomes 1 << 2, and so on.
In response to Garthor
Garthor wrote:
If you really, really need to, you can use the << bit-shift operator. Though, you'd want to use a constant variable rather than a #define in that case. So, 1 in binary becomes 1 << 0, 10 becomes 1 << 1, 100 becomes 1 << 2, and so on.

I didn't think of that, thank you very much.