Affections Code

From: Bejhan Jetha (nhlstar6@YAHOO.COM)
Date: 02/28/02


Okay I feel pretty dumb for asking this because I'm pretty sure this is an
obvious one but I've never been one of those people who are good with
declaring. I tried to write an affect code which I did if AFF for every
spell or skill which affects you which shows a different message. What I
can't do is duration. I've looked at do stat and tried how it is and I
can't find how it's declared in there either so here's my code:

ACMD(do_affect)
{
bool aff;
aff = TRUE;

sprintf(buf, "&WAffection          Definition
Duration&n\r\n"
             "&R------------------------------------------------------------
------&n\r\n");
    if (affected_by_spell(ch, SPELL_ARMOR))
 strcat(buf, "&GArmor             Affects AC by -20
%3d&n\r\n", af->duration);
    if (affected_by_spell(ch, SPELL_BLESS))
 strcat(buf, "&GBless             Affects hitroll by +2
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_BLIND))
 strcat(buf, "&GBlindness         Loss of vision
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_CHARM))
 strcat(buf, "&GCharmed           Controlled by another being
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_DETECT_INVIS))
 strcat(buf, "&GDetect Invis      You can sense invisiblility
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_INFRAVISION))
 strcat(buf, "&GInfravision       Enables vision in darkness
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_POISON))
 strcat(buf, "&GPoisoned          Affects strength by -2
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_SANCTUARY))
 strcat(buf, "&GSanctuary         Halves physical damage
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_SNEAK))
 strcat(buf, "&GSneak             You walk silently
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_CURSE))
 strcat(buf, "&GCurse             Affects damroll and hitroll by -1
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_DETECT_ALIGN))
 strcat(buf, "&GDetect Align      You can sense alignment
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_DETECT_MAGIC))
 strcat(buf, "&GDetect Magic      You can sense magic
%3d&n\r\n");
    if (IS_AFFECTED(ch, SPELL_DETECT_POISON))
 strcat(buf, "&GDetect Poison     You can sense poison
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_INVISIBLE))
 strcat(buf, "&GInvisible         You are not visible
%3d&n\r\n");
    if (IS_AFFECTED(ch, SPELL_PROT_FROM_EVIL))
 strcat(buf, "&GProtect Evil      You are safe from evil
%3d&n\r\n");
    if (IS_AFFECTED(ch, SPELL_PROT_FROM_GOOD))
 strcat(buf, "&GProtect Good      You are safe from good
%3d&n\r\n");
    if (affected_by_spell(ch, SPELL_STRENGTH))
 strcat(buf, "&GStrength          Affects strength by +2
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_SENSE_LIFE))
 strcat(buf, "&GSense Life        You can sense life
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_INFRAVISION))
 strcat(buf, "&GWaterwalk         Enables walking on water
%3d&n\r\n");
    if (IS_AFFECTED(ch, AFF_HIDE))
 strcat(buf, "&GHidden            You are hidden
                 %3d&n\r\n");
send_to_char(buf, ch);
}

I only tried the duration on one and what I used was "af->duration" and I
get the error message "act.informative.c:2098: `af' undeclared (first use
in this function)" so I don't know how to declare this. I also tried
"af->duration" and I get the error message "act.informative.c:2102: invalid
type argument of `->'".

Well anyways I'll ask you not to flame me if this is as dumb as i assume it
to be.

Thanx,
Bejhan Jetha

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