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
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;
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?
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.
{
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
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
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.
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.
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...