Re: [CODE] re:spec_proc invis_item

From: Mike Carpenter (abram@DELTANET.COM)
Date: 11/14/97


You wrote:
> Or, even easier, check to see if this is the object the spec_proc is
> atteched to, by use of "me".
>
> in the top line of the proc:
>
> SPECIAL(whatever)
> {
>   struct obj_data *invis_obj = (struct obj_data *)me;
> /* cast the "me" pointer to struct obj_data, and assign it to invis_obj
*/
>   if (invis_obj->carried_by != ch)
> /* check to see if the person carrying the invis_obj is the character
> issuing the command, if not exit the proc */
>         return 1;
> ...
> }
>
*snip*
/* Below I adjusted the spec_proc to remove the check for specific vnum */
/* This version has been tested and works */
/* You can now assign any object this spec_proc and it will work */
SPECIAL(invis_item)
{
 int i;
 char arg1[MAX_INPUT_LENGTH];
 struct obj_data *invis_obj = (struct obj_data *)me; /* cast the "me"
pointer and assign it to invis_obj */
  if (invis_obj->worn_by == ch) { /* check to see if the person carrying
the invis_obj is the character */
      if(CMD_IS("disappear")) {
      send_to_char("You slowly fade out of view.\r\n", ch);
      act("$n slowly fades out of view.\r\n", FALSE, ch, 0, 0,TO_ROOM);
      SET_BIT(AFF_FLAGS(ch), AFF_INVISIBLE);
      return (TRUE);
      }

      if (CMD_IS("appear")) {
      REMOVE_BIT(AFF_FLAGS(ch), AFF_INVISIBLE);
      send_to_char("You slowly fade into view.\r\n", ch);

      act("$n slowly fades into view.\r\n", FALSE, ch, 0, 0,TO_ROOM);
      return(TRUE);
      }

    one_argument(argument, arg1);

    if (is_abbrev(arg1, "magical")) {
     for (i=0; i< NUM_WEARS; i++)
     if(GET_EQ(ch,i)){
        if (IS_SET(AFF_FLAGS(ch), AFF_INVISIBLE)) {

          REMOVE_BIT(AFF_FLAGS(ch), AFF_INVISIBLE);
          perform_remove(ch,i);
          send_to_char("You slowly fade into view.\r\n", ch);
          act("$n slowly fades into view.\r\n", FALSE, ch, 0, 0, TO_ROOM);
          return (TRUE);
          } else {
          perform_remove(ch, i);
          return (TRUE);
          }
     return (FALSE);
     }
  return (FALSE);
  }
 return (FALSE);
 }
return (FALSE);
}
----------
Thanks to all those who contributed to this, again if there are any changes
to make it better please..post
them.
Abram


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



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