Re: [newbie] spec_proc

From: Daniel Koepke (dkoepke@california.com)
Date: 01/14/97


On Tue, 14 Jan 1997, Laura Ree wrote:

> I _think_ this would then show up something like:
> MobA shouts,'The captain has turned off the no smoking sign.'
> (only to the zone)
> 
> But what I am trying to make it do is:
> MobA announces, 'The captain has turned off the no smoking sign.'
> (only to the zone)
> 
> any ideas? suggestions? 

Actually, it wouldn't work at all.  do_gen_comm does not allow mobs
to gossip/shout/etc.  You'd be better off just writing the code in
the actual spec-proc:

  SPECIAL(announce) {
    struct descriptor_data *i;
    struct char_data *tch;
    char *mesg = "Blah.";

    if (cmd || FIGHTING(ch) || GET_POS(ch) <= POS_SLEEPING)
      return FALSE;

    switch (number(0, 5)) {
    case 0:
      mesg = "The captain has turned off the no smoking sign.\r\n";
      break;
    case 1:
      mesg = "Thank you for chosing MUD Air!\r\n";
      break;
    default:
      return TRUE; // don't say anything
      break;
    }

    for (i = descriptor_list; i; i = i->next)
      if (!i->connected && (tch = i->character) &&
          world[tch->in_room].zone == world[ch->in_room].zone &&
          !PLR_FLAGGED(tch, PLR_MAILING) &&
          !PLR_FLAGGED(tch, PLR_WRITING))
        send_to_char(mesg, tch);
    return TRUE;
  }

> Also another very newbie-ish type question, when i did a grep on "shout" I
> got over a page of places it is listed (so I did it more specifically to
> narrow it down) anyways, my question is: is there some way in Linux that I
> can make it show the results of the grep in pages? (instead of just
> scrolling off so fast that I only see the last page worth).
> Thanks for all the help

You can pipe it out to 'more' or 'less'.  My favorite is 'less',
but not everyone has it.  Anyway:

  % grep -i level *.[ch] | less

Will do a case insensitive grep for 'level' in all .c and .h files,
piping the output through less.  Inside of <less>, the space bar will
make you move forward, 'w' moves backwards, '/' allows you to search
for something, and simply typing a number will move you forward that
many lines.  There's more options, but those are the most useful, IMHO.

More does not allow moving backwards.


--
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