I am trying to create a command, like glance in a way, that shows just the current state of the victim (target). This is the code that I have so far (again on smaug fuss):
void do_xa( CHAR_DATA *ch, char *argument )
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
char *msg;
int diff;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "&wxa <&Cvictim&w>\n\r", ch );
return;
}
if ( ( victim = get_char_room( ch, arg ) ) == NULL )
{
send_to_char( "They do not seem to be here.\n\r", ch );
return;
}
percent = (( victim->hit) / victim->max_hit));
if ( percent = 100 ) msg = "&w$N(is in &Gperfect health&w)";
else if ( percent >= 90 ) msg = "&w$N(is &gslightly scratched&w)";
else if ( percent >= 80 ) msg = "&w$N(has a &Yfew bruises&w)";
else if ( percent >= 70 ) msg = "&w$N(has &Osome cuts&w)";
else if ( percent >= 60 ) msg = "&w$N(has &Rseveral wounds&w)";
else if ( percent >= 50 ) msg = "&w$N(has &Rnasty wounds&w)";
else if ( percent >= 40 ) msg = "&w$N(is &rbleeding freely&w)";
else if ( percent >= 30 ) msg = "&w$N(is &rcovered in blood&w)";
else if ( percent >= 20 ) msg = "&w$N(is &pleaking guts&w)";
else if ( percent >= 10 ) msg = "&w$N(is &palmost dead!)";
else msg = "&w$N(is &zDYING!)";
act( AT_XA, msg, ch, NULL, victim, TO_CHAR );
return;
}
do_xa has been declared in mud.h and tables.c, but these are the errors that I have sent back to me upon compile:
make -s smaug
Compiling o/act_info.o....
act_info.c: In function `do_xa':
act_info.c:3091: parse error before `one_argument'
act_info.c:3086: parm types given both in parmlist and separately
act_info.c: At top level:
act_info.c:3099: parse error before `if'
cc1: warnings being treated as errors
act_info.c:3105: warning: type defaults to `int' in declaration of `percent'
act_info.c:3105: `victim' undeclared here (not in a function)
act_info.c:3105: `victim' undeclared here (not in a function)
act_info.c:3105: parse error before `)'
act_info.c:3118: parse error before `('
make[1]: *** [o/act_info.o] Error 1
make: *** [all] Error 2
As always your help is greatly appreciated.
-Frobozz |