Re: Snippets: entering a room...

From: Chris Proctor (
Date: 07/29/99

> i want to add so that when entering a room you see from wich
> dir you entered.
> etc.
> "bla bla enters from the south."

The hardest bit conceptually is printing the correct direction. There's a
rev_dir array in constants.c (I think it's part of stock) that merely
gives the direction number opposite the index. So if you go for
rev_dir[NORTH] you'll get SOUTH.

So it would be:
sprintf(buf, "$n enters from the %s.", dirs[rev_dir[move_dir]]);
act(buf, FALSE, ch, 0, 0, TO_ROOM);
After he's entered the room, instead of the current lines.

Note, though, that this looks exceedingly stupid for up and down.

Chris enters from the down.

Hence my own slight adjustment to that, an alt_dirs array, which is
supposed to contain directions that make more sense when moving.

const char *alt_dirs[] =
  "the north",
  "the east",
  "the south",
  "the west",

Note that this requires a change to the sprintf:
sprintf(buf, "$n enters from %s." alt_dirs[rev_dir[move_dir]]);

Chris leaves to below.  (still a little odd, but better than before)
Chris enters from below.

Chris leaves to the west.
Chris enters from the west.

Actually mine's different to that yet again, putting a move verb there
instead of "enters", such as walks, flies, swims, limps, etc. Easy enough
to do.

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

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