05 Nov, 2012, arholly wrote in the 1st comment:
Votes: 0
Hi:
I'm having a problem with my do_feed command. It does not seem to be working.

Now, I should be able to do "feed from <name> <# of blood>", but it does not seem to be doing it.

When I do "Feed from Jermemy 3" it tells me
Quote
feed [target]
feed from [target]

My logging shows me this:
Quote
from is arg1.
jeremy is arg2.
3 is arg3.

What's going wrong?

void do_feed(CHAR_DATA *ch, char *string)
{
char arg1[MSL]={'\0'};
char arg2[MSL]={'\0'};
char arg3[MSL]={'\0'};
CHAR_DATA *victim;
int i = 0;

CheckCH(ch);

string = one_argument(string, arg1);
string = one_argument(string, arg2);
string = one_argument(string, arg3);
//These are to make sure I'm passing the variables to the right place.
log_string( Format("%s is arg1.", arg1));
log_string( Format("%s is arg2.", arg2));
log_string( Format("%s is arg3.", arg3));

if(!IS_NULLSTR(arg1))
{
if(ch->race != race_lookup("vampire"))
{
send_to_char("Feed whom?\n\r", ch);
}
else
{
send_to_char("feed [target]\n\r", ch);
send_to_char("feed from [target]\n\r", ch);
}
return;
}

if((victim = get_char_room(ch, arg1)) == NULL && str_cmp(arg1, "from"))
{
if(ch->race != race_lookup("vampire"))
{
send_to_char("Feed whom?\n\r", ch);
}
else
{
send_to_char("feed [target]\n\r", ch);
send_to_char("feed from [target]\n\r", ch);
}
return;
}

if(ch == victim)
{
send_to_char("Why would you want to feed from yourself?\n\r", ch);
return;
}

if(ch->position == P_FIGHT)
{
send_to_char("Because you're already fighting them it's difficult to feed.", ch);
return;
}

if(!str_cmp(arg1, "from"))
{
if(ch->race != race_lookup("vampire"))
{
send_to_char("Feed whom?\n\r", ch);
return;
}

if((victim = get_char_room(ch, arg2)) == NULL)
{
send_to_char("Feed from whom?\n\r", ch);
return;
}

if(ch == victim)
{
send_to_char("Why would you want to feed from yourself?\n\r", ch);
return;
}

if(IS_SET(victim->act2, ACT2_RP_ING))
{
send_to_char("You cannot use ooc feeding on an RP-ing player.\n\r", ch);
return;
}

if(!IS_NULLSTR(arg3) && !is_number(arg3))
{
send_to_char("How much do you want to bleed?", ch);
return;
}
else if(is_number(arg3))
{
i = atoi(arg3);
if(i > 3)
{
i = 3;
send_to_char("Feeding has been limited to 3 blood points per feed.\n\r", ch);
}
blood_drink(ch, victim, i, TRUE);
WAIT_STATE(ch, 3);
}
else
{
blood_drink(ch, victim, 1, TRUE);
WAIT_STATE(ch, 3);
}

return;
}

if(!is_number(arg2) && !IS_NULLSTR(arg2) )
{
send_to_char("How much do you want to bleed?", ch);
return;
}

if( (i = atoi(arg2)) <= 0 )
blood_drink(victim, ch, 1, FALSE);
else
blood_drink(victim, ch, i, FALSE);
WAIT_STATE(ch, 2);

}
05 Nov, 2012, Davion wrote in the 2nd comment:
Votes: 0
if(!IS_NULLSTR(arg1))


I think you mean

if( IS_NULLSTR(arg1))
05 Nov, 2012, arholly wrote in the 3rd comment:
Votes: 0
Oy! How'd I miss that. Thanks.
0.0/3