Re: Abbreviate acting strange?

From: Sean Daley (sdaley@bbnplanet.com)
Date: 12/06/98


I can point out one problem in the code here.  I'm not
sure if it's the main cause of what you're seeing but
let's take a look at this.

The following section checks for an argument if no
argument is given than it chooses the victim the
person is attacking (if that exists).  So by just typing
bash during a fight we now have vict set here.

>  if (!*argument) { /* No Argument */
>   if (FIGHTING(ch)) {
>    vict = FIGHTING(ch);
>   } else {
>    send_to_char("Bash who?\r\n", ch);
>   }
>  }

By typing just bash we have no argument so the next part
of the code should be tied into the previous if statement.
Why process the argument if we previously determined that
no argument exists?

>
>  one_argument(argument, arg);
>  log(argument);
>

Now, as we assumed, we typed just bash during a fight
without an argument already set vict.  The following
line will change whatever we set vict to in the beginning.
This section too should be tied into the first if
statement.  Not sure what the result is of calling
get_char_room_vis(ch, arg) here.  To be honest, I
would think that this check should fail and you'd get
the "Bash who?" message, but that doesn't seem to
be what you get.

>  if (!(vict = get_char_room_vis(ch, arg))) {
>   send_to_char("Bash who?\r\n", ch);
>   return;
>  }

After re-reading my response, I decided to check outl bpl14
to see how that code handles this, since maybe a code
snippet will be a better explanation :)

Not sure what version of circle you're using, but here's
the section of code in circlebpl14 that handles this.

one_argument(argument, arg);

... Some skill checks and weapon checks taken out ...

if (!(vict = get_char_room_vis(ch, arg))) {
  if (FIGHTING(ch) && IN_ROOM(ch) == IN_ROOM(FIGHTING(ch))) {
    vict = FIGHTING(ch);
  } else {
    send_to_char("Bash who?\r\n", ch);
    return;
  }
}

As you can see, they've pretty much tied that whole section
into one small block here.

Hopefully this helps in some way and explains something :)

Good luck.

Sean


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