Re: Getting directions

From: Klaus Myrseth (klaus.myrseth@infohwy.no)
Date: 03/31/99


Is there a function to get the opposite direction of a movement?

example:
Showing which direction someone came from.
Current code shows:
act("$n has arrived.", TRUE, ch, 0, 0, TO_ROOM);

The code for someone leaving in a particular direction is:
    sprintf(buf2, "$n leaves %s.", dirs[dir]);
    act(buf2, TRUE, ch, 0, 0, TO_ROOM);

Answer:
Look at dirs[] and add a opposite_dirs[] in constants.c
Dirs:           Opposite_dirs:
North           South
South           North
East            West
...             ...

Hope you understand what i mean
Then just check what room the mobile/player arrived from and get the dir
constant from there, and refer to the opposite_dirs[] and its spelled out to
you :)

I havent looked for any fixes on that, but remember this code will only work
for zones that is not mazes and exits that is bouth ways. Its a hack but
works in most of the cases, and will allmost allways work on my mud, so its
acceptable here :)

Laters and good luck

Caram - Imp The Home Of The Vikings


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



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