Is there some way to emulate bitflags with GS1?

Or having something act similar?

I have a problem where I queue “message” commands, I don’t want to use lke 5 variables when I know I should be able to have that info kept with a bitflag.

For now I’ll use a string list, I realize they’ll do a better job on this case. But still, I’d use that bitflag thing like everywhere if I could; does someone have the solution?

can’t you use flags?

set flag1,flag2,flag3,flag4; etc

Bitflags are different.

say 4 flags
they are equivalent to
1,10,100 and 1000 in binary = (1,4,8,16 in decimal)

If say I want the 2nd and 4th flags to be on, I make my variable equal to both added togheter -> 20 in decimal and 1010 in binary.

The absence of it makes some things way more complicated than they should… it’s a “nice to have”. I also want to experiment it, haven’t really used them yet.

Just use a single quest array… Store information as such. client.questarray = questname,eventstage,…,…,Chicken Fucker,4; and append it as needed. It’s honestly not all that complicated and, if I’m understanding you correctly, works just as you need it to.

Edit: The only issue I see with this is the fact that there is a character limit of 256. So, to get around that, I’d break the string up into sections of two and have a this.variable that contains what indexes are what quests when reading from it. So, say you have client.questarray = 13,2,4,6; By reading that in pairs of two, you can see that for quest number 13, the player is at stage 2. So on, and so forth.

The only benefit of using bits is to save memory. Whatever you’re doing isn’t worth worrying about that on.

Dunno, I like the concept… I was looking for some sort of mathematical hack.

Don’t forget clever use of bitwise operators to set/unset shit at the same time.

right, and that’s why I recommended flags. They’re stored on the player and act as a binary function of on/off (1/0). I understand how bitflags work but I’m not really sure how you would go about simulating them. There HAS to be a way though, even if it takes a lot of math.

I stay away from flags as much as I can… or use them if they’re going to be temporary over a very short period of time.
I think they’re hell to manage.

could do a string and search it for specific letters, and if they don’t exist those options are off.
eg. stringname [abcdefgh] would be 11111111, and the absence of d would be 11101111

I don’t know shit though. That doesn’t exactly give you the options of just adding flags together like a+d+e+f+h. It also limits you to 26 bits per string, but that’s probably nothing to worry about.

I guess that’s a valid benefit, particularly with large numbers of flags.

Beholder uses his own version of bitflags on Bomber Arena.

if ( playerenters) {

  this.var = 8;//the variable to store information


  this.bits[2] = 1;


  message #v(this.var);

function varToBitArray() {
  this.maxBits = 1000;//maximum number of bits => ceil(log2(GRAAL_MAX_NUMBER))
  setarray this.bits,this.maxBits;

  //work out how many bits we actually need to handle
  this.bitsToHandle = int(log(2,this.var)+0.99999999999999999999999999);

  this.copy = this.var;
  for ( this.b = this.bitsToHandle  - 1; this.b >= 0; this.b-- ) {
    this.bitNo = 2 ^ this.b;

    if ( this.copy >= this.bitNo ) {
      this.bits[this.b] = 1;
      this.copy -= this.bitNo;

function bitArrayToVar() {
  this.var = 0;
  for ( this.b = 0; this.b < arraylen(this.bits); this.b++ ) {
    if ( this.bits[this.b] == 1) {
      this.var += 2 ^ this.b;

Not very mathematical but it’s a hack at the least.

Handling bit flags is just about understanding two mathematical operations essentially. Those being logarithms and exponents, if you don’t know how to do either of those, google is your friend.

I won an award in highschool once because I was the only student in the school who knew what logarithms were. And I’m not talking about base 10.

Gratz, here in Quebec back when I was at school we were never taught about logarithms… I know of that concept since last year. While I was looking for other ways to understand numerology and numbers, through my psychosis.

We have pretty bad math courses and many people complain they’re too advanced. I don’t think those who decide what we should learn understand that whatever content we’ll be taught students will think are too advanced. Because most people don’t use advanced maths anyway after school, even though more should.

Well I don’t think we were… they didn’t appear in exams nor in the books. I slept during lessons back in the days because I’d play Graal until early morning (or draw, or chat… but mostly Graal I think).