Re: [LONG] Avatar and decapitate code with graveyard

From: David Sun (wedget@MCI2000.COM)
Date: 09/02/98


Del Minturn wrote:
> bah humbug!
> For example, code snippets such as extra directions is NOT instability.
> It may be similarity in code, but the zones and mobs is what makes the
> world!
> Other things like OLC, dg_scripts, and other online editing snips are
> similar on the admin side of the house, but has nothing to do with the
> player's side of the house. Soooo if you want originality there, go
> right ahead and reinvent the wheel! NOT ME..
> Originality in my oppinion is adding classes, skills, spells, worlds
> (mobs, objs, zones) That is where you get originality. Maybe some
> special scripting or coding for a zone/mob/obj or what ever.
> Most snippets are there for two reasons:
> 1. To give you either the code your looking for.
> 2. To give you an idea of what to do for what you really want.
> Most people get thier idea's from others. "I saw it on so-n-so's mud. So
> I want that feature for my mud." There is nothing wrong with that or do
> you all think that is code stealing? I have so many things I want added
> to my mud, and some of it I can not code (at this time due to the lack
> of coding knowledge).
> This is where snippets come in! I have modified a lot of them to fit for
> what I want.. Not just Plug-n-Play.
> Instability? NO.. Similarity? (in which way?) Again I disagree.. MOST
> SNIPPETS are some sort of admin code for immortal + for informational
> purposes or building zones.

i'm not totally against snippets at all. i use quite a bit. some things
are so generic that no on would notice if it were coded yourself or a
snippet. and with olc, well, the benefits are two-fold. it saves you
hundreds and hundreds and hundreds of hours of work, and it saves your
builders time from relearning the olc system. with the more complex
snippets, you get an opportunity to look at new and innovative code,
learning a little from other people. but sometimes, snippets are a bane
to all mudkind. take marriage code for example. do you really think that
your mud needs a marriage system like the 200 other muds that used the
same snippet? if you're using the snippet to expand upon, then i applaud
you, but it >seems< that most snippeters aren't modifying it at all,
just pulling an 'ole "plug-n-play". other snippets i DON'T like to be
seen pluged-and-played are ranged weapons, mount system, score command
(only because and you can't even make the score command on your mud
unique), remort (i really hate this snippet), etc......

and to show that most snippets are quite useful, here are some of my
"generic" ones. i hope they find their way to GEORGE GREER's site.

  int i, mmc = 0, dir = NOWHERE, first_move = TRUE;
  char *arg = argument, temp[2];

  for(i = 0; arg[i]; i++) {
    if (isdigit(arg[i])) {
      temp[0] = arg[i];
      temp[1] = '\0';
      mmc *= 10;
      mmc += atoi(temp);
      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;
    if (dir != NOWHERE) {
      if (!mmc)
      for(; mmc > 0; mmc--) {
        if (first_move)
          first_move = FALSE;
          send_to_char("\r\n", ch);
        if (!perform_move(ch, dir, FALSE)) {
          send_to_char("&09Speedwalk terminated prematurely.&00\r\n",
  send_to_char("&10Speedwalk completed successfully.&00\r\n", ch);

...and here's another one...

  struct char_file_u temp;
  struct hiscore_data player[top_of_p_file];
  int i, t = 0, j = 0, k = 0, l = 0;
  FILE *fp;

  if (!(fp = fopen(PLAYER_FILE, "r+"))) {
    send_to_char("&09Error opening player file!&00", ch);
  for (i = 0; i < top_of_p_file; i++) {
    fread(&temp, sizeof(struct char_file_u), 1, fp);
    if (temp.abilities.cha == 3)
      player[i].level = LVL_IMMORT;
      player[i].level = temp.level;
    player[i].mob_kills = temp.player_specials_saved.mob_kills;
    player[i].pc_kills = temp.player_specials_saved.pc_kills;
    player[i].deaths = temp.player_specials_saved.deaths;

  hs_bubble_sort(player, top_of_p_file-1);

  sprintf(buf, "\r\n&12Top Dogs on your MUD&00\r\n");
  strcat(buf, "&12Name                 Lvl  MK   PK   TK    D&00\r\n");
  for (i = 0, t = 0; i < 10 && t < top_of_p_file; t++) {
    if (player[t].level < LVL_IMMORT) {
      j = player[t].mob_kills;
      k = player[t].pc_kills;
      l = player[t].deaths;
      sprintf(buf, "%s&12%-20s %3i  %-4i %-4i %-5i %-4i&00\r\n", buf,
          player[t].name, player[t].level, j, k, j+k, l);
  send_to_char(buf, ch);

void hs_bubble_sort(struct hiscore_data item[], int count)
  register int a, b;
  struct hiscore_data temp;

  for (a = 1; a < count; ++a)
    for (b = count-1; b >= a; --b)
      if (item[b-1].level < item[b].level) {
        temp = item[b-1];
        item[b-1] = item[b];
        item[b] = temp;

here's the struct:

struct hiscore_data {
  char name[MAX_NAME_LENGTH+1];
  int level;
  int mob_kills;
  int pc_kills;
  int deaths;

i know there is no cookie-cutter walkthrough here, but you should know
everything goes, and to add a few extra defines. btw, the hiscore was
a while back, and can be really improved upon. feel free to do so and

"The optimist sees the doughnut, the pessimist sees the hole."

char c[160],z;main(x,d){for/*/      -- Wedge --       /*/(x=159;x--
;c[x]=32);c[79]=z;c[39]=88/*/   /*/;for(d=31;x
=78,puts(c+z),d--;z=80-z)/*/   high school junior   /*/for(;--x;c[x
+80-z]=88-56*!(c[z-!0+x]/*/   mud and game coder   /*/-c[z+x+1]));}

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

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