This is my do_slice code:
void do_slice( CHAR_DATA *ch, char *argument )
{
OBJ_DATA *corpse;
OBJ_DATA *obj;
OBJ_DATA *slice;
bool found;
char buf[MAX_STRING_LENGTH];
char buf1[MAX_STRING_LENGTH];
found = FALSE;
if ( !IS_NPC(ch) && !IS_IMMORTAL(ch)
&& ch->level < skill_table[gsn_slice]->skill_level[ch->class] )
{
send_to_char("You are not learned in this skill.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char("From what do you wish to slice meat?\n\r", ch);
return;
}
int meat_counter;
meat_counter ++;
if meat_counter == 5;
{
extract_obj( corpse );
return;
}
if ( ( obj = get_eq_char( ch, WEAR_WIELD ) ) == NULL
|| ( obj->value[3] != 1 && obj->value[3] != 2 && obj->value[3] != 3
&& obj->value[3] != 11) )
{
send_to_char( "You need to wield a sharp weapon.\n\r", ch);
return;
}
if ( (corpse = get_obj_here( ch, argument )) == NULL)
{
send_to_char("You can't find that here.\n\r", ch);
return;
}
if (corpse->item_type != ITEM_CORPSE_NPC )
{
send_to_char("That is not a suitable source of meat.\n\r", ch);
return;
}
if ( get_obj_index(OBJ_VNUM_SLICE) == NULL )
{
bug("Vnum 24 not found for do_slice!", 0);
return;
}
if ( !can_use_skill(ch, number_percent(), gsn_slice ) && !IS_IMMORTAL(ch))
{
send_to_char("You fail to slice the meat properly.\n\r", ch);
learn_from_failure(ch, gsn_slice); /* Just in case they die :> */
if ( number_percent() + (get_curr_dex(ch) - 13) < 10)
{
act(AT_BLOOD, "You cut yourself!", ch, NULL, NULL, TO_CHAR);
damage(ch, ch, ch->level, gsn_slice);
}
return;
}
slice = create_object( get_obj_index(OBJ_VNUM_SLICE), 0 );
sprintf(buf, "meat fresh slice %s", corpse->name);
STRFREE(slice->name);
slice->name = STRALLOC(buf);
sprintf(buf, "a slice of raw meat from %s", corpse->short_descr);
STRFREE(slice->short_descr);
slice->short_descr = STRALLOC(buf);
sprintf(buf1, "A slice of raw meat from %s lies on the ground.", corpse->short_descr);
STRFREE(slice->description);
slice->description = STRALLOC(buf1);
act( AT_BLOOD, "$n cuts a slice of meat from $p.", ch, corpse, NULL, TO_ROOM);
act( AT_BLOOD, "You cut a slice of meat from $p.", ch, corpse, NULL, TO_CHAR);
slice->value[0] = 13;
obj_to_char(slice, ch);
learn_from_success(ch, gsn_slice);
return;
}
I'm getting a parse error before "meat counter" and I don't quite know how one goes about adding an increment to the counter, but other then that it's good. :)
Thanks and Godbless.
Longbow |