Re: DG Script %actor.name% problem

From: Carlton Colter (carlton@COLTER.COM)
Date: 10/07/02


>Sorry to keep on posting so many messages regarding this issue...
>
>I think the problem is in these lines of code in find_replacement
>
>      switch (type) {
>      case MOB_TRIGGER:
>        ch = (char_data *) go;
>
>        /* Problemed Section */
>        if ((o = get_object_in_equip(ch, name)));
>        else if ((o = get_obj_in_list(name, ch->carrying)));
>        else if ((c = get_char_room(name, NULL, IN_ROOM(ch))));
>        else if ((o = get_obj_in_list(name,world[IN_ROOM(ch)].contents)));
>        else if ((c = get_char(name)));
>        else if ((o = get_obj(name)));
>        else if ((r = get_room(name))) {}
>        /* End of problem'd section */
>
>        break;
>
>I'm pretty sure of what it does, but not of how it works.  Any help would
>be appreciated.
>
>-Carlton

The solution is to move the else if ((c = get_char(name))); up in the
chain, so if a UID is used it will try it before it looks for people in a
room. So the final looks like this - I also reordered the other stuff for
priority...:

        /* Problemed Section */
        if ((c = get_char(name)));
        else if ((c = get_char_room(name, NULL, IN_ROOM(ch))));
        else if ((o = get_obj(name)));
        else if ((o = get_object_in_equip(ch, name)));
        else if ((o = get_obj_in_list(name, ch->carrying)));
        else if ((o = get_obj_in_list(name,world[IN_ROOM(ch)].contents)));
        else if ((r = get_room(name))) {}
        /* End of problem'd section */

It goes in this order:
char - UID
char - from room
obj - UID
obj - equiped
obj - in inventory
obj - in room
room...

Let me know if this adversely affects anything...

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT