Peter Ajamian writes, "The following is a snippet I did to source which is not stock. While the directions are general enough to apply to just about any bpl15 source (I have even gotten it to work on a bpl14 source), you may have to tweak with things some in order to get it to work. If you have problems implementing the snippet send me an email and I'll be glad to help you in any way I can..." There is a slight complication when adding directions such as northwest, southeast, etc. You have to account for two possible commands being entered, the player may enter northwest, or (s)he may just enter nw. This accountability adds a significant amount of extra coding to add these directions.
In constants.c:
- find the entry for const char *dirs[] and add the following to the end of the list (right before the "\n" entry)...
"northwest",
"northeast",
"southeast",
"southwest",
"in",
"out",
- directly following the char *dirs[] entry create a new array as follows...
const char *abbr_dirs[] =
{
"n",
"e",
"s",
"w",
"u",
"d",
"nw",
"ne",
"se",
"sw",
"in",
"out",
"\n"
};
Find the array int rev_dir[] delete the whole thing and replace it with the following...
int rev_dir[] =
{
/* North */ SOUTH,
/* East */ WEST,
/* South */ NORTH,
/* West */ EAST,
/* Up */ DOWN,
/* Down */ UP,
/* NW */ SOUTHEAST,
/* NE */ SOUTHWEST,
/* SE */ NORTHWEST,
/* SW */ NORTHEAST,
/* In */ OUT,
/* Out */ IN
};
In constants.h:
- find the following line...
extern const char *dirs[];
- immediately following it add...
extern const char *abbr_dirs[];
In structs.h:
- Find the #defines for NORTH, SOUTH, etc... and add the following after DOWN...
#define NORTHWEST 6
#define NORTHEAST 7
#define SOUTHEAST 8
#define SOUTHWEST 9
#define IN 10
#define OUT 11
- find the following line...
#define NUM_OF_DIRS 6 /* number of directions in a room (nsewud) */
- and change it to...
#define NUM_OF_DIRS 12 /* number of directions in a room (nsewud) */
In interpreter.h:
- find the #defines for SCMD_NORTH, SCMD_SOUTH, etc. After SCMD_DOWN add the following...
#define SCMD_NW 7
#define SCMD_NE 8
#define SCMD_SE 9
#define SCMD_SW 10
#define SCMD_IN 11
#define SCMD_OUT 12
In interpreter.c:
- find the entries for "north", "south", etc. in the command table. After the entry for "down" add the following...
{ "northwest", POS_STANDING, do_move , 0, SCMD_NW },
{ "nw" , POS_STANDING, do_move , 0, SCMD_NW },
{ "northeast", POS_STANDING, do_move , 0, SCMD_NE },
{ "ne" , POS_STANDING, do_move , 0, SCMD_NE },
{ "southeast", POS_STANDING, do_move , 0, SCMD_SE },
{ "se" , POS_STANDING, do_move , 0, SCMD_SE },
{ "southwest", POS_STANDING, do_move , 0, SCMD_SW },
{ "sw" , POS_STANDING, do_move , 0, SCMD_SW },
{ "in" , POS_STANDING, do_move , 0, SCMD_IN },
{ "out" , POS_STANDING, do_move , 0, SCMD_OUT },
in act.informative.c:
- In the function do_auto_exits find the following line...
slen += sprintf(buf + slen, "%c ", LOWER(*dirs[door]));
- and replace it with...
slen += sprintf(buf + slen, "%s ", abbr_dirs[door]);
- In ACMD(do_exits) find...
sprintf(buf2, "%-5s - [%5d] %s\r\n", dirs[door],
- and replace it with...
sprintf(buf2, "%-5s - [%9d] %s\r\n", dirs[door],
- also find...
sprintf(buf2, "%-5s - ", dirs[door]);
- and replace it with...
sprintf(buf2, "%-9s - ", dirs[door]);
- In ACMD(do_look) find...
/* did the char type 'look
<< Object Surprise! Mob appears and attacks player! [by John Melvin III] | Reply | View as text | Threaded | FTP Uploads 1999/08/29 >>
|
|
|||||||||||||||||||||||||||||||
|
|
| Email address by Peter Ajamian (peter@pajamian.dhs.org) on Saturday, August 12th @ 12:54:26 PM http:// |
| The email address shown for this snippet is no longer valid, if you wish to contact me regarding this snippet please send email to
peter@pajamian.dhs.org. Regards, Peter |
| [ Reply to this comment ] |
|
|
| Small change for "Look In" by Peter Ajamian (peter@pajamian.dhs.org) on Wednesday, September 27th @ 10:58:44 PM http:// |
| Date: Wed, 27 Sep 2000 22:48:12 -0700 From: Peter Ajamian To: Circle Discussion List Subject: Re: [CIRCLE] [CODE] A small patch to Peter Ajamian's multi-exit code Adam Scriven wrote: > > I installed Peter Ajamian's wonderful multi-exit code, ::grins::, why thank you ;-) > but it omits one thing. > When you type "look ", it works OK for everything but IN, Ahh yes, I encountered the same problem myself a while after patching it to my own MUD. I must've forgotten to include it in the snippet. Anyways, I won't bother to post my solution because it is almost identical to the one you came up with. Great work and thanks! > So here's the minor change that I made: > > In act.informative.c, in the function do_look, look for: > else if (is_abbrev(arg, "in")) > look_in_obj(ch, arg2); > > and change it to: > else if ((is_abbrev(arg, "in")) && (*arg2)) > look_in_obj(ch, arg2); > > What this little piece of code does is look for the existance of a 2nd > argument (bag, sack, crate, whatever) and if that exists, "look into" it. > But if it doesn't exist, it gets passed onto the next section of code, which > is the "look " code. Regards, Peter |
| [ Reply to this comment ] |
|
|
| Using this snippet under MSVC++ 6.0 by Scott Davis (bobum@pipeline.com) on Wednesday, December 6th @ 12:24:54 PM http:// |
| Seems that the macros defind as "IN" and "OUT" in this snippet are already being used by MSVC in another .h file as I found out when I got 92 warnings about it after compilation. To remedy this, I just changed every instance of IN and OUT noted in this snippet to MYIN and MYOUT. 0 warning & 0 errors Thanks! |
| [ Reply to this comment ] |
|
|
| Re: Using this snippet under MSVC++ 6.0 by Peter Ajamian (peter@pajamian.dhs.org) on Tuesday, December 19th @ 10:28:16 PM http:// |
| Thanks for the info, I guess there is always some danger of having that happen when you use a language that shares the same namespace for pretty much everything. I would recommend something a little more descriptive such as INDIR and OUTDIR or something like that instead of MYIN and MYOUT. Regards, Peter |
| [ Reply to this comment ] |
|
|
| New Directions Snippet by Peter Ajamian (peter@pajamian.dhs.org) on Thursday, March 29th @ 01:21:49 AM http:// |
| This snippet has been superseded. Please refer to the new one posted on the CircleMUD ftp site at
ftp://ftp.circlemud.org/pub/CircleMUD/contrib/snippets/rooms/exits.txt Regards, Peter |
| [ Reply to this comment ] |