On Wed, 2 Sep 1998, David Sun wrote:
>NOTE: <<<GEORGE GREER SCROLL THRU THIS>>>
I already read every post, thank you very much. :)
>and to show that most snippets are quite useful, here are some of my
>more "generic" ones. i hope they find their way to GEORGE GREER's site.
I think you'll want to talk with Alex, not me. He still runs the snippets.
>ACMD(do_speedwalk)
>{
> int i, mmc = 0, dir = NOWHERE, first_move = TRUE;
> char *arg = argument, temp[2];
'argument' is already a char *. You'll also cause a warning if you use
-Wshadow, though CircleMUD already causes a load of them. ;)
> for(i = 0; arg[i]; i++) {
> if (isdigit(arg[i])) {
> temp[0] = arg[i];
> temp[1] = '\0';
> mmc *= 10;
> mmc += atoi(temp);
How about: mmc += arg[0] - '0';
> dir = NOWHERE;
> } else {
> switch(arg[i]) {
> case 'n': case 'N': dir = NORTH; break;
> case 'e': case 'E': dir = EAST; break;
> case 's': case 'S': dir = SOUTH; break;
> case 'w': case 'W': dir = WEST; break;
> case 'u': case 'U': dir = UP; break;
> case 'd': case 'D': dir = DOWN; break;
> default: dir = NOWHERE;
little snippet from act.informative.c:
else if ((look_type = search_block(arg, dirs, FALSE)) >= 0)
look_in_direction(ch, look_type);
> }
> }
> if (dir != NOWHERE) {
> if (!mmc)
> mmc++;
mmc += (mmc == 0);
Although that's a bit much sometimes. :)
>ACMD(do_hiscore)
Don't have time to go through this one though.
>i know there is no cookie-cutter walkthrough here, but you should know
>where everything goes, and to add a few extra defines. btw, the hiscore
>was written a while back, and can be really improved upon. feel free to do
>so and submit.
--
George Greer, greerga@circlemud.org | Genius may have its limitations, but
http://mouse.van.ml.org/ (not done) | stupidity is not thus handicapped.
http://www.van.ml.org/CircleMUD/ | -- Elbert Hubbard
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST