I wanted to say thanks to everyone that helped me with my last command,
really appreciated it and now it works great with 3.1
Now this lil fellow is giving me a headache, and I know the buffer thing
changed a while ago..not sure what patch level, but im not exactly sure
what it changed to.
I also know the sprintf(buf stuff got changed to send_to_char( ...
anyways im stumped on what to change with this code to make it work. I
haven't played with this much yet, but I know it has a bunch of old things
that were changed not in the 3.1 code anymore like how the buffers are
handled and the send_to_char lines. Any help or pointers would be gladly
accepted. I have a bunch of old code that needs updated and I was hoping to
use this as a template, I know the other stuff is missing updates to the
same sorta things this one is.
ACMD(do_forage)
{
struct obj_data *item_found = '\0';
int item_no = 10053; /* Initialize with first item poss. */
*buf = '\0';
if(GET_CLASS(ch) != CLASS_WARRIOR && 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,7))
{
case 1:
item_no = 10053; break; /*<--- Here are the objects you need to
code */
case 2: /* Add more or remove some, just change
the */
item_no = 10054; break; /* switch(number(1, X) */
case 3:
item_no = 10055; break;
case 4:
item_no = 10056; break;
case 5:
item_no = 10057; break;
case 6:
item_no = 10058; break;
case 7:
item_no = 10059; break;
}
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;
}
}
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/26/03 PDT