Re: [code][question][newbie]special procedure...

From: Ron Hensley (ron@cross.dmv.com)
Date: 03/01/97


On Sat, 1 Mar 1997, Bellman wrote:

> Can someone tell me if there is anything wrong with this special procedure?
> I am a newbie. 
> 
> 
> SPECIAL(barney)
> {
>   ACMD(do_say)  /* missing an ending ';' here

/* This as coded, could cause the player himself to be foreced
   to speak when in hte room with the mob, as there is no check
   for whom 'ch' is. */
> 
>   if (cmd)
>     return (0);
> 
>   switch (number(0,60)){
>   case 0:
>     do_say(ch, "Hi! Welcome to uhhh, errr, oh yeah!!! Welcome to Mouchie
> Mania!", 0, 0);
>     return (1);
>   case 1: 
>     do_say(ch, "I can't beleive it's not butter!?!?", 0, 0);
>     return (1);
>   case 2:
>     do_say(ch, "What is that *BURP* doggie doin' here?!", 0, 0);
>     return (1);
>   case 3:
>     do_say(ch, "What are you looking at?!", 0, 0);
>     return (1)  /* Also missing a closing ';' here */
>   default:
>     return (0);
>   }
> }  

Touched up a bit:

SPECIAL(barney) 
  ACMD(do_say);
  struct char_data *self;

  self = (struct char_data *)me;

  if (cmd)
    return (0);

  switch (number(0,60)) {
    case 0:
      do_say(self, "Hi! Welcome to uhhh, errr, oh yeah!!! Welcome to Mouchie Mania!", 0, 0);
      break;
    case 1:
      do_say(self, "I can't beleive it's not butter!?!?", 0, 0);
      break;
    case 3:
      do_say(ch, "What are you looking at?!", 0, 0);
      break;
  }
  return 1;
}












    *******************************************************************
    *   Ron Hensley                     ron@dmv.com                   *
    *   Network Administrator           http://www.dmv.com/~ron       *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *
    *******************************************************************

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



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