Re: [Long] Re: Spec_Procs

From: Brian Jones (balif@seka.nacs.net)
Date: 01/02/97


> > "continue", but if the mob actually does something it will "go to next
> > character."   This means that if its a true, the mob did something and
> > thus shouldn't go pick up some trash or attack someone if its scavenger or
> > aggro. correct?
> 
> No, scavenger and aggr. flags on mobs have nothing to do with the
> spec_procs. If you want to find the actions regarding those, go to
> mobact.c and look around. You will also find that there is also another

	from mobact.c, begining at line 42

  for (ch = character_list; ch; ch = next_ch) {
    next_ch = ch->next;

    if (!IS_MOB(ch) || FIGHTING(ch) || !AWAKE(ch))
      continue;

    /* Examine call for special procedure */
    if (MOB_FLAGGED(ch, MOB_SPEC) && !no_specials) {
      if (mob_index[GET_MOB_RNUM(ch)].func == NULL) {
        sprintf(buf, "%s (#%d): Attempting to call non-existing mob func",
                GET_NAME(ch), GET_MOB_VNUM(ch));
        log(buf);
        REMOVE_BIT(MOB_FLAGS(ch), MOB_SPEC);
      } else {
        if ((mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, ""))
          continue;             /* go to next char */
      }
    }
    /* Scavenger (picking up objects) */
    if (MOB_FLAGGED(ch, MOB_SCAVENGER) && !FIGHTING(ch) && AWAKE(ch))
      if (world[ch->in_room].contents && !number(0, 10)) {
        max = 1;
 	...  etc .. rest of flags

My understanding of how this code block works is:

1: Cycle through the mobs
2: If its not a mob, not a player, or fighting, don't do anything.
"Continue", step to the next character in the for loop
3: If mob is flagged to have a spec_proc, check to see if it exists.
   a: if no spec_proc exists, log and remove the bit
4: if not, do  
       if ((mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, ""))
          continue;             /* go to next char */
   and continue to the next char.   
5: If we didn't continue, (mob wasn't fighting, didn't have spec_proc),
then go on to check if the mob is flagged Scavenger, aggro, or whatever.

	Do I have this right? Or is this calling something else. If it
matters, this is from bpl11. thanks for your help. I already have code for
some customized guards and am working on a captian that simulates the
mayor and follows a path around the city. 

	Another person emailed me and told me having 100-150 spec_procs on
a mud with a large amount of playes would lag the mud to badly. I guess I
will try it and see the results. But I found a page that may be of use to
me in coding spec_procs that don't preform unneeded code.
http://seka.nacs.net/~heller/optimize/
  run by one of my admins :)   Maybe it will be of use to someone. 


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