Re: NEWBIE Lives system & Prompt

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 02/06/00


Jerry Billings wrote:
>
> Okay I managed to fix the whole thing, the entire lives system works just
> fine, but now i'm trying to add a check for when lives equal 0 to not allow
> the char to log back into the mud...only i cant figure what to do.. I tried
> to add this to comm.c
> if GET_LIVES(ch) == 0 send_to_char("Sorry you have run out of lives", ch)
> CLOSE_SOCKET(desc);
>
> right before:
> SEND_TO_Q(GREETINGS, newd);

Such a check is not necessary because the lives system I showed you sets
the deleted flag for the character, basically that's the equivelent of
deleting the character, so when they try to log back in they'll get a
message such as...

Did I get that right <playername>? (Y/N)

As for the error you were getting earlier, I suspect it may be because
you need to #include "utils.h" in fight.c.

as for !--GET_LIVES(ch) that actually does several things...

1.  the -- decrements the value of GET_LIVES(ch).
2.  becuase the -- is in front of GET_LIVES(ch) the value returned is
the value that it has after being decremented.
3.  The ! means "not" and it forces boolean evaluation of GET_LIVES(ch),
any non-zero value will return true whole zero returns false, and the !
reverses that, so that if GET_LIVES(ch) is zero then it will return
true, basically it's the same as...

--GET_LIVES(ch) == 0

BTW, did I put the !IS_NPC(ch) check in there?  I should have, if not
add it as follows...

if (!IS_NPC(ch) && GET_LEVEL(ch) < LVL_IMMORT && !--GET_LIVES(ch))

oh, and BTW, GET_LIVES(ch) < 1 will not work because it will not
decrement GET_LIVES(ch).

Regards, Peter


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