[CODE][NEWBIE][LONG] Trouble with weapon spells and affect in OLC

From: Digital Solutions (digital@TOGETHER.NET)
Date: 06/25/98


Hello, I am having trouble with OasisOLC and adding weapon
spells/affects. I had once before gotten the answer around April/May of
1997 but alas i have lost it :( Anyway here is what i have so far.
oedit.c

/*. Build second half of menu .*/
  sprintbit(GET_OBJ_WEAR(obj), wear_bits, buf1);
  sprintf(buf,
   "%s7%s) Wear flags  : %s%s\r\n"
   "%s8%s) Weight      : %s%d\r\n"
   "%s9%s) Cost        : %s%d\r\n"
   "%sA%s) Cost/Day    : %s%d\r\n"
   "%sB%s) Timer       : %s%d\r\n"
/*.   "%sC%s) Level       : %s%d\r\n" -- Object level .*/
   "%sD%s) Values      : %s%d %d %d %d\r\n"
   "%sE%s) Applies menu\r\n"
   "%sF%s) Extra descriptions menu\r\n"
   "%sG%s) Player affect flags menu\r\n"                 <--- added this

   "%sH%s) Weapon spells menu\r\n"                     <--- added this
   "%sQ%s) Quit\r\n"
   "Enter choice : ",

  grn, nrm, cyn, buf1,
  grn, nrm, cyn, GET_OBJ_WEIGHT(obj),
  grn, nrm, cyn, GET_OBJ_COST(obj),
  grn, nrm, cyn, GET_OBJ_RENT(obj),
  grn, nrm, cyn, GET_OBJ_TIMER(obj),
/*.  grn, nrm, cyn, GET_OBJ_LEVEL(obj), -- Object level .*/
 grn, nrm, cyn, GET_OBJ_VAL(obj, 0),
            GET_OBJ_VAL(obj, 1),
            GET_OBJ_VAL(obj, 2),
            GET_OBJ_VAL(obj, 3),
        grn, nrm, grn, nrm, grn, nrm, grn, nrm, grn, nrm
  );
  send_to_char(buf, d->character);
  OLC_MODE(d) = OEDIT_MAIN_MENU;
}

Then below i added

    case 'g':
    case 'G':
      oedit_disp_paff_menu(d);
      OLC_MODE(d) = OEDIT_AFF;
      break;
    case 'h':
    case 'H':
      oedit_disp_prompt_spells_menu(d);
      OLC_MODE(d) = OEDIT_PROMPT_SPELL;
      break;
    default:
      oedit_disp_menu(d);
      break;
    }
    return;   /* end of OEDIT_MAIN_MENU */

and

/*testing malcor spells_affects*/
      case OEDIT_PROMPT_SPELL:
      number = atoi(arg);
       if (number == 0)
        break;
      else if (number < 0 || number > MAX_SPELL_AFFECT)
      { oedit_disp_prompt_spells_menu(d);
        return;
      }
      OLC_VAL(d) = number -1;
      OLC_MODE(d) = OEDIT_SPELL;
      oedit_disp_spells_menu(d);
      return;
    case OEDIT_SPELL:
     number = atoi(arg);
     if (number == 0)
     { OLC_OBJ(d) ->spell_affect[OLC_VAL(d)].spelltype=0;
       OLC_OBJ(d) ->spell_affect[OLC_VAL(d)].level=0;
       OLC_OBJ(d) ->spell_affect[OLC_VAL(d)].percentage=0;
       oedit_disp_prompt_spells_menu(d);
     } else if (number < 0 || number >= MAX_SPELLS) {
       oedit_disp_spells_menu(d);
       return;
     }
     else
     { OLC_OBJ(d)->spell_affect[OLC_VAL(d)].spelltype = number;
       send_to_char("Level :", d->character);
       OLC_MODE(d) = OEDIT_SPELLLEVEL;
     }
     return;

     case OEDIT_SPELLLEVEL:
     number = atoi(arg);
     OLC_OBJ(d)->spell_affect[OLC_VAL(d)].level = number;
     send_to_char("Percentage of spell going off: ", d->character);
     OLC_MODE(d) = OEDIT_SPELLPER;
     return;

     case OEDIT_SPELLPER:
     number = atoi(arg);
     OLC_OBJ(d)->spell_affect[OLC_VAL(d)].percentage = number;
     oedit_disp_prompt_spells_menu(d);
     return;

also

/* player affects */
void oedit_disp_paff_menu(struct descriptor_data * d)
{
  int i, colums = 0;
  get_char_cols(d->character);
  send_to_char(" [H [J", d->character);
  for (i = 0; i < NUM_AFF_FLAGS; i++)
  {  sprintf(buf, "%s%2d%s) %-20.20s ",
       grn, i+1, nrm, affected_bits[i]
    );
    if(!(++colums % 2))
     strcat(buf, "\r\n");
   send_to_char(buf, d->character);
}
//  sprintbit(AFF_FLAGS(OLC_OBJ(d)), affected_bits, buf1);
    sprintbit(GET_OBJ_AFF(OLC_OBJ(d)), affected_bits, buf1);
    sprintf(buf, "\r\n"
      "Current flags   : %s%s%s\r\n"
      "Enter aff flags (0 to quit) : ",
      cyn, buf1, nrm
  );
  send_to_char(buf, d->character);
}

/* spell types for wpn spells */
void oedit_disp_prompt_spells_menu(struct descriptor_data * d)
{
 int counter;

  get_char_cols(d->character);
  send_to_char(" [H [J", d->character);
   for (counter = 0; counter < MAX_SPELL_AFFECT; counter++) {
    if (OLC_OBJ(d)->spell_affect[counter].spelltype) {
     sprinttype(OLC_OBJ(d)->spell_affect[counter].spelltype, spells,
buf2);
     sprintf(buf, " %s%d%s) %s at level %d, %d success rate\r\n",
               grn, counter +1, nrm,
               buf2, OLC_OBJ(d)->spell_affect[counter].level,
               OLC_OBJ(d)->spell_affect[counter].percentage
   );
  send_to_char(buf, d->character);
} else {
  sprintf(buf, " %s%d%s) None.\r\n", grn, counter + 1, nrm);
  send_to_char(buf, d->character);
 }
}
send_to_char("\r\nEnter spell apply to modify ( 0 to quit ) :",
d->character);
OLC_MODE(d) = OEDIT_PROMPT_SPELL;
}

and

case OEDIT_AFF:
    if (number == 0)
      break;
    else if (number < 0 || number > NUM_AFFECT_FLAGS)
    { oedit_disp_prompt_paff_menu(d);
      return;
    }
   GET_OBJ_AFF(OLC_OBJ(d)) = number;
    return;


What am i missing :(

Thanks in advance
Malcor


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