Object specproc dilemma

From: Craig Mackles Jr. (macklesc@HOTMAIL.COM)
Date: 03/03/03

I've been writing code for CircleMUD for about two years now, and I've got
a really good grasp on the game's code structure and mechanics.. but the
one thing I never tried until now was to create a specproc.

I made this item called "the cloak of the chameleon", and I wanted it to
make the wearer blend into their surroundings. I made an AFF_ flag in
structs.h and an appropriate addition to the affected_bits[] array. I do
not want this to be a settable flag via OLC (as to prevent builders from
creating copycats of the item), so I wrote a specproc. I tried two methods
of doing this.

First method:
equip_char(ch, cloak, ITEM_WEAR_ABOUT);

This did take the obj from their inven but never equipped it to them.

Second method:
perform_wear(ch, cloak, ITEM_WEAR_ABOUT);

This just crashes the server. I added "void perform_wear(blahblah);" at the
top of spec_procs.c.

Here's the whole specproc using the second method. I'm baffled as to what
could be causing these problems, but it's sure annoying :)
I'd like to get some insight from the CircleMUD community so I can actually
start to write better specprocs (I'll be sending some code to the devel
site as soon as I get snippets together :)

 char arg1[MAX_STRING_LENGTH];
 struct obj_data *cloak;

 one_argument(argument, arg1);

  if(!(cloak = get_obj_in_list_vis(ch, arg1, NULL, ch-
  act("$n wears a strange looking cloak and blends into $s
surroundings.", FALSE, ch, NULL, NULL, TO_ROOM);
  act("You wear the chameleon cloak and feel completely
hidden.", FALSE, ch, NULL, NULL, TO_CHAR);
  perform_wear(ch, cloak, ITEM_WEAR_ABOUT);
 else if(CMD_IS("remove"))
  if(!(cloak = get_obj_in_list_vis(ch, arg1, NULL, GET_EQ(ch,
  perform_remove(ch, ITEM_WEAR_ABOUT);

  act("$n is revealed as $e removes a strange looking
cloak.", TRUE, ch, NULL, NULL, TO_ROOM);
  act("You feel completely revealed as you remove the
cloak.", FALSE, ch, NULL, NULL, TO_CHAR);

I hope it's not too ugly since it's my first specproc :)

   | 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