Re: Help with cleaning code.

From: ;P (siv@CYBERENET.NET)
Date: 02/07/98


>  if (wtype == 0){
>   if (GET_SKILL(ch, SKILL_SWORD) <= 0)
>    send_to_char("You aren't sure which end to hold!\r\n", ch);
>    else if (GET_SKILL(ch, SKILL_SWORD) <20)
>     send_to_char("You take a shaky grip on the weapon.\r\n", ch);
>     else if (GET_SKILL(ch, SKILL_SWORD) <60)
>      send_to_char("You are skilled with this weapon.\r\n", ch);
>      else if (GET_SKILL(ch, SKILL_SWORD) <90)
>       send_to_char("You are an expert with this weapon.\r\n", ch);
>       else if (GET_SKILL(ch, SKILL_SWORD) > 90)
>        send_to_char("This weapon feels like part of you!\r\n", ch);}

what if they have a skill of 90? you might want to make the last one just
"else" instead of "else if (GET_SKILL.."

since you're using the same messages, all you need to do is find a way to
relate wtype to the skill..just make an array like:

int w_skills[] = {
  SKILL_SWORD,  /* wtype 0 */
  .
  .
  .
  SKILL_STAFF   /* wtype 6 */
};

then combine the other code into:

if (GET_SKILL(ch, w_skills[wtype]))
  send_to_char("You aren't sure which end to hold\r\n", ch);
.
.

siv


     +------------------------------------------------------------+
     | 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