EDIT: I forgot about act.h (DOH)
EDIT: Please ignore!
I'm trying to copy/paste this snippet into my TBA mud:
www.circlemud.org/pub/CircleMUD/contrib/...ts/skills/forage.txt
I'm getting this error when I make:
Code:
$ make
make ../bin/circle
make[1]: Entering directory '/home/Parker/tba/src'
gcc -g -O2 -Wall -Wno-char-subscripts -c -o class.o class.c
gcc -g -O2 -Wall -Wno-char-subscripts -c -o interpreter.o interpreter.c
interpreter.c:151:44: error: ‘do_forage’ undeclared here (not in a function)
{ "forage" , "fora" , POS_STANDING, do_forage , 0, 0 },
^
<builtin>: recipe for target 'interpreter.o' failed
make[1]: *** [interpreter.o] Error 1
make[1]: Leaving directory '/home/Parker/tba/src'
Makefile:30: recipe for target 'all' failed
make: *** [all] Error 2
I followed the instructions and I added my own object and added the command to spells.h,
spell_parser.c and interpreter.c. The skill itself is in act.other.c - What am I doing wrong?
My code looks like this:
Code:
ACMD(do_forage)
{
struct obj_data *item_found = '\0';
int item_no = 27219; /* Initialize with first item poss. */
*buf = '\0';
if GET_CLASS(ch) != CLASS_THIEF && GET_LEVEL(ch) <= 100) {
send_to_char("You have no idea how to forage for survival!\r\n", ch);
return; }
if(GET_MOVE(ch) < 100) {
send_to_char("You do not have enough energy right now.\r\n", ch);
return; }
if(SECT(ch->in_room) != SECT_FIELD && SECT(ch->in_room) != SECT_FOREST && SECT(ch->in_room) != SECT_HILLS && SECT(ch->in_room) != SECT_MOUNTAIN && SECT(ch->in_room) != SECT_SWAMP) {
send_to_char("You cannot forage on this type of terrain!\r\n", ch);
return; }
if(GET_SKILL(ch, SKILL_FORAGE) <= 0) {
send_to_char("You have no idea how to forage!\r\n", ch);
return; }
send_to_char("You start searching the area for signs of food.\r\n", ch);
act("$n starts foraging the area for food.\r\n", FALSE, ch, 0, 0, TO_ROOM);
if(number(1,101) > GET_SKILL(ch, SKILL_FORAGE)) {
WAIT_STATE(ch, PULSE_VIOLENCE * 2);
GET_MOVE(ch) -= (100 - GET_LEVEL(ch));
send_to_char("\r\nYou have no luck finding anything to eat.\r\n", ch);
return;
}
else
{
switch (number(1,2))
{
case 1:
item_no = 27219; break; /*<--- Here are the objects you need to code */
case 2: /* Add more or remove some, just change the */
item_no = 10; break; /* switch(number(1, X) */
}
WAIT_STATE( ch, PULSE_VIOLENCE * 2); /* Not really necessary */
GET_MOVE(ch) -= (150 - GET_LEVEL(ch));
item_found = read_object( item_no, VIRTUAL);
obj_to_char(item_found, ch);
sprintf(buf, "%sYou have found %s!\r\n", buf, item_found->short_description);
send_to_char(buf, ch);
act("$n has found something in his forage attempt.\r\n", FALSE, ch, 0, 0, TO_ROOM);
return;
}
}
Thanks.