Question about IDs
#1

Okay I don't know much about it, but I wanted to know about something that has to do with IDs.
Bare with me here.

With unique IDs it's simple counting:
A = 1
B = 2
C = 3
D = 4
F = 5
G = 6

But if I wanted to combine ID's, I'd do:
A = 1
B = 2
C = 4
D = 8
E = 16
F = 32
G = 64
... etc.

And now I can A + B = 3. 3 will be A and B.

This is useful for such systems like a item system, that saves into a database.

new PlayerItem = 7; // Player has Item A, Item B, and Item C.

But my problem is, how do I check if player has Item B if PlayerItem is set to 7?
Reply


Messages In This Thread
Question about IDs - by Kreatyve - 09.09.2013, 22:28
Re: Question about IDs - by Pottus - 09.09.2013, 22:38
Re: Question about IDs - by Kreatyve - 09.09.2013, 22:39
Re: Question about IDs - by Pottus - 09.09.2013, 22:41
Re: Question about IDs - by Kreatyve - 09.09.2013, 22:48
Re: Question about IDs - by Vince - 10.09.2013, 00:00
Re: Question about IDs - by Kreatyve - 10.09.2013, 02:51

Forum Jump:


Users browsing this thread: 2 Guest(s)