Re: SYSERRs

From: Robert Moon (LegalWriter@earthlink.net)
Date: 01/21/00


At 12:30 PM 1/21/00 -0500, you wrote:
>Jan 21 12:14:22 :: SYSERR: Mob using
>'((((vict)))->player_specials->saved.pref)'at
>C:\circle30bpl16\src\fight.c:629.
>Jan 21 12:14:22 :: SYSERR: Mob using
>'((((vict)))->player_specials->saved.pref)'at
>C:\circle30bpl16\src\fight.c:631.
>
>629)     send_to_char(CCRED(vict, C_CMP), vict);
>            act(msg->miss_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT
>|            TO_SLEEP);
>631)     send_to_char(CCNRM(vict, C_CMP), vict);

Here's what the syserr is complaining about (and this is identical for
lines 565 and 569 of your original post which are not included in this
response for brevity):  Line 629 is calling a macro defined in screen.h
that checks to see what victim's color preference is prior to sending the
color code for red.  Line 631 is doing the same thing, only it wants to
return the text to normal.  If the victim is a player, then there is no
problem.  As soon as the victim is an NPC (ie, monster, shopkeeper, etc),
we generate the error.  Why?  Because NPCs do not have ANY preference flags
(PRF_xxx).  Therefore, syserr complains that you're forcing it to check
something that doesn't exist for that NPC.

How do you fix it?  Well, for every instance of
    send_to_char(CCNRM(vict, C_CMP), vict);
that generates the error, add this qualifying line right before it:
    if (!IS_NPC(vict))
This translates to:  "If the victim is a player, then go ahead an check his
color preferences and then send the color red if appropriate.  Otherwise,
skip the next line and just send black and white text to the computer
victim via the 'act' function."  Of course the even better way to write the
fragment is to not send ANYTHING to the damn computer NPC victim, since it
doesn't care what blood splatteringly gory text is sent its way -- color or
no color.  It knows you missed.!  :)

I would rewrite lines 629-631 as follows:

    if (!IS_NPC(vict)) {
       send_to_char(CCRED(vict, C_CMP), vict);
       act(msg->miss_msg.victim_msg, FALSE, ch, weap, vict, TO_VICT |
TO_SLEEP);
       send_to_char(CCNRM(vict, C_CMP), vict);
    }

Good luck.
--------------
ICQ:  14598527


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT