Re: [errata] improved_edit.README

From: Sammy (samedi@clark.net)
Date: 10/28/96


On Sun, 27 Oct 1996, Cyber Reaper wrote:

- > That is cool, also idealy I would like a code editor. :)
- 
- while were at it... how about a way to assign spec_procs in OLC 
- fassion... heck... a online spec_proc editor would be even beter =:)

Hmmm...

int add_mob_spec(sh_int mob_vnum, char *spec_name)
{
  sh_int mob_rnum, i;
  const char *spec_list[] = { /* these are off the top of my head */
    "thief",
    "cleric",
    "puff",
    "\n"
  }

  if((mob_rnum = real_mobile(mob_vnum)) < 0)
    return FALSE;

  for(i = 0; *(spec_list + i) != '\n'; i++)
    if(is_abbrev(spec_name, spec_list[i]))
      break;

  if(*(spec_list + i) = '\n')
    return(FALSE);

  switch(i) {
    case 0:
      ASSIGNMOB(mob_vnum, thief);
      break;
    case 1:
      ASSIGNMOB(mob_vnum, cleric);
      break;
    case 2:
      ASSIGNMOB(mob_vnum, puff;
      break;
    default:
      return(FALSE);
  }

  SET_BIT(MOB_FLAGS(mob_proto + mob_rnum), MOB_SPEC);
  return(TRUE);
}

That's just a short __UNTESTED__ example of a function that assigns am
existing spec_proc to  a mob prototype (you'd have to load a copy of the
mob to have it take effect).  You can add more spec_procs by adding to the
spec_list definition, and adding more case statements.

Want to add it to olc?  Simple.  If I were adding it to obuild (which I'm
planning on doing eventually), I'd add a case to mset names specproc or
something like that, and add this:

  case X:
    if(!*val_arg) {
      send_to_char("Usage:  mset specproc <mob #>\r\n", ch);
      send_to_char("Valid spec_procs are:\r\n", ch);
      send_to_char("thief  cleric  puff\r\n", ch);
      /* add more here too */
      return;
    }

    one_argument(val_arg, arg1);

    if(!add_mob_spec(mob_index[MOB_NEW(ch)->nr].virtual, arg1))
      send_to_char("Invalid spec_proc.\r\n", ch);

    half_chop(val_arg, field, val_arg);
    break;

This is more __UNTESTED__ code.  If you try it out and have problems, send
me the make output and I'll help out.

Sam

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