Re: newbie question

From: Del (caminturn@earthlink.net)
Date: 08/18/01


Luca wrote:
>
>         Anyone can tell me what this thing do?
> spec_procs.c
> SPECIAL(mayor)
> {
>    const char open_path[] =
>         "W3a3003b33000c111d0d111Oe333333Oe22c222112212111a1S.";
>    const char close_path[] =
>         "W3a3003b33000c111d0d111CE333333CE22c222112212111a1S.";
> I have no clue...

Here is your clue:
It sets the variables 'open_path' and 'close path' to those strings of
characters. Then if you follow the code down, you notice:

    if (time_info.hours == 6) {
      move = TRUE;
      path = open_path;
      index = 0;
    } else if (time_info.hours == 20) {
      move = TRUE;
      path = close_path;
      index = 0;
    }

This section tells the code what times during a mud day to work on which
open/close path to use.
Again, further down there is a section of code that looks like:

  switch (path[index]) {
  case '0':
  case '1':
  case '2':
  case '3':
    perform_move(ch, path[index] - '0', 1);
    break;

  case 'W':
    GET_POS(ch) = POS_STANDING;
    act("$n awakens and groans loudly.", FALSE, ch, 0, 0, TO_ROOM);
    break;

  case 'S':
    GET_POS(ch) = POS_SLEEPING;
    act("$n lies down and instantly falls asleep.", FALSE, ch, 0, 0, TO_ROOM);
    break;

  case 'a':
    act("$n says 'Hello Honey!'", FALSE, ch, 0, 0, TO_ROOM);
    act("$n smirks.", FALSE, ch, 0, 0, TO_ROOM);
    break;

  case 'b':
    act("$n says 'What a view!  I must get something done about that dump!'",
        FALSE, ch, 0, 0, TO_ROOM);
    break;

  case 'c':
    act("$n says 'Vandals!  Youngsters nowadays have no respect for anything!'",
        FALSE, ch, 0, 0, TO_ROOM);
    break;

<sniped the remaining>

To put it all togather each letter/number is evaluated one at a time
every few seconds to 'move', talk, open/lock doors, etc.
The numbers move him in that direction (see directions in structs.h)
and the other letters perform the functions in the spec_proc.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST