"random" select of item in inventory

BuckFloyd@aol.com
Date: 01/24/97


I'm all around this one, but can't quite figure it out...
I'm doing a spec_proc in which I want an item
in the player's carried inventory selected and then
done something with... So far, here's what I've got:

struct obj_data *obj, *list, *obj_take;
int found, to_take;

  /* make sure they have objects, and count them */
  for (obj = list; obj; obj = obj->next_content) {
    if (CAN_SEE_OBJ(ch, obj)) {
      obj_count += obj_count;
      found = 1;
    }
  }
  /* they're carrying someting, so pick one */
  if (found == 1)
  {
    to_take = number(1, obj_count);
    <dunno what goes here to get to_take translated 
      into obj_take>
   obj_from_char(obj_take);

Looks like IS_CARRYING_N won't do me any good.
So.. how can I convert "to_take" to a usuable object ?

If this is a silly, newish-C-programmer related question,
that'll suffice as an answer as well, and I'll go hit the books.

Thanks...
Buck

            

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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