Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Rom Snippet Port error

Rom Snippet Port error

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by DjNiVeK   (48 posts)  Bio
Date Sat 13 Mar 2004 09:00 PM (UTC)
Message
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.
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #1 on Sat 13 Mar 2004 09:29 PM (UTC)
Message
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);

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by DjNiVeK   (48 posts)  Bio
Date Reply #2 on Sat 13 Mar 2004 09:45 PM (UTC)
Message
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 ')'
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 13 Mar 2004 10:35 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by DjNiVeK   (48 posts)  Bio
Date Reply #4 on Sat 13 Mar 2004 11:24 PM (UTC)
Message
Ok, I fixed that bug. I forgot to add the 'BV00', etc behind the #define <_< >_>
Now to see there are more bugs :P
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #5 on Sat 13 Mar 2004 11:31 PM (UTC)
Message
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;

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by DjNiVeK   (48 posts)  Bio
Date Reply #6 on Sun 14 Mar 2004 04:18 PM (UTC)
Message
ty :)

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

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,944 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.