Re: [CODE][HELP] Portal Spell yada yada

From: ;P (siv@CYBERENET.NET)
Date: 03/20/98


>     if (GET_OBJ_TYPE(j) == ITEM_PORTAL) {
>       if (GET_OBJ_TIMER(j) > 0)
>           GET_OBJ_TIMER(j)--;
>       if (!GET_OBJ_TIMER(j)) {
>         act("A glowing portal fades from existance.",
>              TRUE, world[j->in_room].people, j, 0, TO_ROOM);
>         act("A glowing portal fades from existance.",
>              TRUE, world[j->in_room].people, j, 0, TO_CHAR);
>         extract_obj(j);

you're crashing on the second act..it is totally superfluous (there isn't
any char not covered by TO_ROOM, and we sure don't want to act to the
object (not very good listeners)), and actually both calls are quite
wrong..just remove the second and change the first to:

act("A glowing portal fades from existance.", TRUE,0, j, 0, TO_ROOM);

here's the comm.c code that's relevant..with an explanation..

  /* ASSUMPTION: at this point we know type must be TO_NOTVICT or TO_ROOM */

  if (ch && ch->in_room != NOWHERE)     /* if a char was provided */
    to = world[ch->in_room].people;
  else if (obj && obj->in_room != NOWHERE) /* if an obj was provided */
    to = world[obj->in_room].people;
  else {
    log_info("SYSERR: no valid target to act()!");
    return;
  }

// we're just giving it an object..so it makes 'to' = to the people in the
// same room as the object..
// there's no need to check the validity of world[j].people before the
// act call because that's done in the loop below that sends it to
// everyone in the room..

  for (; to; to = to->next_in_room)
    if (SENDOK(to) && !(hide_invisible && ch && !CAN_SEE(to, ch)) &&
        (to != ch) && (type == TO_ROOM || (to != vict_obj)))
      perform_act(str, ch, obj, vict_obj, to);

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