[CODE] SPELLS, SKILLS

tigerdyr@internet.dk
Date: 02/20/97


Hi all..

Since I got tired of the practice command showing both skills and 
spells in a clear mess, here's what I did to get the thing around
----------------*SNIP*-------------------
/* Put these in act.informative.c */ 

ACMD(do_spells)
{
 extern char *spells[];
 extern struct spell_info_type spell_info[];
 int i;

 strcpy(buf, "You know of the following Spells:\r\n"); 
 strcpy(buf2, buf);

 for (i = 1; i < MAX_SPELLS+1; i++) 
 {
  if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
   if (GET_SKILL(ch, i) > 0)
   {
    sprintf(buf, "%-20s %s\r\n", spells[i], howgood(GET_SKILL(ch,
    i))); strcat(buf2, buf);
   }
  }
 }
 page_string(ch->desc, buf2, 1);
}

ACMD(do_skills)
{
 extern char *spells[];
 extern struct spell_info_type spell_info[];
 int i;

 strcpy(buf, "You know of the following Skills:\r\n"); 
 strcpy(buf2, buf);

 for (i = MAX_SPELLS +1; i < MAX_SKILLS+1; i++) 
 {
  if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
   if (GET_SKILL(ch, i) > 0)
   {
    sprintf(buf, "%-20s %s\r\n", spells[i], howgood(GET_SKILL(ch,
    i))); strcat(buf2, buf);
   }
  }
 }
 page_string(ch->desc, buf2, 1);
}
----------------*SNIP*-------------------

All you have to do after that is just to put the ACMD(do_spell) & 
ACMD(do_skills) in interpreter.c 

Only thing about this one, It doesn't sort the things alphabetically. 
If you happen to make that, please send me a mail on 
tigerdyr@internet.dk.

/T-Rex is Outta here..

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



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