Really need help this time.

Posted by Manakra on Wed 22 Jun 2005 01:27 AM — 25 posts, 85,285 views.

#0
I tried adding in the furniture code to SmaugFuSS. After doing everything correctly, I get this error, and I dont know how to fix it

$ make
make -s smaug
Compiling o/act_info.o....
act_info.c: In function `show_char_to_char_0':
act_info.c:724: error: parse error before '}' token
make[1]: *** [o/act_info.o] Error 1
make: *** [all] Error 2

USA #1
Could you show us those lines (give or take a few above and down)?
#2
else if (IS_SET(victim->on->value[2],SLEEP_ON))
{
sprintf(message,"&P is sleeping on %s.",
victim->on->short_descr);
strcat(buf,message);
}
else
{
sprintf(message, "&P is sleeping in %s.",
victim->on->short_descr);
strcat(buf,message);
}
}
else
USA #3
That last else/bracket, what is the else for? What ifcheck? Same questions for the bracket.
#4
Umm, Id have to re-check again, but its all for the Furniture script, so if you look at the furniture script (1.01 I believe), you can find out


(otherwise) this is the full part
case POS_SLEEPING:
if (victim->on != NULL)
{
if (IS_SET(victim->on->value[2],SLEEP_AT))
{
sprintf(message,"&P is sleeping at %s.",
victim->on->short_descr);
strcat(buf,message);
}
else if (IS_SET(victim->on->value[2],SLEEP_ON))
{
sprintf(message,"&P is sleeping on %s.",
victim->on->short_descr);
strcat(buf,message);
}
else
{
sprintf(message, "&P is sleeping in %s.",
victim->on->short_descr);
strcat(buf,message);
}
}
else
{
if (ch->position == POS_SITTING
|| ch->position == POS_RESTING )
strcat( buf, "&P is sleeping nearby.&G" );
else
strcat( buf, "&P is deep in slumber here.&G" )
}
break;
case POS_RESTING:
if (victim->on != NULL)
{
if (IS_SET(victim->on->value[2],REST_AT))
{
sprintf(message,"&P is resting at %s.",
victim->on->short_descr);
strcat(buf,message);
}
else if (IS_SET(victim->on->value[2],REST_ON))
{
sprintf(message,"&P is resting on %s.",
victim->on->short_descr);
strcat(buf,message);
}
else
{
sprintf(message, "&P is resting in %s.",
victim->on->short_descr);
strcat(buf,message);
}
}
else
{
if (ch->position == POS_RESTING)
strcat ( buf, "&P is sprawled out alongside you.&G" );
else
if (ch->position == POS_MOUNTED)
strcat ( buf, "&P is sprawled out at the foot of your mount.&G" );
else
strcat (buf, "&P is sprawled out here.&G" );
}
break;
case POS_SITTING:
if (victim->on != NULL)
{
if (IS_SET(victim->on->value[2],SIT_AT))
{
sprintf(message,"&P is sitting at %s.",
victim->on->short_descr);
strcat(buf,message);
}
else if (IS_SET(victim->on->value[2],SIT_ON))
{
sprintf(message,"&P is sitting on %s.",
victim->on->short_descr);
strcat(buf,message);
}
else
{
sprintf(message, "&P is sitting in %s.",
victim->on->short_descr);
strcat(buf,message);
}
}
else
strcat(buf, "&P is sitting here.");
break;
case POS_STANDING:
if (victim->on != NULL)
{
if (IS_SET(victim->on->value[2],STAND_AT))
{
sprintf(message,"&P is standing at %s.",
victim->on->short_descr);
strcat(buf,message);
}
else if (IS_SET(victim->on->value[2],STAND_ON))
{
sprintf(message,"&P is standing on %s.",
victim->on->short_descr);
strcat(buf,message);
}
else
{
sprintf(message, "&P is standing in %s.",
victim->on->short_descr);
strcat(buf,message);
}
}
else
if ( IS_IMMORTAL(victim) )
strcat( buf, "&P is here before you.&G" );
else
if ( ( victim->in_room->sector_type == SECT_UNDERWATER )
&& !IS_AFFECTED(victim, AFF_AQUA_BREATH) && !IS_NPC(victim) )
strcat( buf, "&P is drowning here.&G" );
else
if ( victim->in_room->sector_type == SECT_UNDERWATER )
strcat( buf, "&P is here in the water.&G" );
else
if ( ( victim->in_room->sector_type == SECT_OCEANFLOOR )
&& !IS_AFFECTED(victim, AFF_AQUA_BREATH) && !IS_NPC(victim) )
strcat( buf, "&P is drowning here.&G" );
else
if ( victim->in_room->sector_type == SECT_OCEANFLOOR )
strcat( buf, "&P is standing here in the water.&G" );
else
if ( IS_AFFECTED(victim, AFF_FLOATING)
|| IS_AFFECTED(victim, AFF_FLYING) )
strcat( buf, "&P is hovering here.&G" );
else
strcat( buf, "&P is standing here.&G" );
break;
Amended on Wed 22 Jun 2005 03:21 AM by Manakra
USA #5
Please try to use the code tag to make it easier to view. What is line 724? So far I checked the brackets and saw nothing wrong.
Amended on Wed 22 Jun 2005 04:02 AM by Zeno
#6

      case POS_SLEEPING:
       if (victim->on != NULL)
           {
               if (IS_SET(victim->on->value[2],SLEEP_AT))
               {
                   sprintf(message,"&P is sleeping at %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
               else if (IS_SET(victim->on->value[2],SLEEP_ON))
               {
                   sprintf(message,"&P is sleeping on %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
               else
               {
                   sprintf(message, "&P is sleeping in %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
           }
           else
           {
             if (ch->position == POS_SITTING
             ||  ch->position == POS_RESTING )
                 strcat( buf, "&P is sleeping nearby.&G" );
	     else
                 strcat( buf, "&P is deep in slumber here.&G" )
           }
             break;
       case POS_RESTING:
           if (victim->on != NULL)
           {
               if (IS_SET(victim->on->value[2],REST_AT))
               {
                   sprintf(message,"&P is resting at %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
               else if (IS_SET(victim->on->value[2],REST_ON))
               {
                   sprintf(message,"&P is resting on %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
               else
               {
                   sprintf(message, "&P is resting in %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
           }
           else
           {
             if (ch->position == POS_RESTING)
                 strcat ( buf, "&P is sprawled out alongside you.&G" );
             else
	     if (ch->position == POS_MOUNTED)
	         strcat ( buf, "&P is sprawled out at the foot of your mount.&G" );
	     else
                 strcat (buf, "&P is sprawled out here.&G" );
           }
             break;
       case POS_SITTING:
           if (victim->on != NULL)
           {
               if (IS_SET(victim->on->value[2],SIT_AT))
               {
                   sprintf(message,"&P is sitting at %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
               else if (IS_SET(victim->on->value[2],SIT_ON))
               {
                   sprintf(message,"&P is sitting on %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
               else
               {
                   sprintf(message, "&P is sitting in %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
           }
           else
	       strcat(buf, "&P is sitting here.");
           break;
       case POS_STANDING:
        if (victim->on != NULL)
           {
               if (IS_SET(victim->on->value[2],STAND_AT))
               {
                   sprintf(message,"&P is standing at %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
               else if (IS_SET(victim->on->value[2],STAND_ON))
               {
                   sprintf(message,"&P is standing on %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
               else
               {
                   sprintf(message, "&P is standing in %s.",
                       victim->on->short_descr);
                   strcat(buf,message);
               }
           }
         else
           if ( IS_IMMORTAL(victim) )
               strcat( buf, "&P is here before you.&G" );
	   else
           if ( ( victim->in_room->sector_type == SECT_UNDERWATER )
           && !IS_AFFECTED(victim, AFF_AQUA_BREATH) && !IS_NPC(victim) )
               strcat( buf, "&P is drowning here.&G" );
	   else
           if ( victim->in_room->sector_type == SECT_UNDERWATER )
               strcat( buf, "&P is here in the water.&G" );
	   else
           if ( ( victim->in_room->sector_type == SECT_OCEANFLOOR )
	   && !IS_AFFECTED(victim, AFF_AQUA_BREATH) && !IS_NPC(victim) )
	       strcat( buf, "&P is drowning here.&G" );
	   else
	   if ( victim->in_room->sector_type == SECT_OCEANFLOOR )
	       strcat( buf, "&P is standing here in the water.&G" );
           else
	   if ( IS_AFFECTED(victim, AFF_FLOATING)
           || IS_AFFECTED(victim, AFF_FLYING) )
             strcat( buf, "&P is hovering here.&G" );
           else
             strcat( buf, "&P is standing here.&G" );
             break;



As well, Ive tried playing with the indentation all the time, and nothing seems to work. bah, isnt there a way I can Make/Make Clean with cygwyn, that can bypass it?
Amended on Wed 22 Jun 2005 04:04 AM by Manakra
USA #7
Changing indentation won't change how the code compiles. Bypass what? Cygwin should be able to make clean.

Can you tell me what line 724 is?
#8
{
sprintf(message, "&P is sleeping in %s.",
victim->on->short_descr);
strcat(buf,message); 724
} or this is 724
Amended on Wed 22 Jun 2005 04:12 AM by Manakra
USA #9
Well the whole code there looks fine. What happens when you comment it out? If the error still happens, it is elsewhere. Sometimes missing a bracket/quote can do that.

[EDIT] Well I see this line, which is wrong:
strcat( buf, "&P is deep in slumber here.&G" )

Need a ; at the end.
Amended on Wed 22 Jun 2005 04:15 AM by Zeno
#10
when I comment it out, I get a error for 725 and 713, parsing as well....
USA #11
So after you comment out the whole code (the full part you posted) you still get that error? Then it is a trailing missing bracket or the sort.
#12
What happened is, I commented out the

{
sprintf(message, "&P is sleeping in %s.",
victim->on->short_descr);
strcat(buf,message);
}
part where it was giving the error

but now I get a new error when I put the ; at the end of the one thing

$ make
make -s smaug
Compiling o/act_info.o....
Compiling o/act_move.o....
act_move.c:2410: error: redefinition of `do_stand'
act_move.c:1982: error: `do_stand' previously defined here
act_move.c:2554: error: redefinition of `do_sit'
act_move.c:2027: error: `do_sit' previously defined here
act_move.c:2707: error: redefinition of `do_rest'
act_move.c:2074: error: `do_rest' previously defined here
act_move.c:2871: error: redefinition of `do_sleep'
act_move.c:2123: error: `do_sleep' previously defined here
make[1]: *** [o/act_move.o] Error 1
make: *** [all] Error 2
USA #13
Remove any comments you just added. Are there any parse errors? If not on to the next issue.

You were suppose to replace the existing sit/stand etc with the new ones I believe.
#14
How do I replace the old ones? I thought I got them. and I cant find them in the info, so it must be in the (?)(?)
USA #15
Simply comment out the old functions (or delete) and put the new ones in. They are in act_move.c as the error shows.
#16
Okay, got past Act_move, now I got Act_wiz, bigger problem now.

$ make
make -s smaug
Compiling o/act_move.o....
Compiling o/act_obj.o....
Compiling o/act_wiz.o....
act_wiz.c: In function `do_transfer':
act_wiz.c:1340: error: `Add' undeclared (first use in this function)
act_wiz.c:1340: error: (Each undeclared identifier is reported only once
act_wiz.c:1340: error: for each function it appears in.)
act_wiz.c:1340: error: parse error before "these"
act_wiz.c: At top level:
act_wiz.c:1346: error: parse error before "if"
act_wiz.c:1351: error: parse error before numeric constant
act_wiz.c:1354: error: parse error before string constant
act_wiz.c:1354: warning: type defaults to `int' in declaration of `do_look'
act_wiz.c:1354: error: conflicting types for `do_look'
mud.h:3798: error: previous declaration of `do_look'
act_wiz.c:1354: warning: redundant redeclaration of `do_look' in same scope
mud.h:3798: warning: previous declaration of `do_look'
act_wiz.c:1354: warning: data definition has no type or storage class
make[1]: *** [o/act_wiz.o] Error 1
make: *** [all] Error 2

(I so look stupid right now, dont I? )
Amended on Wed 22 Jun 2005 04:37 AM by Manakra
USA #17
Were these errors here before you added furniture? Show me the lines around 1340.
#18
Nah, they weren't.


   {
      send_to_char( "They have no physical location!\n\r", ch );
      return;
   }
   /*
    * modification to prevent a low level imm from transferring a 
    */
   /*
    * higher level imm with the DND flag on.  - Gorog             
    */
   if( !IS_NPC( victim ) && get_trust( ch ) < get_trust( victim )
       && victim->desc
       && ( victim->desc->connected == CON_PLAYING
            || victim->desc->connected == CON_EDITING ) && IS_SET( victim->pcdata->flags, PCFLAG_DND ) )
   {
      pager_printf( ch, "Sorry. %s does not wish to be disturbed.\n\r", victim->name );
      pager_printf( victim, "Your DND flag just foiled %s's transfer command.\n\r", ch->name );
      return;
   }
   /*
    * end of modification                                         
    */

the stop is starting on 1339
USA #19
Are you sure?
act_wiz.c:1340: error: `Add' undeclared (first use in this function)

It seems like you missed a comment or quote. I do not see "Add" anywhere in the code you posted.
#20
I did a search for Add, and it said "Add this", so I killed it off, saved, compiled, and no errors o.0

Time to test it out, ^_^


Edit: It works, at least for sitting on the chair, THANKS for all your help, ^_^
Amended on Wed 22 Jun 2005 04:47 AM by Manakra
#21
On the side note, anyone feel like teaching my Bitvectors?

(if you look on hermes building guide, objects, then furniture values, he says "add them up" and it confuses me, ^_^ )
Australia #22
Add them up is what you do, take the following flags, and there bit values

flagA = 1
flagB = 2
flagC = 4

If you want a something to have flagA you would give it a value of 1, if you wanted something to have both flagA and flagB then you would add those values us and give it a value of 3, being flagA + flagB, or 1 + 2.

Bitvectors are funny little buggers that when added together give a result that can be broken back into the added parts and only those parts.

USA #23
Bitvectors are called such because they work with binary math. If you express the flags in binary, they look like:

1 =      1
2 =     10
4 =    100
8 =   1000
16 = 10000
So, a bitvector is just taking the 32 bits of an integer and setting the numbers. For instance, if bit 1 is equal to 1, then flag 1 is set. It "so happens" (by the nature of binary - it is in fact no accident at all) that the decimal values are the sums of the flag numbers.

The most important property is that the only way to get, say, 7, with these flags, is by adding 1, 2 and 4. If you add 3 and 4, then since 3 is '1' and '10', you're really adding 1, 2 and 4. It's kind of like prime numbers, but for addition instead of multiplication. (If that last comment confused you, just ignore it. It probably makes sense only if you're familiar with the math of divisors, formal arithmetic etc.)

In any case, a bitvector in SMAUG is nothing more than a 32-bit number where you turn on or off specific bits. A decimal number, translated into binary, tells you which flags are turned on based on which digits are 1s.
USA #24
Speaking of prime numbers, and expounding on Ksilyan said, if you believe, I think its Godel's Prime Number Hypothesis/Theorem, that all numbers can be constructed from prime numbers, then thats alot like what it is, only with other numbers...


I feel like such a geek now...