Rom Snippet Port error

Posted by DjNiVeK on Sat 13 Mar 2004 09:00 PM — 7 posts, 21,929 views.

#0
Alright, I don't know what is wrong, since it looks just like the normal SET_BIT( thingies. The errors give the following:

comm.c: 2148: error: syntax error before ')' token

The lines of the code where the error happens look like this:

          case 'O': case 'o':
            SET_BIT( ch->pcdata->hairc, HAIR_ORANGE);
            REMOVE_BIT(ch->pcdata->hairc, HAIR_BLONDE);
            REMOVE_BIT(ch->pcdata->hairc, HAIR_BLACK);
            REMOVE_BIT(ch->pcdata->hairc, HAIR_GOLD);
            REMOVE_BIT(ch->pcdata->hairc, HAIR_BROWN);
            REMOVE_BIT(ch->pcdata->hairc, HAIR_RED);
            REMOVE_BIT(ch->pcdata->hairc, HAIR_WHITE);


Everything in the bits is defined and all, so I don't know where to find the problem.
Canada #1
Which line is the bad one? And if the options shown are all the flags that may be(which would make sense what what I see), this would be easier:
          case 'O': case 'o':
	    ch->pcdata->harc = 0;
            SET_BIT( ch->pcdata->hairc, HAIR_ORANGE);
#2
Because of the ch->pcdata->hairc = 0, my errors are reduced with a lot already, lol. I'll give the the whole part this time, last time it was way too big. It's in the 'nanny' part of comm.c

        write_to_buffer(d,"Pick your hair color.\n\rblonde(Y)\n\rorange(O)\n\rblack(L)\n\rgold(G)\n\rbrown(B)\n\rred(R)\n\rwhite(W)\n\rWhich'll it be? (B/O/L/G/B/R/W)",0);
        d->connected = CON_GET_HAIR;
        break;

    case CON_GET_HAIR:
#if defined(unix)
        write_to_buffer( d, "\n\r", 2 );
#endif
        switch ( *argument )
          {
          case 'Y': case 'y':
	    ch->pcdata->hairc = 0;
	    SET_BIT(ch->pcdata->hairc, HAIR_BLONDE );
            hairChoice = TRUE;
            break;
          case 'O': case 'o':
	    ch->pcdata->hairc = 0;
            SET_BIT( ch->pcdata->hairc, HAIR_ORANGE);
            hairChoice = TRUE;
            break;
          case 'l': case 'L':
	    ch->pcdata->hairc = 0;
            SET_BIT( ch->pcdata->hairc, HAIR_BLACK);
            hairChoice = TRUE;
            break;
          case 'G': case 'g':
	    ch->pcdata->hairc = 0;
            SET_BIT( ch->pcdata->hairc, HAIR_GOLD);
            hairChoice = TRUE;
            break;
          case 'B': case 'b':
	    ch->pcdata->hairc = 0;
            SET_BIT( ch->pcdata->hairc, HAIR_BROWN);
            hairChoice = TRUE;
            break;
          case 'R': case 'r':
	    ch->pcdata->hairc = 0;
            SET_BIT( ch->pcdata->hairc, HAIR_RED);
            hairChoice = TRUE;
            break;
          case 'W': case 'w':
	    ch->pcdata->hairc = 0;
            SET_BIT( ch->pcdata->hairc, HAIR_WHITE);
            hairChoice = TRUE;
            break;
          default:
            write_to_buffer( d, "Not a valid hair color. Choose again (Y/O/L/G/B/R/W). ", 0 );
            hairChoice = FALSE;
            break;
          }
        if(!hairChoice)
          break;


All the SET_BIT( give the error with the syntax before the ')'
Australia Forum Administrator #3
Why not put:

ch->pcdata->hairc = 0;


once at the start of the routine? Rather than doing it 10 times?

Anyway, it looks like a problem with the define for SET_BIT.

For instance, if there was a stray comma or something in that define that would appear when you used the SET_BIT, not when it is defined.
#4
Ok, I fixed that bug. I forgot to add the 'BV00', etc behind the #define <_< >_>
Now to see there are more bugs :P
Australia Forum Administrator #5
Also, instead of:

if(!hairChoice)
break;

You could do:

if (ch->pcdata->hairc == 0)
break;

Then you can get rid of all the stuff about:

hairChoice = TRUE;
#6
ty :)

I got it to work properly now. Had a save bug before, but fixed that one aswell =)