Re: [newbie] mob's current room

From: Rob Baumstark (shirak@CONNECT.AB.CA)
Date: 07/18/97


> From: lsdinc@ELKNET.NET
> To: CIRCLE@post.queensu.ca
> Subject: Re: [newbie] mob's current room
> Date: Friday, July 18, 1997 8:55 PM
>
> At 08:21 PM 7/18/97 -0600, you wrote:
> >> From: lsdinc@ELKNET.NET
> >> To: CIRCLE@post.queensu.ca
> >> Subject: [newbie] mob's current room
> >> Date: Friday, July 18, 1997 7:58 PM
> >>
> >> how do i go about finding a specific mob's current room?
> >>
> >> i have looked all over looking for an example and don't even know
where
> >to
> >> find this.
> >----------
> >Well, 2 ways really.... depending on what you already have.
> >  1) If you have a pointer to it already.
> >         ch->in_room  (or vict->in_room, whatever)
> >  2) If you have it's name in a string
> >         struct char_data *mob = get_char_room_vis(ch, name);
> >(get_char_vis() will return anywhere in world)
> >         where ch is the person looking for the mob, and name is the
name
> >of the mob, eg. "guard"
> >         I think thats how it works, just search for get_char_room_vis
and
> >I'm sure you'll find lots of examples.
> >
>
> ok, just one last question... how could i use that with char_to_room?
>
> what i want to do is send the character to the same room as the mob.
----------
Well, assuming that the char is not in the same room then, and that this is
a command, like "go guard", i would do something like this, but you can't
use go, it's taken.
ACMD(do_go)
{
        struct char_data *mob;
        skip_spaces(&argument);
        if(mob = get_char_vis(ch, argument))
        {
                char_from_room(ch);
                char_to_room(ch, mob->in_room);
                look_at_room(ch); /* command something like this */
        }
        else
                send_to_char(NOPERSON, ch);
}

remember, this is mailer code, and probably has a few bugs in it.  just
writing from memory.

     Rob Baumstark:   shirak@connect.ab.ca
                      cst0656@nait.ab.ca
   Forsaken Realms:   telnet://drewl.v-wave.com:4000


     +------------------------------------------------------------+
     | 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/08/00 PST