[Newbie][Code]Changing the eat command to check everything...

From: Anthony Benjamin (benjamin@powerweb.net)
Date: 01/12/99

Wow, some day I will know how to code good...until then:

What I would like to do, is have do_eat, check the inventory for food of
any kind, if someone types eat all, instead of saying "You don't have
all." I would like it to say a message similar to.. You cannot eat a
sword, You cannot eat a shield, for items it finds in the inventory that
are unedible, but i would like it to eat stuff it finds that are edible
in the inventory....So...i was wondering if i was ontrack with the
following modifications...

if (!(food = get_obj_in_list_vis(ch, arg, ch->carrying))) {
    sprintf(buf, "You don't seem to have %s %s.\r\n", AN(arg), arg);
    send_to_char(buf, ch);

if(arg = "all" || "ALL"){

Then I am kinda stuck there...I guess I need someway to cycle through
the inventory, object by object until the end of the list, and if it is
food, call the food function stuff, and if it isn't call in the not food
function stuff, etc. I know this must seem like a stupid question, but
being 17 years old...and this my first MUD, and my first real experience
with coding in C++, any help would be appreciated....

Anthony - The Newbie Coder

"My code doesn't have bugs, it just develops new features..."

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |

This archive was generated by hypermail 2b30 : 12/15/00 PST