On Fri, 24 Jan 1997 BuckFloyd@aol.com wrote:
> 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);
>
Why bother making it that complex and counting the objects, etc., etc.
I'd think:
// Randomly selects an object in their inventory we can see
for (obj = list; obj; obj = obj->next_content)
if (CAN_SEE_OBJ(ch, obj) && !number(0, 4))
break;
if (!obj) {
// we didn't find one, should return
}
obj_from_char(obj);
Seems proper to me... Dunno, I'm personally tired (end of a long week).
And more fucking rain...
--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.
+-----------------------------------------------------------+
| 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