Re: [CODE]displaying skills/spells better

From: Daniel Koepke (dkoepke@california.com)
Date: 12/15/96


On Sun, 15 Dec 1996, pjh wrote:

> My request is if anyone has gotten or figgered out a skill_list command
> (like skillset's output with no options chosen) of all the skills based on
> CLASS and LEVEL.
> sorta like PRACs output but so a character can list skills available (and
> spells) in any class.

Written inside my mailer (warning: do not try writing code inside your
mailer at home... it's dangerous)...

  ACMD(do_skills) {
    char buf[MAX_STRING_LENGTH];
    char arg[MAX_INPUT_LENGTH];
    int class = CLASS_UNDEFINED, i, col = 0;
    extern spell_info_type spell_info[];
    extern char *spells[];
    extern char *pc_class_types[];

    one_argument(argument, arg);

    if (!arg || !*arg)
      class = GET_CLASS(ch);
    else if ((class = search_block(arg, pc_class_types, FALSE)) == -1) {
      send_to_char("That's not a class.\r\n", ch);
      return;
    }

    sprintf(buf, "The following %s skills/spells are availible to"
                 " mortals:\r\n", pc_class_types[class]);
    for (i = 0; i < MAX_SKILLS; i++) {
      if (spell_info[i].min_level[class] >= LVL_IMMORT)
        continue;
      if (strlen(buf) >= MAX_STRING_LENGTH-32) {
        strcat(buf, "**OVERFLOW**\r\n");
        break;
      }
      sprintf(buf2, "  %-20s%s", spells[i], (!(++col) % 3 ? "\r\n" : ""));
      strcat(buf, buf2);
    }
    if (col % 3)
      strcat(buf, "\r\n");
    page_string(ch->desc, buf, 1);
  }

should probably work, although it's not alphebetized (if you want it
to be, use the spell_sort_info[] from spec_procs.c as the spell num
instead of what I have... not too difficult, just didn't want to do
it without being able to test it).

The above isn't tested (like I said, it's a quick hack-together done
in my mailer), so use it at your own risk.

BTW, I'm done with my mount patch, just need to write up a README for
it.  I've also done a multi-hit patch, I'm working on a small update
to my do_who, and a little bit besides which.  I think I'll upload all
of them tomorrow afternoon.


--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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